@@ -1532,7 +1532,7 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
15321532 Label L_rtm_retry, L_decrement_retry, L_on_abort;
15331533 int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG (owner);
15341534
1535- // Without cast to int32_t a movptr will destroy r10 which is typically obj
1535+ // Without cast to int32_t this style of movptr will destroy r10 which is typically obj.
15361536 movptr (Address (boxReg, 0 ), (int32_t )intptr_t (markWord::unused_mark ().value ()));
15371537 movptr (boxReg, tmpReg); // Save ObjectMonitor address
15381538
@@ -1602,11 +1602,11 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
16021602
16031603#endif // INCLUDE_RTM_OPT
16041604
1605- // Fast_Lock and Fast_Unlock used by C2
1605+ // fast_lock and fast_unlock used by C2
16061606
16071607// Because the transitions from emitted code to the runtime
16081608// monitorenter/exit helper stubs are so slow it's critical that
1609- // we inline both the stack-locking fast- path and the inflated fast path.
1609+ // we inline both the stack-locking fast path and the inflated fast path.
16101610//
16111611// See also: cmpFastLock and cmpFastUnlock.
16121612//
@@ -1615,7 +1615,7 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
16151615// option would be to emit TrySlowEnter and TrySlowExit methods
16161616// at startup-time. These methods would accept arguments as
16171617// (rax,=Obj, rbx=Self, rcx=box, rdx=Scratch) and return success-failure
1618- // indications in the icc.ZFlag. Fast_Lock and Fast_Unlock would simply
1618+ // indications in the icc.ZFlag. fast_lock and fast_unlock would simply
16191619// marshal the arguments and emit calls to TrySlowEnter and TrySlowExit.
16201620// In practice, however, the # of lock sites is bounded and is usually small.
16211621// Besides the call overhead, TrySlowEnter and TrySlowExit might suffer
@@ -1634,8 +1634,8 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
16341634//
16351635// TODO:
16361636//
1637- // * Arrange for C2 to pass "Self" into Fast_Lock and Fast_Unlock in one of the registers (scr).
1638- // This avoids manifesting the Self pointer in the Fast_Lock and Fast_Unlock terminals.
1637+ // * Arrange for C2 to pass "Self" into fast_lock and fast_unlock in one of the registers (scr).
1638+ // This avoids manifesting the Self pointer in the fast_lock and fast_unlock terminals.
16391639// Given TLAB allocation, Self is usually manifested in a register, so passing it into
16401640// the lock operators would typically be faster than reifying Self.
16411641//
@@ -1661,14 +1661,14 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
16611661// * use jccb and jmpb instead of jcc and jmp to improve code density.
16621662// But beware of excessive branch density on AMD Opterons.
16631663//
1664- // * Both Fast_Lock and Fast_Unlock set the ICC.ZF to indicate success
1665- // or failure of the fast- path. If the fast- path fails then we pass
1666- // control to the slow- path, typically in C. In Fast_Lock and
1667- // Fast_Unlock we often branch to DONE_LABEL, just to find that C2
1664+ // * Both fast_lock and fast_unlock set the ICC.ZF to indicate success
1665+ // or failure of the fast path. If the fast path fails then we pass
1666+ // control to the slow path, typically in C. In fast_lock and
1667+ // fast_unlock we often branch to DONE_LABEL, just to find that C2
16681668// will emit a conditional branch immediately after the node.
16691669// So we have branches to branches and lots of ICC.ZF games.
16701670// Instead, it might be better to have C2 pass a "FailureLabel"
1671- // into Fast_Lock and Fast_Unlock . In the case of success, control
1671+ // into fast_lock and fast_unlock . In the case of success, control
16721672// will drop through the node. ICC.ZF is undefined at exit.
16731673// In the case of failure, the node will branch directly to the
16741674// FailureLabel
@@ -1813,22 +1813,21 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
18131813 movptr (Address (boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (owner)), scrReg);
18141814 xorptr (boxReg, boxReg); // set icc.ZFlag = 1 to indicate success
18151815
1816- // If the CAS fails we can either retry or pass control to the slow- path.
1816+ // If the CAS fails we can either retry or pass control to the slow path.
18171817 // We use the latter tactic.
18181818 // Pass the CAS result in the icc.ZFlag into DONE_LABEL
18191819 // If the CAS was successful ...
18201820 // Self has acquired the lock
18211821 // Invariant: m->_recursions should already be 0, so we don't need to explicitly set it.
18221822 // Intentional fall-through into DONE_LABEL ...
18231823#else // _LP64
1824- // It's inflated
1824+ // It's inflated and we use scrReg for ObjectMonitor* in this section.
18251825 movq (scrReg, tmpReg);
18261826 xorq (tmpReg, tmpReg);
1827-
18281827 lock ();
18291828 cmpxchgptr (r15_thread, Address (scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (owner)));
18301829 // Unconditionally set box->_displaced_header = markWord::unused_mark().
1831- // Without cast to int32_t movptr will destroy r10 which is typically obj.
1830+ // Without cast to int32_t this style of movptr will destroy r10 which is typically obj.
18321831 movptr (Address (boxReg, 0 ), (int32_t )intptr_t (markWord::unused_mark ().value ()));
18331832 // Intentional fall-through into DONE_LABEL ...
18341833 // Propagate ICC.ZF from CAS above into DONE_LABEL.
@@ -1844,9 +1843,9 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
18441843 bind (DONE_LABEL );
18451844
18461845 // At DONE_LABEL the icc ZFlag is set as follows ...
1847- // Fast_Unlock uses the same protocol.
1846+ // fast_unlock uses the same protocol.
18481847 // ZFlag == 1 -> Success
1849- // ZFlag == 0 -> Failure - force control through the slow- path
1848+ // ZFlag == 0 -> Failure - force control through the slow path
18501849}
18511850
18521851// obj: object to unlock
@@ -1855,7 +1854,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
18551854//
18561855// Some commentary on balanced locking:
18571856//
1858- // Fast_Lock and Fast_Unlock are emitted only for provably balanced lock sites.
1857+ // fast_lock and fast_unlock are emitted only for provably balanced lock sites.
18591858// Methods that don't have provably balanced locking are forced to run in the
18601859// interpreter - such methods won't be compiled to use fast_lock and fast_unlock.
18611860// The interpreter provides two properties:
@@ -1876,7 +1875,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
18761875// should not be unlocked by "normal" java-level locking and vice-versa. The specification
18771876// doesn't specify what will occur if a program engages in such mixed-mode locking, however.
18781877// Arguably given that the spec legislates the JNI case as undefined our implementation
1879- // could reasonably *avoid* checking owner in Fast_Unlock ().
1878+ // could reasonably *avoid* checking owner in fast_unlock ().
18801879// In the interest of performance we elide m->Owner==Self check in unlock.
18811880// A perfectly viable alternative is to elide the owner check except when
18821881// Xcheck:jni is enabled.
@@ -1941,7 +1940,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
19411940 // a costly MEMBAR or CAS. See synchronizer.cpp for details on how
19421941 // we detect and recover from the race that the 1-0 exit admits.
19431942 //
1944- // Conceptually Fast_Unlock () must execute a STST|LDST "release" barrier
1943+ // Conceptually fast_unlock () must execute a STST|LDST "release" barrier
19451944 // before it STs null into _owner, releasing the lock. Updates
19461945 // to data protected by the critical section must be visible before
19471946 // we drop the lock (and thus before any other thread could acquire
@@ -1990,6 +1989,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
19901989 movptr (boxReg, Address (tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (cxq)));
19911990 orptr (boxReg, Address (tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (EntryList)));
19921991 jccb (Assembler::notZero, CheckSucc);
1992+ // Without cast to int32_t this style of movptr will destroy r10 which is typically obj.
19931993 movptr (Address (tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (owner)), (int32_t )NULL_WORD );
19941994 jmpb (DONE_LABEL );
19951995
@@ -1998,13 +1998,14 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
19981998 bind (CheckSucc);
19991999
20002000 // The following optional optimization can be elided if necessary
2001- // Effectively: if (succ == null) goto SlowPath
2001+ // Effectively: if (succ == null) goto slow path
20022002 // The code reduces the window for a race, however,
20032003 // and thus benefits performance.
20042004 cmpptr (Address (tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (succ)), (int32_t )NULL_WORD );
20052005 jccb (Assembler::zero, LGoSlowPath);
20062006
20072007 xorptr (boxReg, boxReg);
2008+ // Without cast to int32_t this style of movptr will destroy r10 which is typically obj.
20082009 movptr (Address (tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG (owner)), (int32_t )NULL_WORD );
20092010
20102011 // Memory barrier/fence
@@ -2039,7 +2040,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
20392040 // If that didn't work, then another thread grabbed the
20402041 // lock so we're done (and exit was a success).
20412042 jccb (Assembler::notEqual, LSuccess);
2042- // Intentional fall-through into slow- path
2043+ // Intentional fall-through into slow path
20432044
20442045 bind (LGoSlowPath);
20452046 orl (boxReg, 1 ); // set ICC.ZF=0 to indicate failure
0 commit comments