<br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 9:52 AM, nicolas geoffray <span dir="ltr"><<a href="mailto:nicolas.geoffray@gmail.com">nicolas.geoffray@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Tue, Jul 20, 2010 at 5:35 PM, Joshua Warner <span dir="ltr"><<a href="mailto:joshuawarner32@gmail.com" target="_blank">joshuawarner32@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Nicolas,<br><br><div class="im">I plan on using the Avian GC (which is a precise, generational collector).  </div></blockquote><div><br></div><div>OK - Great!</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Eventually, I'd like to fully integrate all of the runtime services Avian provides - even integrating the existing Avian JIT compiler, to allow for partially-AOT builds.<br>
<br>Avian does indeed have it's own class library, but I would be very surprised if VMKit could compile with them - they are sufficiently conformant for many applications, but far from a complete implementation.  </blockquote>

<div><br></div></div><div>VMKit does not need for the libraries to be complete, just the VM interface to be fulfilled (eg methods in Class.java).</div><div class="im"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Avian also supports using GNU Classpath, and I was planning on targeting this feature.<br></blockquote><div><br></div></div><div>OK</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>As I understand it, LLVM itself can compile code for most of the mentioned platforms, and ARM support is coming along nicely.<br><br></blockquote><div><br></div></div><div>Yes indeed. I don't know what is the status of windows support but at least for the mentioned archs/os, LLVM is a great choice.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">If VMKit is to serve as the compiler, I have a number of requirements that need to be at least fairly easy to add (or already present):<br>


<br>* Custom lowering (platform independent) of operations like virtual and interface calls.  Currently, Avian uses the lower bits of the virtual method table to store various data, so loading the virtual table requires masking out those bits.  Avian also uses a fairly unique implementation of hashing for interface method lookup (unique in the implementation, not the algorithm).  In this case, it may be easier to modify Avian to fit with VMKit, instead of visa-versa.<br>

</blockquote><div><br></div></div><div>Sure, that's one major strength of LLVM: we could decide on a runtime function (CallVirtualMethod) that will get lowered depending on the underlying VM. I don't see any difficulties in accomplishing this.</div>
</div></blockquote><div><br>Is it common practice to emit function calls that are expected to be lowered by a later pass?  I know LLVM uses this kind of thing with intrinsics (llvm.gcroot, for instance), but a pass lowering calls to specific functions seems very... messy.<br>
<br>What about something like a --emit-unlowered-llvm option on llcj that just spits out the LLVM IR before running this lowering pass?<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>* Access to stack maps at GC safe points<br><br></blockquote><div><br></div></div><div>LLVM/VMKit already has it: VMKit uses the OCaml GC in LLVM to generate stack maps in the executable.</div><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

* Access to unwind tables<br><br></blockquote><div><br></div><div>I believe that's for Java exceptions? The current non-optimal implementation of Java exceptions in VMKit is to check after each call site if an exception has been raised. In older versions, VMKit used C++ exceptions and Dwarf table, but that proved to be very inefficient in a mixed JIT/AOT environment (the libgcc implementation of JIT exceptions is not optimized).</div>

<div><br></div><div>LLVM is capable of generating dwarf/unwind tables at compile-time (and also in a JIT environment), so you should get access to these tables in a standard fashion. The only caveat is that you need to change VMKit and they way it compiles exception handlers and exception checks.</div>
</div></blockquote><div><br>Could this be another case for emitting calls in the IR that are lowered by a later pass?<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div class="im">
<div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">* Configurable object layout - capability to configure the number of words in the object header, etc.  Again, it may be easier to modify Avian.<br>


<br></blockquote><div><br></div></div><div>This hasn't been tested  at a large scale (GCs that VMKit support only need a 2 word header), but you should be able to define what is an object header. The generated AOT Java code does make some assumptions on how is the header for object synchronization, but we can decide on a method that VMKit and Avian could lowered to different implementations.</div>
</div></blockquote><div><br>Avian only needs a 1-word header - it uses the lower bits of the vtable pointer for GC and hashing.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">* Able to output object files (preferably) or assembly for the target platform, with appropriate global symbols for functions, etc. to be linked as a boot image.<br>

</blockquote><div><br></div></div><div>VMKit already does that, thanks to LLVM code generators.</div></div></blockquote><div><br>I was more concerned with whether this is what the llcj driver does.  <br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div class="im"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>Do you know if VMKit already has these features?  If not, would it be fairly straightforward to add them in such a way as to also benefit VMKit (I don't want to maintain a custom branch)?<br>

<font color="#888888">
<br></font></blockquote><div><br></div></div><div>I think it you decide to use VMKit, we can easily agree on how to share a same code base, with VMKit and Avian JVM having their own lowering pass.</div><div><br></div><font color="#888888"><div>
Nicolas</div></font></div></blockquote><div><br>On the VMKit side, I'd be worried about the implications of adding extra steps in the compilation process, particularly if their only purpose is supporting another VM.  Personally, if I were a VMKit developer, such a feature would be high on my list of things to remove, unless such a feature turned out to be useful in other ways.  Is this a feature that could genuinely improve VMKit, or do you see this as something that would only end up being used with Avian?  <br>
</div><div><br>It sounds as if the big sticking point is support for 64-bit linux.  It wouldn't be all that bad to require cross-compiling all AOT Avian builds from a linux machine (not worrying about building on windows), but I don't think I could justify supporting *only* 32-bit linux as a build platform.  32 bit systems are on their way out.<br>
<br>Just to be clear, I do fully intend on using llvm - the only question is what I use to compile class files down to llvm IR (or directly to native object files).<br><br>Joshua<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div><div></div><div class="h5">
<div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font color="#888888">Joshua</font><div><div></div><div><br><br><div class="gmail_quote">
On Tue, Jul 20, 2010 at 9:07 AM, nicolas geoffray <span dir="ltr"><<a href="mailto:nicolas.geoffray@gmail.com" target="_blank">nicolas.geoffray@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Joshua,<div><br></div><div>What plans did you have for GC? No GC at all or Avian JVM has its own GC (and is it precise or not?)?</div><div><br></div><div>If you're not planning on using VMKit's GCs, then 64-bit system should not be a big problem: the only problem that we have now is compiling GNU Classpath, and most probably Avian JVM has its own version of the class libraries?</div>



<div><br></div><div>Also, note that platform support will be strongly dependent on LLVM support.</div><div><br></div><div><font color="#888888">Nicolas</font><div><div></div><div><br><br><div class="gmail_quote">
On Tue, Jul 20, 2010 at 4:41 PM, Joshua Warner <span dir="ltr"><<a href="mailto:joshuawarner32@gmail.com" target="_blank">joshuawarner32@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Nicolas,<br><br>Thanks for all your help, but if 64-bit systems are still a big problem, perhaps the VMKit AOT compiler is not the best solution to my problem.  I'd like to be able to support the major (if not all all) platforms that the Avian JVM supports - x86 & x86_64 linux & windows, powerpc darwin and ARM.<br>




<br>Regards,<br><font color="#888888">Joshua</font><div><div></div><div><br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 8:00 AM, nicolas geoffray <span dir="ltr"><<a href="mailto:nicolas.geoffray@gmail.com" target="_blank">nicolas.geoffray@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Joshua,<div><br></div><div>If you can get a running 32bit system, I'd suggest you do so, as you'll get up to speed right away. I can't test VMKit on a 64bits machine, and I have been aware that there are some compilation/execution problems. Besides, the current GCs of VMKit do not work on 64bits (neither MMTk nor GCMmap2).</div>





<div><br></div><div><font color="#888888">Nicolas</font><div><div></div><div><br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 3:56 PM, Joshua Warner <span dir="ltr"><<a href="mailto:joshuawarner32@gmail.com" target="_blank">joshuawarner32@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Minas,<br><br>I tried recompiling Classpath with -fno-omit-frame-pointer, and now, instead of printing an error message, j3 just segfaults in <br>"j3::JnjvmClassLoader::loadClassFromAsciiz(char const*, bool, bool) ()"<br>






<br>I ran llcj under strace and found that it is not even opening the input or output files, but is otherwise running normally.<br><br>Updating to the latest SVN version (revision 108831) didn't change anything (I was only a few days out of date).<br>






<br>I'm not sure where to go from here.  Does this fit with any of the known problems under 64-bit linux?<br><br>Thanks,<br><font color="#888888">Joshua</font><div><div></div><div><br><br><div class="gmail_quote">
On Mon, Jul 19, 2010 at 4:45 PM, Minas Abrahamyan <span dir="ltr"><<a href="mailto:minas.subs@gmail.com" target="_blank">minas.subs@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Joshua,<br>
<div>> $ j3 Hello<br>
> j3: JavaClass.cpp:480: j3::JavaObject* j3::Class::doNew(j3::Jnjvm*):<br>
> Assertion `(this->isInitializing() ||<br>
> classLoader->getCompiler()->isStaticCompiling()) && "Uninitialized class<br>
> when allocating."' failed.<br>
> Aborted<br>
<br>
</div>Regarding to j3 in 64 bit version, it should work now after we've<br>
found crush reason,<br>
both in Debug and in Release versions. (and its 32 bit version was<br>
continuously working)<br>
<br>
But your case is something strange, crush didn't type such messages.<br>
Have you taken VMkit from svn and latest version?<br>
Also, to get j3 running recompile classpath with<br>
-fno-omit-frame-pointer (or take my patch from here:<br>
<a href="http://lists.cs.uiuc.edu/pipermail/vmkit-commits/attachments/20100719/35754a6f/attachment.bin" target="_blank">http://lists.cs.uiuc.edu/pipermail/vmkit-commits/attachments/20100719/35754a6f/attachment.bin</a><br>







and apply it:<br>
$ cd classpath-0.97.2<br>
$ patch ./configure ./classpath_configure64.patch<br>
)<br>
<br>
That's now on j3<br>
<br>
Regards,<br>
<font color="#888888">Minas<br>
</font><div><br>
On Mon, Jul 19, 2010 at 9:20 PM, Joshua Warner <<a href="mailto:joshuawarner32@gmail.com" target="_blank">joshuawarner32@gmail.com</a>> wrote:<br>
> Forgot to send to the mailing list...<br>
><br>
> ---------- Forwarded message ----------<br>
> From: Joshua Warner <<a href="mailto:joshuawarner32@gmail.com" target="_blank">joshuawarner32@gmail.com</a>><br>
> Date: Mon, Jul 19, 2010 at 10:19 AM<br>
> Subject: Re: [LLVMdev] Building VMKit<br>
> To: nicolas geoffray <<a href="mailto:nicolas.geoffray@gmail.com" target="_blank">nicolas.geoffray@gmail.com</a>><br>
><br>
><br>
> Thanks Nicolas, that worked great!<br>
><br>
> Now, I'm having trouble invoking the compiler properly:<br>
> $ llcj Hello.class -o=Hello.ll<br>
> $ cat Hello.ll<br>
> cat: Hello.ll: No such file or directory<br>
> $ j3 Hello<br>
> j3: JavaClass.cpp:480: j3::JavaObject* j3::Class::doNew(j3::Jnjvm*):<br>
> Assertion `(this->isInitializing() ||<br>
> classLoader->getCompiler()->isStaticCompiling()) && "Uninitialized class<br>
> when allocating."' failed.<br>
> Aborted<br>
> $ java Hello<br>
> hello, world!<br>
><br>
> "Hello" is a completely banal "hello world!" program.<br>
><br>
> Joshua<br>
</div><div><div></div><div>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div></div></div><br>
</blockquote></div><br>