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

Coleen Phillimore coleen.phillimore at oracle.com
Fri Oct 16 12:09:10 UTC 2020



On 10/16/20 7:15 AM, Jorn Vernee wrote:
> On Thu, 15 Oct 2020 22:42:49 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>
>>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>>
>>>    Re-add file erroneously deleted (detected as rename)
>> 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.

Yes, that would be so much nicer.
Coleen

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



More information about the hotspot-dev mailing list