< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Print this page
rev 55494 : imported patch dcubed.monitor_deflate_conc.v2.05


1822   movptr(Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), scrReg);
1823   xorptr(boxReg, boxReg);                 // set icc.ZFlag = 1 to indicate success
1824 
1825   // If the CAS fails we can either retry or pass control to the slow-path.
1826   // We use the latter tactic.
1827   // Pass the CAS result in the icc.ZFlag into DONE_LABEL
1828   // If the CAS was successful ...
1829   //   Self has acquired the lock
1830   //   Invariant: m->_recursions should already be 0, so we don't need to explicitly set it.
1831   // Intentional fall-through into DONE_LABEL ...
1832 #else // _LP64
1833   // It's inflated
1834   movq(scrReg, tmpReg);
1835   xorq(tmpReg, tmpReg);
1836 
1837   lock();
1838   cmpxchgptr(r15_thread, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
1839   // Unconditionally set box->_displaced_header = markOopDesc::unused_mark().
1840   // Without cast to int32_t movptr will destroy r10 which is typically obj.
1841   movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));




















1842   // Intentional fall-through into DONE_LABEL ...
1843   // Propagate ICC.ZF from CAS above into DONE_LABEL.
1844 #endif // _LP64
1845 #if INCLUDE_RTM_OPT
1846   } // use_rtm()
1847 #endif
1848   // DONE_LABEL is a hot target - we'd really like to place it at the
1849   // start of cache line by padding with NOPs.
1850   // See the AMD and Intel software optimization manuals for the
1851   // most efficient "long" NOP encodings.
1852   // Unfortunately none of our alignment mechanisms suffice.
1853   bind(DONE_LABEL);
1854 
1855   // At DONE_LABEL the icc ZFlag is set as follows ...
1856   // Fast_Unlock uses the same protocol.
1857   // ZFlag == 1 -> Success
1858   // ZFlag == 0 -> Failure - force control through the slow-path
1859 }
1860 
1861 // obj: object to unlock
1862 // box: box address (displaced header location), killed.  Must be EAX.
1863 // tmp: killed, cannot be obj nor box.




1822   movptr(Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), scrReg);
1823   xorptr(boxReg, boxReg);                 // set icc.ZFlag = 1 to indicate success
1824 
1825   // If the CAS fails we can either retry or pass control to the slow-path.
1826   // We use the latter tactic.
1827   // Pass the CAS result in the icc.ZFlag into DONE_LABEL
1828   // If the CAS was successful ...
1829   //   Self has acquired the lock
1830   //   Invariant: m->_recursions should already be 0, so we don't need to explicitly set it.
1831   // Intentional fall-through into DONE_LABEL ...
1832 #else // _LP64
1833   // It's inflated
1834   movq(scrReg, tmpReg);
1835   xorq(tmpReg, tmpReg);
1836 
1837   lock();
1838   cmpxchgptr(r15_thread, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
1839   // Unconditionally set box->_displaced_header = markOopDesc::unused_mark().
1840   // Without cast to int32_t movptr will destroy r10 which is typically obj.
1841   movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
1842   // The following code to verify that the object field still refers
1843   // to the object we are trying to lock is not needed with safepoint
1844   // based deflation. It is also not needed with async deflation when
1845   // the DEFLATER_MARKER is allowed to linger in the owner field in an
1846   // async deflated ObjectMonitor until replaced by the next owner value.
1847   // We keep this code as a sanity check against bugs in other parts
1848   // of the async deflation mechanism.
1849   //
1850   // If we weren't able to swing _owner from NULL to r15_thread
1851   // then take the slow path.
1852   jccb(Assembler::notZero, DONE_LABEL);
1853   // r15_thread is now the owner so verify that the ObjectMonitor
1854   // still refers to the same object.
1855   cmpptr(objReg, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(object)));
1856   // The ObjectMonitor still refers to the same object so
1857   // r15_thread's ownership is valid.
1858   jccb(Assembler::zero, DONE_LABEL);
1859   // The ObjectMonitor does not refer to the same object so
1860   // drop ownership.
1861   movptr(Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
1862   // Intentional fall-through into DONE_LABEL ...
1863   // Propagate ICC.ZF from cmpptr() above into DONE_LABEL.
1864 #endif // _LP64
1865 #if INCLUDE_RTM_OPT
1866   } // use_rtm()
1867 #endif
1868   // DONE_LABEL is a hot target - we'd really like to place it at the
1869   // start of cache line by padding with NOPs.
1870   // See the AMD and Intel software optimization manuals for the
1871   // most efficient "long" NOP encodings.
1872   // Unfortunately none of our alignment mechanisms suffice.
1873   bind(DONE_LABEL);
1874 
1875   // At DONE_LABEL the icc ZFlag is set as follows ...
1876   // Fast_Unlock uses the same protocol.
1877   // ZFlag == 1 -> Success
1878   // ZFlag == 0 -> Failure - force control through the slow-path
1879 }
1880 
1881 // obj: object to unlock
1882 // box: box address (displaced header location), killed.  Must be EAX.
1883 // tmp: killed, cannot be obj nor box.


< prev index next >