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

Optimize @Stable field for Method.isCallerSensitive

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 19, 20
    • core-libs
    • None

      JDK-8271820 introduced the `@Stable private Boolean callerSensitive;` cache in `Method`. That field is essentially a tri-state `Boolean` that relies on its `null` value to serve as "not initialized" value for `@Stable`.

      This works well when the holder `Method` instance is constant: JIT compilers fold `@Stable` well. But if such folding fails, we always dereference the full-blown reference to "boxed" `Boolean` from the field on every access. We can instead do a more lean tri-state primitive field to improve that non-optimized case without sacrificing optimized case.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: