8263709: Cleanup THREAD/TRAPS/CHECK usage in JRT_ENTRY routines

Reviewed-by: coleenp, hseigel, iklam, kvn
This commit is contained in:
David Holmes 2021-04-15 02:20:31 +00:00
parent f4c3efd9cf
commit 79bff21b43
23 changed files with 906 additions and 919 deletions

View file

@ -78,6 +78,7 @@ class ThreadStateTransition : public StackObj {
ThreadStateTransition(JavaThread *thread) {
_thread = thread;
assert(thread != NULL, "must be active Java thread");
assert(thread == Thread::current(), "must be current thread");
}
// Change threadstate in a manner, so safepoint can detect changes.
@ -315,9 +316,9 @@ class VMNativeEntryWrapper {
#define JRT_ENTRY(result_type, header) \
result_type header { \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
ThreadInVMfromJava __tiv(thread); \
VM_ENTRY_BASE(result_type, header, thread) \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
ThreadInVMfromJava __tiv(current); \
VM_ENTRY_BASE(result_type, header, current) \
debug_only(VMEntryWrapper __vew;)
// JRT_LEAF currently can be called from either _thread_in_Java or
@ -342,28 +343,28 @@ class VMNativeEntryWrapper {
#define JRT_ENTRY_NO_ASYNC(result_type, header) \
result_type header { \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
ThreadInVMfromJava __tiv(thread, false /* check asyncs */); \
VM_ENTRY_BASE(result_type, header, thread) \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
ThreadInVMfromJava __tiv(current, false /* check asyncs */); \
VM_ENTRY_BASE(result_type, header, current) \
debug_only(VMEntryWrapper __vew;)
// Same as JRT Entry but allows for return value after the safepoint
// to get back into Java from the VM
#define JRT_BLOCK_ENTRY(result_type, header) \
result_type header { \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
HandleMarkCleaner __hm(thread);
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
HandleMarkCleaner __hm(current);
#define JRT_BLOCK \
{ \
ThreadInVMfromJava __tiv(thread); \
Thread* THREAD = thread; \
ThreadInVMfromJava __tiv(current); \
Thread* THREAD = current; \
debug_only(VMEntryWrapper __vew;)
#define JRT_BLOCK_NO_ASYNC \
{ \
ThreadInVMfromJava __tiv(thread, false /* check asyncs */); \
Thread* THREAD = thread; \
ThreadInVMfromJava __tiv(current, false /* check asyncs */); \
Thread* THREAD = current; \
debug_only(VMEntryWrapper __vew;)
#define JRT_BLOCK_END }