JNI inefficiency

Robert Engels rengels at optionscity.com
Mon Jun 26 17:59:08 UTC 2017

I originally sent this message to compiler-dev and realize that is probably
not the correct mailing list... so

In the sharedRuntime_x86_64.cpp the generate_native_wrapper is somewhat
inefficient for a very important case. (I assume this is also the case for
other platforms).

The 'critical native' allows for much more efficient JNI calls, but often
these don't need to pass any java arrays - that is, all parameters and
return values use handles (simple ints?) in the native code, or pointers to
a 'direct buffer'.

The generate_native_wrapper() ALWAYS adds to the code to ask the GC_Locker
if a gc is needed when calling a native critical method.

It should only be adding this check if the number of 'java array arguments'
is greater than 0. Similarly, it should be the same after the JNI method

This will make many JNI calls much more efficient.


*Robert Engels*

OptionsCity Software
150 S. Wacker Dr., Suite 2300
Chicago, IL 60606

O. +1 (312) 605-4500 | F. +1 (312) 635-1751

*Connect with OptionsCity at *www.optionscity.com  | LinkedIn
<https://www.linkedin.com/company/optionscity-software-inc->  |  Twitter
<https://twitter.com/optionscity>  |  YouTube
<https://www.youtube.com/user/optionscity>  |  Facebook
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20170626/86a5c196/attachment.html>

More information about the hotspot-compiler-dev mailing list