Hi, Thanks a lot for the help! I am getting some errors though: I am on a 32 bit chroot on a x86_64 system. Thus llc guesses the wrong architecture from the module bitcode and spits out x86_64 assembly. I fixed this by adding "-march=x86" to the llc options in llcj. gcc doesn't know what -lgc is. I'm guessing it is the garbage collection library. How can I get it or point gcc to the right library? llcj -mem2reg MemberVar.class /usr/bin/ld: cannot find -lgc collect2: ld returned 1 exit status If I have class files that depends on other class files, will llcj be able to find those and compile them into the executable as well? Also, I have an addition to the Java standard library backported from Java 7, which is necessary for my project. JSR166: http://gee.cs.oswego.edu/dl/concurrency-interest/ Of course, I'm not sure JnJvm supports multiple cores, but this is more a proof of concept than anything. Should I just insert the necessary classes into glibj.zip and recompile libvmjc.so? Thanks, Michael nicolas geoffray wrote:> Hi Michael, > > Currently, you can run vmjc created .bc files by statically linking > them with all the .o needed files. For that, you can use the llcj > tool, which works more or less like GCC's gcj tool. > > Note that you also need to create the libvmjc.so file, which contains > the standard library in native form. Do a make in the > tools/vmjc/libvmjc directory. Once this is done, update the > LD_LIBRARY_PATH shell variable to contain this file, and update PATH > to contain the llvm tools and the vmkit tools. You will then be able > to use llcj. > > Let me know if that helped. I will write a more detailed howto on > vmkit's website in a few days. > > Nicolas > > On Sun, Dec 6, 2009 at 10:07 PM, Michael Wu <mmwu at princeton.edu > <mailto:mmwu at princeton.edu>> wrote: > > Hi, > > What do I need to link with vmjc created .bc files to actually run > the .bc file? I tried running with lli but only got: > LLVM ERROR: Program used external function 'StartJnjvmWithoutJIT' > which > could not be resolved! > > Thanks, > Michael > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Hi Michael, On Tue, Dec 8, 2009 at 6:26 PM, Michael Wu <mmwu at princeton.edu> wrote:> Hi, > > Thanks a lot for the help! I am getting some errors though: > > I am on a 32 bit chroot on a x86_64 system. Thus llc guesses the wrong > architecture from the module bitcode and spits out x86_64 assembly. I fixed > this by adding "-march=x86" to the llc options in llcj. >OK.> > gcc doesn't know what -lgc is. I'm guessing it is the garbage collection > library. How can I get it or point gcc to the right library? >-lgc is for the boehmgc in case you configured vmkit to use it. Since you don't need it (vmkit uses its own gc by default), you should change the tools/llcj/llcj.cpp file, remove the line with "-lgc" and recompile it. Yes, it's _that_ of a new feature yet :)> llcj -mem2reg MemberVar.class > /usr/bin/ld: cannot find -lgc > > collect2: ld returned 1 exit status > > If I have class files that depends on other class files, will llcj be able > to find those and compile them into the executable as well? > >No, but you can create a big .jar file containing all the class files you need.> Also, I have an addition to the Java standard library backported from Java > 7, which is necessary for my project. JSR166: > http://gee.cs.oswego.edu/dl/concurrency-interest/ > >Add it to the big .jar file.> Of course, I'm not sure JnJvm supports multiple cores, but this is more a > proof of concept than anything. > >OK, if it has native functions, chances are jnjvm does not implement them.> Should I just insert the necessary classes into glibj.zip and recompile > libvmjc.so? > >You can do that, or just insert them to your .jar file. Cheers, Nicolas> Thanks, > Michael > > nicolas geoffray wrote: > >> Hi Michael, >> >> Currently, you can run vmjc created .bc files by statically linking them >> with all the .o needed files. For that, you can use the llcj tool, which >> works more or less like GCC's gcj tool. >> >> Note that you also need to create the libvmjc.so file, which contains the >> standard library in native form. Do a make in the tools/vmjc/libvmjc >> directory. Once this is done, update the LD_LIBRARY_PATH shell variable to >> contain this file, and update PATH to contain the llvm tools and the vmkit >> tools. You will then be able to use llcj. >> >> Let me know if that helped. I will write a more detailed howto on vmkit's >> website in a few days. >> >> Nicolas >> >> On Sun, Dec 6, 2009 at 10:07 PM, Michael Wu <mmwu at princeton.edu <mailto: >> mmwu at princeton.edu>> wrote: >> >> Hi, >> >> What do I need to link with vmjc created .bc files to actually run >> the .bc file? I tried running with lli but only got: >> LLVM ERROR: Program used external function 'StartJnjvmWithoutJIT' >> which >> could not be resolved! >> >> Thanks, >> Michael >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >> http://llvm.cs.uiuc.edu >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091208/58ee4bd6/attachment.html>
Hi, I've managed to compile it the class down to a native executable. However, the executable runs for a while then spits out: terminate called without an active exception Aborted and dies. The program never gets to the normal output. Here is a stack trace from gdb: #0 0xf3f6baa6 in raise () from /lib/libc.so.6 #1 0xf3f6d3a8 in abort () from /lib/libc.so.6 #2 0xf41918f8 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6 #3 0xf418f7d5 in ?? () from /usr/lib/libstdc++.so.6 #4 0xf418f812 in std::terminate () from /usr/lib/libstdc++.so.6 #5 0xf418f94a in __cxa_throw () from /usr/lib/libstdc++.so.6 #6 0x0806d4d0 in jnjvm::JavaThread::throwPendingException () #7 0x0808c118 in jnjvm::JavaMethod::invokeJavaObjectStaticAP () #8 0x0808c2ba in jnjvm::JavaMethod::invokeJavaObjectStatic () #9 0x0806e3a0 in jnjvm::Jnjvm::loadAppClassLoader () #10 0x08072488 in jnjvm::Jnjvm::loadBootstrap () #11 0x080725e5 in jnjvm::Jnjvm::mainJavaStart () #12 0x080b2556 in mvm::Thread::internalThreadStart () #13 0xf408dfc0 in start_thread () from /lib/libpthread.so.0 #14 0xf4011e7e in clone () from /lib/libc.so.6 The java file itself is very simple: public class NumProcs { /** * Displays the number of processors available in the Java Virtual Machine */ public static void main(String[] args) { Runtime runtime = Runtime.getRuntime(); int nrOfProcessors = runtime.availableProcessors(); System.out.println("Number of processors available to the Java Virtual Machine: " + nrOfProcessors); } } I just updated to the latest revision in svn. Michael nicolas geoffray wrote:> Hi Michael, > > > On Tue, Dec 8, 2009 at 6:26 PM, Michael Wu <mmwu at princeton.edu > <mailto:mmwu at princeton.edu>> wrote: > > Hi, > > Thanks a lot for the help! I am getting some errors though: > > I am on a 32 bit chroot on a x86_64 system. Thus llc guesses the > wrong architecture from the module bitcode and spits out x86_64 > assembly. I fixed this by adding "-march=x86" to the llc options > in llcj. > > > OK. > > > > gcc doesn't know what -lgc is. I'm guessing it is the garbage > collection library. How can I get it or point gcc to the right > library? > > > -lgc is for the boehmgc in case you configured vmkit to use it. Since > you don't need it (vmkit uses its own gc by default), you should > change the tools/llcj/llcj.cpp file, remove the line with "-lgc" and > recompile it. Yes, it's _that_ of a new feature yet :) > > > llcj -mem2reg MemberVar.class > /usr/bin/ld: cannot find -lgc > > collect2: ld returned 1 exit status > > If I have class files that depends on other class files, will llcj > be able to find those and compile them into the executable as well? > > > No, but you can create a big .jar file containing all the class files > you need. > > > Also, I have an addition to the Java standard library backported > from Java 7, which is necessary for my project. JSR166: > http://gee.cs.oswego.edu/dl/concurrency-interest/ > > > Add it to the big .jar file. > > > Of course, I'm not sure JnJvm supports multiple cores, but this is > more a proof of concept than anything. > > > OK, if it has native functions, chances are jnjvm does not implement them. > > > Should I just insert the necessary classes into glibj.zip and > recompile libvmjc.so? > > > You can do that, or just insert them to your .jar file. > > Cheers, > Nicolas > > > Thanks, > Michael > > nicolas geoffray wrote: > > Hi Michael, > > Currently, you can run vmjc created .bc files by statically > linking them with all the .o needed files. For that, you can > use the llcj tool, which works more or less like GCC's gcj tool. > > Note that you also need to create the libvmjc.so file, which > contains the standard library in native form. Do a make in the > tools/vmjc/libvmjc directory. Once this is done, update the > LD_LIBRARY_PATH shell variable to contain this file, and > update PATH to contain the llvm tools and the vmkit tools. You > will then be able to use llcj. > > Let me know if that helped. I will write a more detailed howto > on vmkit's website in a few days. > > Nicolas > > On Sun, Dec 6, 2009 at 10:07 PM, Michael Wu > <mmwu at princeton.edu <mailto:mmwu at princeton.edu> > <mailto:mmwu at princeton.edu <mailto:mmwu at princeton.edu>>> wrote: > > Hi, > > What do I need to link with vmjc created .bc files to > actually run > the .bc file? I tried running with lli but only got: > LLVM ERROR: Program used external function > 'StartJnjvmWithoutJIT' > which > could not be resolved! > > Thanks, > Michael > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> > <mailto:LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>> > http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >