8342409: [s390x] C1 unwind_handler fails to unlock synchronized methods with LM_MONITOR

Reviewed-by: rrich, lucy
This commit is contained in:
Amit Kumar 2024-10-18 08:30:41 +00:00
parent 0963b9e891
commit 9201e9fcc2
2 changed files with 9 additions and 1 deletions

View File

@ -216,7 +216,11 @@ int LIR_Assembler::emit_unwind_handler() {
LIR_Opr lock = FrameMap::as_opr(Z_R1_scratch);
monitor_address(0, lock);
stub = new MonitorExitStub(lock, true, 0);
__ unlock_object(Rtmp1, Rtmp2, lock->as_register(), *stub->entry());
if (LockingMode == LM_MONITOR) {
__ branch_optimized(Assembler::bcondAlways, *stub->entry());
} else {
__ unlock_object(Rtmp1, Rtmp2, lock->as_register(), *stub->entry());
}
__ bind(*stub->continuation());
}

View File

@ -120,6 +120,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
branch_optimized(Assembler::bcondNotZero, slow_case);
// done
bind(done);
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
}
@ -151,6 +153,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
// If the object header was not pointing to the displaced header,
// we do unlocking via runtime call.
branch_optimized(Assembler::bcondNotEqual, slow_case);
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
// done
bind(done);