JDK-8062851 : cleanup ObjectMonitor offset adjustments
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86,sparc
  • Submitted: 2014-11-04
  • Updated: 2015-06-03
  • Resolved: 2014-11-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b42Fixed
Related Reports
Relates :  
Relates :  
Description
During the code review for JDK-8061553, it was pointed out that
I was cleaning up some white space issues, e.g., 

diff -r a3acb8e53230 src/cpu/sparc/vm/macroAssembler_sparc.cpp
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -2864,7 +2864,7 @@ void MacroAssembler::compiler_lock_objec
 
       // Try to CAS m->owner from null to Self
       // Invariant: if we acquire the lock then _recursions should be 0.
-      add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+      add(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rmark);
       mov(G2_thread, Rscratch);

when, in reality, we needed a much better cleanup that is mentioned here:

src/cpu/x86/vm/macroAssembler_x86.cpp

    // TODO-FIXME: eliminate the ugly use of manifest constants:
    //   Use markOopDesc::monitor_value instead of "2".
    //   use markOop::unused_mark() instead of "3".
    // The tmpReg value is an objectMonitor reference ORed with
    // markOopDesc::monitor_value (2).   We can either convert tmpReg to an
    // objectmonitor pointer by masking off the "2" bit or we can just
    // use tmpReg as an objectmonitor pointer but bias the objectmonitor
    // field offsets with "-2" to compensate for and annul the low-order tag bit.
    //
    // I use the latter as it avoids AGI stalls.
    // As such, we write "mov r, [tmpReg+OFFSETOF(Owner)-2]"
    // instead of "mov r, [tmpReg+OFFSETOF(Owner)]".
    //
    #define OFFSET_SKEWED(f) ((ObjectMonitor::f ## _offset_in_bytes())-2)