8275950: Use only _thread_in_vm in ~ThreadBlockInVMPreprocess()

Reviewed-by: dholmes, dcubed
This commit is contained in:
Patricio Chilano Mateo 2021-11-01 15:27:39 +00:00
parent 4ac8403f9a
commit f55e68c929
3 changed files with 3 additions and 13 deletions

View File

@ -228,15 +228,13 @@ class ThreadBlockInVMPreprocess : public ThreadStateTransition {
}
~ThreadBlockInVMPreprocess() {
assert(_thread->thread_state() == _thread_blocked, "coming from wrong thread state");
// Change to transition state and ensure it is seen by the VM thread.
_thread->set_thread_state_fence(_thread_blocked_trans);
// Change back to _thread_in_vm and ensure it is seen by the VM thread.
_thread->set_thread_state_fence(_thread_in_vm);
if (SafepointMechanism::should_process(_thread, _allow_suspend)) {
_pr(_thread);
SafepointMechanism::process_if_requested(_thread, _allow_suspend);
}
_thread->set_thread_state(_thread_in_vm);
}
static void emptyOp(JavaThread* current) {}

View File

@ -706,7 +706,6 @@ void SafepointSynchronize::block(JavaThread *thread) {
}
JavaThreadState state = thread->thread_state();
assert(is_a_block_safe_state(state), "Illegal threadstate encountered: %d", state);
thread->frame_anchor()->make_walkable(thread);
uint64_t safepoint_id = SafepointSynchronize::safepoint_counter();

View File

@ -128,14 +128,7 @@ class SafepointSynchronize : AllStatic {
static bool is_a_block_safe_state(JavaThreadState state) {
// Check that we have a valid thread_state before blocking for safepoints
switch(state) {
case _thread_in_vm:
case _thread_in_Java: // From compiled code
case _thread_blocked_trans:
return true;
default:
return false;
}
return state == _thread_in_vm || state == _thread_in_Java;
}
// Called when a thread voluntarily blocks
static void block(JavaThread *thread);