RFR (XL) 8031320: Use Intel RTM instructions for locks

Roland Westrelin roland.westrelin at oracle.com
Tue Mar 18 12:20:40 UTC 2014


Hi Vladimir,

> http://cr.openjdk.java.net/~kvn/8031320_9/webrev/

Typos:

src/share/vm/ci/ciMethodData.hpp

483   // return chached value

src/share/vm/opto/macro.cpp

2510         assert(C->profile_rtm(), "only when rtm deop code is added”);


src/cpu/x86/vm/macroAssembler_x86.cpp

1440   movptr(tmpReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;

Why -2?

In MacroAssembler::fast_lock(), Moving code starting at:
1608     if (UseRTMForStackLocks && use_rtm) {
and
1715     if (use_rtm) {

to their own methods would be nice.

1787       // Use either "Self" (in threadReg) or rsp as thread identity in _owner.

Is this comment accurate? I don’t see rsp being used.

I don’t understand that part:

1786       // Appears unlocked - try to swing _owner from null to non-null.
1787       // Use either "Self" (in threadReg) or rsp as thread identity in _owner.
1788       // Invariant: tmpReg == 0.  tmpReg is EAX which is the implicit cmpxchg comparand.
1789 #ifdef _LP64
1790       Register threadReg = r15_thread;
1791 #else
1792       get_thread(scrReg);
1793       Register threadReg = scrReg;
1794 #endif
1795       if (os::is_MP()) {
1796         lock();
1797       }
1798       cmpxchgptr(threadReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)); // Updates tmpReg

src/cpu/x86/vm/sharedRuntime_x86_32.cpp
src/cpu/x86/vm/sharedRuntime_x86_64.cpp

Comments why you need xabort would be helpful

src/cpu/x86/vm/vm_version_x86.cpp

Why are the changes to UseBiasedLocking done here:
964 bool VM_Version::use_biased_locking() {

rather than when the other options are validated, that is code that starts with:

575   // Adjust RTM (Restricted Transactional Memory) flags

src/share/vm/opto/compile.cpp

1082     if (method_has_option("NoRTMLockEliding") || ((rtm_state & NoRTM) != 0)) {

Why do we need to check the compiler oracle? Doesn't the MDO initialization already take the compiler oracle into account?

Roland.




More information about the hotspot-dev mailing list