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

Jorn Vernee jvernee at openjdk.java.net
Wed Oct 21 11:37:17 UTC 2020


On Mon, 19 Oct 2020 11:24:45 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> 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.

I've fixed the following issues from review comments:
- don't rely on `MethodHandles::adapter_code_size` (after private discussion)
- update copyright years
- use VM-internal API instead of JNI when parsing ABIDescriptor and BufferLayout objects while generating down/up call wrappers.

As far as I see, that covers all open review comments.

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

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



More information about the security-dev mailing list