From 025755b2d834669bb54d9cf8404383ba3a5f0194 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 5 Apr 2024 16:01:52 +0000 Subject: [PATCH] Shuffle code to preserve short-jump on non-assert paths --- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 99ed7ae41a1bd..c79753618c0ac 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -1008,7 +1008,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box, Regist // Check if recursive. cmpptr(thread, rax_reg); - jcc(Assembler::notEqual, slow_path); + jccb(Assembler::notEqual, slow_path); // Recursive. increment(Address(tagged_monitor, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions))); @@ -1022,15 +1022,18 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box, Regist #ifdef ASSERT // Check that locked label is reached with ZF set. Label zf_correct; + Label zf_bad_zero; jcc(Assembler::zero, zf_correct); - stop("Fast Lock ZF != 1"); + jmp(zf_bad_zero); #endif bind(slow_path); #ifdef ASSERT // Check that slow_path label is reached with ZF not set. - jccb(Assembler::notZero, zf_correct); + jcc(Assembler::notZero, zf_correct); stop("Fast Lock ZF != 0"); + bind(zf_bad_zero); + stop("Fast Lock ZF != 1"); bind(zf_correct); #endif // C2 uses the value of ZF to determine the continuation.