Are Java native methods inlined ?
aph at redhat.com
Wed Apr 27 10:33:19 UTC 2016
On 27/04/16 10:12, Nassim Halli wrote:
> Just a simple question : are Java native methods inlined ?
> By "native methods" I mean the interface between the Java caller and
> the targeted native JNI function in the dl (for which the
> JIT-compiled code can be observed using *+PrintNativeNMethods)*.
> I ask this question since I don't observe inlining with Java 8 and I
> heard it was. Although I understand that it could not necessarily
> lead to great improvements it's just for a clarification.
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.
More information about the hotspot-compiler-dev