Hi Linghua,<div><br></div><div>There was a bug in the AOT compiler in revision 0.27 that got fixed in svn. Also, note that the AOT compiler does not work with MMTk right now (long-term plan to implement it), and that there is a bug with the GCMmap2 also that should be fixed soon.</div>
<div><br></div><div>By using svn versions of llvm and vmkit, you will soon be able to generate libvmjc.so. And yes, consider yourself lucky if it "only" takes 80 minutes to generate libvmjc.so on your machine :)</div>
<div><br></div><div>Cheers,</div><div>Nicolas</div><div><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 3:48 PM, Linghua Tseng <span dir="ltr"><<a href="mailto:uranus@tinlans.org">uranus@tinlans.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I followed instructions in this page to setup my environment:<br>
  <a href="http://vmkit.llvm.org/get_started.html" target="_blank">http://vmkit.llvm.org/get_started.html</a><br>
<br>
My llvm, llvm-gcc, and vmkit are not SVN version.<br>
All of them are downloaded from this page:<br>
  <a href="http://llvm.org/releases/download.html#2.7" target="_blank">http://llvm.org/releases/download.html#2.7</a><br>
GNU classpath is downloaded from:<br>
  <a href="ftp://ftp.gnu.org/gnu/classpath/classpath-0.97.2.tar.gz" target="_blank">ftp://ftp.gnu.org/gnu/classpath/classpath-0.97.2.tar.gz</a><br>
PNet & PNetlib are not used because I just want the JVM.<br>
<br>
I use these arguments to configure my VMKit:<br>
./configure --prefix=/home/lhtseng/llvm<br>
                  --with-llvmsrc=/home/lhtseng/llvm/src/llvm<br>
                  --with-llvmobj=/home/lhtseng/llvm/obj/llvm<br>
                  --with-gnu-classpath-libs=/home/lhtseng/llvm/lib/classpath<br>
                  --with-gnu-classpath-glibj=/home/lhtseng/llvm/share/classpath/glibj.zip<br>
                  --with-llvmgcc<br>
                  --with-gc=mmtk<br>
and then use `make ENABLE_OPTIMIZED=1' to build it<br>
(I follow the instructions in this page: <a href="http://vmkit.llvm.org/use_mmtk.html" target="_blank">http://vmkit.llvm.org/use_mmtk.html</a>)<br>
After it's done, `j3' works properly.<br>
<br>
Then I follow these instructions to enable AOT compilation:<br>
  <a href="http://vmkit.llvm.org/use_aot.html" target="_blank">http://vmkit.llvm.org/use_aot.html</a><br>
  * cd tools/vmjc/libvmjc<br>
  * make ENABLE_OPTIMIZED=1 REQUIRES_FRAME_POINTER=1<br>
And an error is occurred:<br>
============================================================<br>
llvm[0]: Compiling glibj.zip to llvm<br>
llvm[0]: Optimizing glibj.zip<br>
Instruction does not dominate all uses!<br>
  %60 = getelementptr %MutatorThread* %59, i32 0, i32 6 ; <i1*> [#uses=2]<br>
  %191 = load i1* %60                             ; <i1> [#uses=1]<br>
Instruction does not dominate all uses!<br>
  %191 = load i1* %60                             ; <i1> [#uses=1]<br>
  br i1 %191, label %277, label %192<br>
Broken module found, compilation aborted!<br>
0  opt 0x08489718<br>
Stack dump:<br>
0.      Program arguments: /home/lhtseng/llvm/obj/llvm/Release/bin/opt -std-compile-opts -f glibj.zip.bc -o glibj-optimized.zip.bc<br>
1.      Running pass 'Function Pass Manager' on module 'glibj.zip.bc'.<br>
2.      Running pass 'Module Verifier' on function<br>
'@JnJVM_gnu_CORBA_CDR_VMVio_allocateObject__Ljava_lang_Class_2Ljava_lang_Class_2Ljava_lang_reflect_Constructor_2'<br>
============================================================<br>
<br>
Someone suggested me to use GCMmap2 without llvm-gcc instead of MMTk.<br>
So I use the following arguments to reconfigure my VMKit:<br>
./configure --prefix=/home/lhtseng/llvm<br>
                  --with-llvmsrc=/home/lhtseng/llvm/src/llvm<br>
                  --with-llvmobj=/home/lhtseng/llvm/obj/llvm<br>
                  --with-gnu-classpath-libs=/home/lhtseng/llvm/lib/classpath<br>
                  --with-gnu-classpath-glibj=/home/lhtseng/llvm/share/classpath/glibj.zip<br>
                  --with-gc=multi-mmap<br>
Now libvmjc.so can be generated (It takes 80+ minutes on Intel i7 920).<br>
<br>
I use this command for testing the AOT compilation:<br>
  llcj --main=HelloWorld HelloWorld.class -o test<br>
A lot of undefined reference errors occurred:<br>
============================================================<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `javax_xml_stream_util_XMLEventConsumer_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `javax_security_auth_Destroyable_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `java_io_FilenameFilter_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `java_awt_image_BufferedImageOp_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to<br>
`gnu_javax_crypto_kwa_IKeyWrappingAlgorithm_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `javax_swing_table_TableColumnModel_VirtualMethods'<br>
/home/lhtseng/llvm/obj/vmkit/Release/lib/libvmjc.so: undefined reference to `org_w3c_dom_ls_LSParserFilter_VirtualMethods'<br>
...<br>
============================================================<br>
All of them have the suffix `_VirtualMethods'.<br>
<br>
<br>
`nm libvmjc.so | grep javax_xml_stream_util_XMLEventConsumer_VirtualMethods'  shows:<br>
============================================================<br>
                 U javax_xml_stream_util_XMLEventConsumer_VirtualMethods<br>
031743b0 D javax_xml_stream_util_XMLEventConsumer_VirtualMethods3244<br>
============================================================<br>
<br>
`nm liblibvmjc.so | grep javax_security_auth_Destroyable_VirtualMethods' shows:<br>
============================================================<br>
               U javax_security_auth_Destroyable_VirtualMethods<br>
02f46fe0 D javax_security_auth_Destroyable_VirtualMethods1698<br>
============================================================<br>
<br>
Do I miss some important steps?<br>
<br>
To checkout llvm, llvm-gcc, and vmkit from SVN's release_27 doesn't help me.<br>
release_28 & trunk version of llvm cannot build the trunk version of vmkit (llc complains it doesn't support '-f' option).<br>
<br>
My system environment is:<br>
  Linux 2.6.33-gentoo #1 SMP Mon Apr 5 11:41:31 CST 2010 i686 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz GenuineIntel GNU/Linux<br>
  gcc version 4.4.4 (Gentoo 4.4.4-r2 p1.2, pie-0.4.5)<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>