--- old/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2019-11-04 14:58:58.000000000 -0500 +++ new/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2019-11-04 14:58:58.000000000 -0500 @@ -1584,6 +1584,9 @@ Label L_rtm_retry, L_decrement_retry, L_on_abort, L_local_done; int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner); + // Without cast to int32_t this style of movptr will destroy r10 which is typically obj. + movptr(Address(boxReg, 0), (int32_t)intptr_t(markWord::unused_mark().value())); + if (!HandshakeAfterDeflateIdleMonitors) { // Increment the ObjectMonitor's ref_count for safety or force the // enter slow path via DONE_LABEL. @@ -1593,8 +1596,6 @@ inc_om_ref_count(objReg, tmpReg /* om_reg */, scrReg /* tmp_reg */, DONE_LABEL); } - // Without cast to int32_t this style of movptr will destroy r10 which is typically obj. - movptr(Address(boxReg, 0), (int32_t)intptr_t(markWord::unused_mark().value())); movptr(boxReg, tmpReg); // Save ObjectMonitor address if (RTMRetryCount > 0) { @@ -1898,6 +1899,10 @@ // It's inflated and we use scrReg for ObjectMonitor* in this section. movq(scrReg, tmpReg); + // Unconditionally set box->_displaced_header = markWord::unused_mark(). + // Without cast to int32_t this style of movptr will destroy r10 which is typically obj. + movptr(Address(boxReg, 0), (int32_t)intptr_t(markWord::unused_mark().value())); + if (!HandshakeAfterDeflateIdleMonitors) { // Increment the ObjectMonitor's ref_count for safety or force the // enter slow path via DONE_LABEL. @@ -1910,9 +1915,6 @@ xorq(tmpReg, tmpReg); lock(); cmpxchgptr(r15_thread, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner))); - // Unconditionally set box->_displaced_header = markWord::unused_mark(). - // Without cast to int32_t this style of movptr will destroy r10 which is typically obj. - movptr(Address(boxReg, 0), (int32_t)intptr_t(markWord::unused_mark().value())); // Intentional fall-through into DONE_LABEL ... // Propagate ICC.ZF from CAS above into DONE_LABEL.