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

Improve oopDesc::forward_to_atomic

    Details

    • Subcomponent:
      gc
    • Resolved In Build:
      b17

      Description

      There is opportunity in oopDesc::forward_to_atomic for micro-optimization:

      - the mark is reloaded in the method although all collectors could pass in their current copy (the mark is a volatile member, so it can't be optimized away)
      - it checks whether the mark is already set (i.e. already forwarded) before doing the CAS, and after doing the CAS.
      The former is waste of time because forwarding undo-statistics show that the number of failures (i.e. an object has already been forwarded) is extremely rare.
      - the check after the CAS whether the mark is set is superfluous, because after the CAS, independent of whether it was successful or not, we know that the mark must have been forwarded.

      Interestingly the variant used by parallel gc already looks almost exactly as suggested here.

        Attachments

          Activity

            People

            • Assignee:
              tschatzl Thomas Schatzl
              Reporter:
              tschatzl Thomas Schatzl
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: