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