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

Unsafe::allocateInstance does redundant transitions

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 15
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b23

      Description

      While Unsafe::allocateInstance is intrinsified by C2, it's somewhat costly when used from interpreter and C1 compiled code - ~100ns/op overhead compared to the C2 intrinsic for trivial calls.

      This was made apparent when looking into some regressions in startup of capturing lambdas that coming in from the hidden classes JEP, see: https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-May/066270.html

      Investigating it seems the call chain in unsafe.cpp could be simplified. This gets the cost in the capturing lambda microbenchmark down from ~105ns/op to ~65ns/op for C1 code (same 40ns/op gain for interpreter calls). Likely helps other places during startup too, so seems worth doing.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              redestad Claes Redestad
              Reporter:
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: