diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index f275ebfa3e6..6cc044962c2 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1562,10 +1562,6 @@ address OptoRuntime::handle_exception_C(JavaThread* current) { // *THIS IS NOT RECOMMENDED PROGRAMMING STYLE* // address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address ret_pc) { - - // Enable WXWrite: the function called directly by compiled code. - MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread)); - // ret_pc will have been loaded from the stack, so for AArch64 will be signed. // This needs authenticating, but to do that here requires the fp of the previous frame. // A better way of doing it would be authenticate in the caller by adding a diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp index c8dbcbc5e83..36ce7a532eb 100644 --- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp +++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp @@ -248,6 +248,8 @@ static JRT_LEAF(intptr_t*, thaw(JavaThread* thread, int kind)) // JRT_ENTRY instead? ResetNoHandleMark rnhm; + // we might modify the code cache via BarrierSetNMethod::nmethod_entry_barrier + MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); return ConfigT::thaw(thread, (Continuation::thaw_kind)kind); JRT_END diff --git a/src/hotspot/share/runtime/interfaceSupport.inline.hpp b/src/hotspot/share/runtime/interfaceSupport.inline.hpp index dd43537c4c2..9de1f8126d1 100644 --- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp +++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp @@ -260,8 +260,6 @@ class VMNativeEntryWrapper { #define VM_LEAF_BASE(result_type, header) \ debug_only(NoHandleMark __hm;) \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, \ - JavaThread::current())); \ os::verify_stack_alignment(); \ /* begin of body */ diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index 844ad977402..cf12c51c5fd 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -479,6 +479,9 @@ address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* curr return StubRoutines::cont_returnBarrierExc(); } + // write lock needed because we might update the pc desc cache via PcDescCache::add_pc_desc + MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, current)); + // The fastest case first CodeBlob* blob = CodeCache::find_blob(return_address); CompiledMethod* nm = (blob != nullptr) ? blob->as_compiled_method_or_null() : nullptr; @@ -2058,6 +2061,9 @@ JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal return; } + // write lock needed because we might update the pc desc cache via PcDescCache::add_pc_desc + MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, JavaThread::current())); + CodeBlob* cb = CodeCache::find_blob(caller_pc); if (cb == nullptr || !cb->is_compiled() || callee->is_unloading()) { return;