8275286: Check current thread when calling JRT methods that expect it

Reviewed-by: zgu, coleenp, dholmes
This commit is contained in:
Aleksey Shipilev 2021-10-15 11:15:49 +00:00
parent c0f3e1d6be
commit ced79091f6

View File

@ -300,6 +300,7 @@ class VMNativeEntryWrapper {
#define JRT_ENTRY(result_type, header) \
result_type header { \
assert(current == JavaThread::current(), "Must be"); \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
ThreadInVMfromJava __tiv(current); \
VM_ENTRY_BASE(result_type, header, current) \
@ -327,6 +328,7 @@ class VMNativeEntryWrapper {
#define JRT_ENTRY_NO_ASYNC(result_type, header) \
result_type header { \
assert(current == JavaThread::current(), "Must be"); \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
ThreadInVMfromJava __tiv(current, false /* check asyncs */); \
VM_ENTRY_BASE(result_type, header, current) \
@ -336,17 +338,20 @@ class VMNativeEntryWrapper {
// to get back into Java from the VM
#define JRT_BLOCK_ENTRY(result_type, header) \
result_type header { \
assert(current == JavaThread::current(), "Must be"); \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \
HandleMarkCleaner __hm(current);
#define JRT_BLOCK \
{ \
assert(current == JavaThread::current(), "Must be"); \
ThreadInVMfromJava __tiv(current); \
JavaThread* THREAD = current; /* For exception macros. */ \
debug_only(VMEntryWrapper __vew;)
#define JRT_BLOCK_NO_ASYNC \
{ \
assert(current == JavaThread::current(), "Must be"); \
ThreadInVMfromJava __tiv(current, false /* check asyncs */); \
JavaThread* THREAD = current; /* For exception macros. */ \
debug_only(VMEntryWrapper __vew;)