mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8220351: Cross-modifying code
Reviewed-by: rrich, mdoerr, dholmes, eosterlund
This commit is contained in:
parent
dbe0da648a
commit
76cdc8016f
21 changed files with 96 additions and 13 deletions
|
@ -1836,6 +1836,10 @@ void JavaThread::run() {
|
|||
// Thread is now sufficiently initialized to be handled by the safepoint code as being
|
||||
// in the VM. Change thread state from _thread_new to _thread_in_vm
|
||||
ThreadStateTransition::transition_and_fence(this, _thread_new, _thread_in_vm);
|
||||
// Before a thread is on the threads list it is always safe, so after leaving the
|
||||
// _thread_new we should emit a instruction barrier. The distance to modified code
|
||||
// from here is probably far enough, but this is consistent and safe.
|
||||
OrderAccess::cross_modify_fence();
|
||||
|
||||
assert(JavaThread::current() == this, "sanity check");
|
||||
assert(!Thread::current()->owns_locks(), "sanity check");
|
||||
|
@ -2439,7 +2443,6 @@ int JavaThread::java_suspend_self() {
|
|||
this->SR_lock()->wait(Mutex::_no_safepoint_check_flag);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2467,6 +2470,9 @@ void JavaThread::java_suspend_self_with_safepoint_check() {
|
|||
set_thread_state(_thread_blocked);
|
||||
java_suspend_self();
|
||||
set_thread_state(state);
|
||||
// Since we are not using a regular thread-state transition helper here,
|
||||
// we must manually emit the instruction barrier after leaving a safe state.
|
||||
OrderAccess::cross_modify_fence();
|
||||
InterfaceSupport::serialize_thread_state_with_handler(this);
|
||||
if (state != _thread_in_native) {
|
||||
SafepointMechanism::block_if_requested(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue