From 32e528092568c38496e104c267cf793b810f3520 Mon Sep 17 00:00:00 2001 From: zifeihan Date: Wed, 21 Feb 2024 10:28:58 +0800 Subject: [PATCH] remove slow_path_set_flag Label --- .../cpu/riscv/c2_MacroAssembler_riscv.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 957eb3b086c91..8298b63106733 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -242,7 +242,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis // Finish fast lock successfully. MUST branch to with flag == 0 Label locked; // Finish fast lock unsuccessfully. slow_path MUST branch to with flag != 0 - Label slow_path, slow_path_set_flag; + Label slow_path; if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(flag, obj); @@ -281,10 +281,10 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis assert(oopDesc::mark_offset_in_bytes() == 0, "required to avoid a lea"); // Try to lock. Transition lock-bits 0b01 => 0b00 - ori(tmp1_mark, tmp1_mark, markWord::unlocked_value); - xori(tmp3_t, tmp1_mark, markWord::unlocked_value); - cmpxchg(obj, tmp1_mark, tmp3_t, Assembler::int64, Assembler::aq, Assembler::relaxed, tmp3_t); - bne(tmp1_mark, tmp3_t, slow_path_set_flag); + ori(flag, tmp1_mark, markWord::unlocked_value); + xori(tmp3_t, flag, markWord::unlocked_value); + cmpxchg(obj, flag, tmp3_t, Assembler::int64, Assembler::aq, Assembler::relaxed, tmp3_t); + bne(flag, tmp3_t, slow_path); bind(push); // After successful lock, push object on lock-stack. @@ -313,7 +313,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis beqz(flag, locked); // Check if recursive. - bne(flag, xthread, slow_path_set_flag); + bne(flag, xthread, slow_path); // Recursive. mv(flag, zr); @@ -329,10 +329,6 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis beqz(flag, flag_correct); stop("Fast Lock Flag != 0"); #endif - Label end; - j(end); - bind(slow_path_set_flag); - mv(flag, 1); bind(slow_path); #ifdef ASSERT // Check that slow_path label is reached with flags != 0. @@ -340,7 +336,6 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis stop("Fast Lock Flag == 0"); bind(flag_correct); #endif - bind(end); // C2 uses the value of flags (0 vs !0) to determine the continuation. }