8223312: Utilize handshakes instead of is_thread_fully_suspended

Reviewed-by: dholmes, rrich, dcubed, eosterlund
This commit is contained in:
Robbin Ehn 2020-10-22 15:16:50 +00:00
parent cc50c8d4f1
commit 4634dbef6d
6 changed files with 235 additions and 437 deletions

View file

@ -1749,8 +1749,10 @@ address Deoptimization::deoptimize_for_missing_exception_handler(CompiledMethod*
#endif
void Deoptimization::deoptimize_frame_internal(JavaThread* thread, intptr_t* id, DeoptReason reason) {
assert(thread == Thread::current() || SafepointSynchronize::is_at_safepoint(),
"can only deoptimize other thread at a safepoint");
assert(thread == Thread::current() ||
thread->is_handshake_safe_for(Thread::current()) ||
SafepointSynchronize::is_at_safepoint(),
"can only deoptimize other thread at a safepoint/handshake");
// Compute frame and register map based on thread and sp.
RegisterMap reg_map(thread, false);
frame fr = thread->last_frame();
@ -1762,7 +1764,8 @@ void Deoptimization::deoptimize_frame_internal(JavaThread* thread, intptr_t* id,
void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id, DeoptReason reason) {
if (thread == Thread::current()) {
Thread* current = Thread::current();
if (thread == current || thread->is_handshake_safe_for(current)) {
Deoptimization::deoptimize_frame_internal(thread, id, reason);
} else {
VM_DeoptimizeFrame deopt(thread, id, reason);