Hi Bruno,<div><br></div><div>On Wed, Jun 27, 2012 at 10:58 AM, Bruno Daniel <span dir="ltr"><<a href="mailto:abml@mailoo.org" target="_blank">abml@mailoo.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nicolas,<br>
<br>
thanks for your detailed answer! Now I understand the issues a little better.<br>
I'm going to install LLVM + Vmkit and try it out using JNI.<br>
<br>
Regarding the garbage collector, do you think that the Garbage Collection ABI<br>
of C++11 could be implemented in a way compatible to the JVM's garbage collector?<br>
<a href="http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi" target="_blank">http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi</a></blockquote><div><br></div><div>Hmm, isn't that GC for C++ conservative? Ie treats integers whose value clash with an object pointer as a pointer to the heap? Then I would not use it.... For sure it can be compatible, but it would hurt big time the performance of the JVM. </div>
<div><br></div><div>Nicolas</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Perhaps this could make the C/C++/Java integration quite seamless and the<br>
two worlds of the C-ABI languages and the JVM languages could be united.<br>
<div class="im HOEnZb"><br>
All the best<br>
  Bruno Daniel<br>
<br>
</div><div class="HOEnZb"><div class="h5">Nicolas Geoffray wrote:<br>
> Hi Bruno,<br>
><br>
> On Wed, Jun 20, 2012 at 3:04 PM, Bruno Daniel <<a href="mailto:abml@mailoo.org">abml@mailoo.org</a>> wrote:<br>
><br>
>> Dear developers,<br>
>><br>
>> Are there any benchmarks for the performance of Java Native Interface (JNI)<br>
>> calls in VMKit? Since VMKit is based on LLVM which can also run C++ code<br>
>> (maybe in the same just-in-time compiler?) I guess calls from Java to C++<br>
>> and<br>
>> back could be much faster than in Sun's JVM which has extremely slow C++ -><br>
>> Java callbacks.<br>
>><br>
>> If this was the case, this would be a big advantage of VMKit over all other<br>
>> JVMs and mixing existing C/C++ libraries with Java would be as easy as in<br>
>> the<br>
>> glue language Python.<br>
>><br>
><br>
> While mixing C/C++/Java with the same compiler seems appealing for<br>
> performance, Java has a garbage collector, and a garbage collector does not<br>
> cope well with native frames. It requires object indirection when leaving<br>
> Java boundaries, as well as being able to interrupt the execution of a<br>
> thread for initiating a collection.<br>
><br>
> Note that it is possible to do it: VMKit is written in C/C++ and objects<br>
> are being passed directly, and a C++ frame, since it is compiled by clang<br>
> can be interrupted. However, it is very subtle how it works, and a slight<br>
> omission of a GC object declaration leads to crashes that are hard to<br>
> detect. It's always possible to do better, like defining a convention that<br>
> will tell clang which objects are being used by the GC, but it hasn't been<br>
> worked on yet.<br>
><br>
> If you don't care about a GC, then sure, you can compiler C/C++/Java into a<br>
> single native executable, where performance of inter-language calls are the<br>
> same as intra-language calls.<br>
><br>
> Also, note that there were some works on trying to optimize JNI calls<br>
> through inlining at runtime (<a href="http://dl.acm.org/citation.cfm?id=1064997" target="_blank">http://dl.acm.org/citation.cfm?id=1064997</a>). I<br>
> don't know if the optimization is actually being used in existing JVMs.<br>
><br>
> Hope this helps!<br>
> Nicolas<br>
><br>
><br>
>><br>
>> All the best<br>
>>   Bruno Daniel<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>
>><br>
</div></div></blockquote></div><br></div>