Are Java native methods inlined ?

John Rose john.r.rose at oracle.com
Wed Apr 27 21:13:15 UTC 2016


On Apr 27, 2016, at 3:33 AM, Andrew Haley <aph at redhat.com> wrote:
> 
> The glue code between Java and native code is not inlined into its
> caller but it is generated by the JIT compiler.  Like every
> optimization in HotSpot, this is only done for hot code.  If you run
> something like Netbeans you'll see a lot of native nmethods generated.

In Project Panama we are experimenting with inlining wrapper logic
for native calls.  But the 20-year practice in HotSpot is (as you say)
to roll a separate, non-inlined wrapper for each JNI method.  The JIT
per se does not create this wrapper, but rather this logic:

http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/61a214186dae/src/cpu/x86/vm/sharedRuntime_x86_64.cpp#l1825

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160427/e80a11b9/attachment.html>


More information about the hotspot-compiler-dev mailing list