RFR: 8254231: Implementation of Foreign Linker API (Incubator) [v4]

Jorn Vernee jvernee at openjdk.java.net
Mon Oct 19 11:29:23 UTC 2020


On Fri, 16 Oct 2020 11:12:01 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/hotspot/cpu/x86/foreign_globals_x86.cpp line 56:
>> 
>>> 54: }
>>> 55:
>>> 56: const ABIDescriptor parseABIDescriptor(JNIEnv* env, jobject jabi) {
>> 
>> I don't know if you care about performance but of these env->calls transition into the VM and back out again.  You
>> should prefix all the code that comes from java to native with JNI_ENTRY and just use native JVM code to implement
>> these.
>
> Currently this is prefixed with `JVM_ENTRY` e.g. like:
> JVM_ENTRY(jlong, PI_generateAdapter(JNIEnv* env, jclass _unused, jobject abi, jobject layout))
>   {
>     ThreadToNativeFromVM ttnfvm(thread);
>     return ProgrammableInvoker::generate_adapter(env, abi, layout);
>   }
> JVM_END
> (where `generate_adapter` ends up calling `parseABIDescriptor`)
> 
> JVM_ENTYRY seems to be mostly the same except for JNI_ENTRY having a `WeakPreserverExceptionMark` as well. Do we need
> to switch these? Also, I guess if we want to use VM code directly, we should get rid of the `ThreadToNativeFromVM` RAII
> handle.

re-wrote this code to use the VM internal APIs instead of JNI, changes are isolated in a sub-pr here:
https://github.com/mcimadamore/jdk/pull/1 Could you take a look?

-------------

PR: https://git.openjdk.java.net/jdk/pull/634



More information about the build-dev mailing list