@@ -2651,7 +2651,19 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
26512651 // flag == NE indicates failure
26522652 bind (success);
26532653 inc_held_monitor_count (temp);
2654+ #ifdef ASSERT
2655+ // Check that unlocked label is reached with flag == EQ.
2656+ Label flag_correct;
2657+ beq (flag, flag_correct);
2658+ stop (" compiler_fast_lock_object: Flag != EQ" );
2659+ #endif
26542660 bind (failure);
2661+ #ifdef ASSERT
2662+ // Check that slow_path label is reached with flag == NE.
2663+ bne (flag, flag_correct);
2664+ stop (" compiler_fast_lock_object: Flag != NE" );
2665+ bind (flag_correct);
2666+ #endif
26552667}
26562668
26572669void MacroAssembler::compiler_fast_unlock_object (ConditionRegister flag, Register oop, Register box,
@@ -2701,17 +2713,12 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
27012713 bind (object_has_monitor);
27022714 STATIC_ASSERT (markWord::monitor_value <= INT_MAX);
27032715 addi (current_header, current_header, -(int )markWord::monitor_value); // monitor
2704- ld (temp, in_bytes (ObjectMonitor::owner_offset ()), current_header);
2705-
2706- // In case of LM_LIGHTWEIGHT, we may reach here with (temp & ObjectMonitor::ANONYMOUS_OWNER) != 0.
2707- // This is handled like owner thread mismatches: We take the slow path.
2708- cmpd (flag, temp, R16_thread);
2709- bne (flag, failure);
27102716
27112717 ld (displaced_header, in_bytes (ObjectMonitor::recursions_offset ()), current_header);
2712-
27132718 addic_ (displaced_header, displaced_header, -1 );
27142719 blt (CCR0, notRecursive); // Not recursive if negative after decrement.
2720+
2721+ // Recursive unlock
27152722 std (displaced_header, in_bytes (ObjectMonitor::recursions_offset ()), current_header);
27162723 if (flag == CCR0) { // Otherwise, flag is already EQ, here.
27172724 crorc (CCR0, Assembler::equal, CCR0, Assembler::equal); // Set CCR0 EQ
@@ -2752,7 +2759,19 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
27522759 // flag == NE indicates failure
27532760 bind (success);
27542761 dec_held_monitor_count (temp);
2762+ #ifdef ASSERT
2763+ // Check that unlocked label is reached with flag == EQ.
2764+ Label flag_correct;
2765+ beq (flag, flag_correct);
2766+ stop (" compiler_fast_unlock_object: Flag != EQ" );
2767+ #endif
27552768 bind (failure);
2769+ #ifdef ASSERT
2770+ // Check that slow_path label is reached with flag == NE.
2771+ bne (flag, flag_correct);
2772+ stop (" compiler_fast_unlock_object: Flag != NE" );
2773+ bind (flag_correct);
2774+ #endif
27562775}
27572776
27582777void MacroAssembler::compiler_fast_lock_lightweight_object (ConditionRegister flag, Register obj, Register box,
0 commit comments