Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8062851

cleanup ObjectMonitor offset adjustments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None
    • b42
    • x86, sparc
    • generic

        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)

              dcubed Daniel Daugherty
              dcubed Daniel Daugherty
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: