From 5b7ae81f8bf36c385b6d1cabfa81bcdb68bf5ac3 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Wed, 9 Oct 2024 18:42:36 +0200 Subject: [PATCH] C1: fix unlock in unwind handler for LM_MONITOR --- src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp | 6 +++++- src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp index 684c06614a97a..92a39e6e3565b 100644 --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -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()); } diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp index 83fad376d292a..ea4d76e200fc2 100644 --- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp @@ -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); @@ -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);