Skip to content

Commit 8276202

Browse files
reinrichpull[bot]
authored andcommitted
8341715: PPC64: ObjectMonitor::_owner should be reset unconditionally in nmethod unlocking
Reviewed-by: mdoerr, lucy
1 parent 20a40d3 commit 8276202

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

26572669
void 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

27582777
void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister flag, Register obj, Register box,

0 commit comments

Comments
 (0)