8293922: Extend barrier-less Java thread transitions to native transitions
Reviewed-by: mdoerr, pchilanomate, dcubed
This commit is contained in:
parent
a07902bcbe
commit
1b496064bf
@ -29,6 +29,7 @@
|
||||
// No interfaceSupport.hpp
|
||||
|
||||
#include "gc/shared/gc_globals.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/javaThread.inline.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
@ -97,7 +98,11 @@ class ThreadStateTransition : public StackObj {
|
||||
assert(to == _thread_in_vm || to == _thread_in_Java, "invalid transition");
|
||||
assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "Unwalkable stack in native transition");
|
||||
|
||||
thread->set_thread_state_fence(_thread_in_vm);
|
||||
if (!UseSystemMemoryBarrier) {
|
||||
thread->set_thread_state_fence(_thread_in_vm);
|
||||
} else {
|
||||
thread->set_thread_state(_thread_in_vm);
|
||||
}
|
||||
SafepointMechanism::process_if_requested_with_exit_check(thread, to != _thread_in_Java ? false : check_asyncs);
|
||||
thread->set_thread_state(to);
|
||||
}
|
||||
|
@ -145,9 +145,9 @@ inline JavaThreadState JavaThread::thread_state() const {
|
||||
#if defined(PPC64) || defined (AARCH64) || defined(RISCV64)
|
||||
// Use membars when accessing volatile _thread_state. See
|
||||
// Threads::create_vm() for size checks.
|
||||
return (JavaThreadState) Atomic::load_acquire((volatile jint*)&_thread_state);
|
||||
return Atomic::load_acquire(&_thread_state);
|
||||
#else
|
||||
return _thread_state;
|
||||
return Atomic::load(&_thread_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -157,9 +157,9 @@ inline void JavaThread::set_thread_state(JavaThreadState s) {
|
||||
#if defined(PPC64) || defined (AARCH64) || defined(RISCV64)
|
||||
// Use membars when accessing volatile _thread_state. See
|
||||
// Threads::create_vm() for size checks.
|
||||
Atomic::release_store((volatile jint*)&_thread_state, (jint)s);
|
||||
Atomic::release_store(&_thread_state, s);
|
||||
#else
|
||||
_thread_state = s;
|
||||
Atomic::store(&_thread_state, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user