RFR: 8258032: Reconsider LEAF entry restrictions

Ron Pressler rpressler at openjdk.java.net
Tue Jan 5 11:58:58 UTC 2021


On Fri, 18 Dec 2020 19:38:09 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> This change allows JRT_LEAF functions to create Handles because it doesn't need them but some code inside the VM needs Handles.  There's a NoSafepointVerifier in JRT_LEAF functions.
> The JNI_LEAF and JVM_LEAF functions have NoHandleMark (so you can't create handles) but the transition ThreadInVMfromNative will reenable the HandleMarks, so that all this code doesn't have to do it itself.
> Tested with tier1-6.

src/hotspot/share/code/compiledMethod.cpp line 707:

> 705:     Thread* thread = Thread::current();
> 706:     ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
> 707:     HandleMark hm(thread);

Why was the `HandleMark` removed here? Is it not needed?

src/hotspot/share/runtime/interfaceSupport.inline.hpp line 353:

> 351: #define VM_LEAF_BASE(result_type, header)                            \
> 352:   TRACE_CALL(result_type, header)                                    \
> 353:   debug_only(NoHandleMark __hm;)                                     \

Shouldn't `NoSafepointVerifier` be added here and then it can be removed from `JRT_LEAF`?

src/hotspot/share/runtime/interfaceSupport.inline.hpp line 484:

> 482:   result_type JNICALL header {                                       \
> 483:     VM_Exit::block_if_vm_exited();                                   \
> 484:     debug_only(NoHandleMark __hm;)                                   \

Why does `JVM_LEAF` need `NoHandleMark`?

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

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


More information about the serviceability-dev mailing list