Skip to content

Commit

Permalink
C1: fix unlock in unwind handler for LM_MONITOR
Browse files Browse the repository at this point in the history
  • Loading branch information
reinrich committed Oct 14, 2024
1 parent ba3774d commit 5b7ae81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ int LIR_Assembler::emit_unwind_handler() {
if (method()->is_synchronized()) {
monitor_address(0, FrameMap::R4_opr);
stub = new MonitorExitStub(FrameMap::R4_opr, true, 0);
__ unlock_object(R5, R6, R4, *stub->entry());
if (LockingMode == LM_MONITOR) {
__ b(*stub->entry());
} else {
__ unlock_object(R5, R6, R4, *stub->entry());
}
__ bind(*stub->continuation());
}

Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
/*check without membar and ldarx first*/true);
// If compare/exchange succeeded we found an unlocked object and we now have locked it
// hence we are done.
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
b(done);

Expand Down Expand Up @@ -168,6 +170,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
MacroAssembler::cmpxchgx_hint_release_lock(),
noreg,
&slow_int);
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
b(done);
bind(slow_int);
Expand Down

0 comments on commit 5b7ae81

Please sign in to comment.