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

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


On Thu, 15 Oct 2020 23:15:07 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)
>
> I looked through some Hotspot runtime code and that looks ok.  I saw a couple of strange things on my way through the
> code.  See comments.

Hi David, this code somewhat predates me, so I initially kept the JVM_ENTRY since that was what was already in place.
IIRC the thread state transition was added later to be able to call JNI code, which checks that the thread state is
native in some asserts.

I've re-written this code, per @coleenp 's suggestion, to use VM code directly to replace what we were doing with JNI,
so the thread state transition is also gone.

I've looked at some of the *_ENTRY macros and the only one that seems to avoid the thread state transition is JVM_LEAF.
I've switched the RegisterNatives functions we use to JVM_LEAF to avoid the redundant transitions. I also tried
changing `PI_invokeNative` to JVM_LEAF, but since we can call back into Java from that, I run into a missing handle
mark assert for some of the tests, so I've left that one as JVM_ENTRY (but removed some redundant braces).

I've created a separate sub-pr against this PR's branch to make it easier to see what I've changed:
https://github.com/mcimadamore/jdk/pull/1 (feel free to take a look).

Thanks for the comments.

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

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



More information about the build-dev mailing list