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

Unsafe::allocateInstance does redundant transitions

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 15
    • None
    • hotspot
    • b23

      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.

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

              Created:
              Updated:
              Resolved: