1737 // at [FETCH], below, will never observe a biased encoding (*101b). 1738 // If this invariant is not held we risk exclusion (safety) failure. 1739 if (UseBiasedLocking && !UseOptoBiasInlining) { 1740 biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters); 1741 } 1742 1743 #if INCLUDE_RTM_OPT 1744 if (UseRTMForStackLocks && use_rtm) { 1745 rtm_stack_locking(objReg, tmpReg, scrReg, cx2Reg, 1746 stack_rtm_counters, method_data, profile_rtm, 1747 DONE_LABEL, IsInflated); 1748 } 1749 #endif // INCLUDE_RTM_OPT 1750 1751 movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // [FETCH] 1752 testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased 1753 jccb(Assembler::notZero, IsInflated); 1754 1755 // Attempt stack-locking ... 1756 orptr (tmpReg, markOopDesc::unlocked_value); 1757 movptr(Address(boxReg, 0), tmpReg); // Anticipate successful CAS 1758 lock(); 1759 cmpxchgptr(boxReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // Updates tmpReg 1760 if (counters != NULL) { 1761 cond_inc32(Assembler::equal, 1762 ExternalAddress((address)counters->fast_path_entry_count_addr())); 1763 } 1764 jcc(Assembler::equal, DONE_LABEL); // Success 1765 1766 // Recursive locking. 1767 // The object is stack-locked: markword contains stack pointer to BasicLock. 1768 // Locked by current thread if difference with current SP is less than one page. 1769 subptr(tmpReg, rsp); 1770 // Next instruction set ZFlag == 1 (Success) if difference is less then one page. 1771 andptr(tmpReg, (int32_t) (NOT_LP64(0xFFFFF003) LP64_ONLY(7 - os::vm_page_size())) ); 1772 movptr(Address(boxReg, 0), tmpReg); 1773 if (counters != NULL) { 1774 cond_inc32(Assembler::equal, 1775 ExternalAddress((address)counters->fast_path_entry_count_addr())); 1776 } | 1737 // at [FETCH], below, will never observe a biased encoding (*101b). 1738 // If this invariant is not held we risk exclusion (safety) failure. 1739 if (UseBiasedLocking && !UseOptoBiasInlining) { 1740 biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters); 1741 } 1742 1743 #if INCLUDE_RTM_OPT 1744 if (UseRTMForStackLocks && use_rtm) { 1745 rtm_stack_locking(objReg, tmpReg, scrReg, cx2Reg, 1746 stack_rtm_counters, method_data, profile_rtm, 1747 DONE_LABEL, IsInflated); 1748 } 1749 #endif // INCLUDE_RTM_OPT 1750 1751 movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // [FETCH] 1752 testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased 1753 jccb(Assembler::notZero, IsInflated); 1754 1755 // Attempt stack-locking ... 1756 orptr (tmpReg, markOopDesc::unlocked_value); 1757 if (EnableValhalla && !UseBiasedLocking) { 1758 // Mask always_locked bit such that we go to the slow path if object is a value type 1759 andptr(tmpReg, ~markOopDesc::biased_lock_bit_in_place); 1760 } 1761 movptr(Address(boxReg, 0), tmpReg); // Anticipate successful CAS 1762 lock(); 1763 cmpxchgptr(boxReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // Updates tmpReg 1764 if (counters != NULL) { 1765 cond_inc32(Assembler::equal, 1766 ExternalAddress((address)counters->fast_path_entry_count_addr())); 1767 } 1768 jcc(Assembler::equal, DONE_LABEL); // Success 1769 1770 // Recursive locking. 1771 // The object is stack-locked: markword contains stack pointer to BasicLock. 1772 // Locked by current thread if difference with current SP is less than one page. 1773 subptr(tmpReg, rsp); 1774 // Next instruction set ZFlag == 1 (Success) if difference is less then one page. 1775 andptr(tmpReg, (int32_t) (NOT_LP64(0xFFFFF003) LP64_ONLY(7 - os::vm_page_size())) ); 1776 movptr(Address(boxReg, 0), tmpReg); 1777 if (counters != NULL) { 1778 cond_inc32(Assembler::equal, 1779 ExternalAddress((address)counters->fast_path_entry_count_addr())); 1780 } |