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

cleanup ObjectMonitor offset adjustments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b42
    • CPU:
      x86, sparc
    • OS:
      generic

      Backports

        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)

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: