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

Make Method/Constructor/Field accessors @Stable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • None
    • core-libs
    • None

      Method::methodAccessor and Constructor::constructorAccessor fields are volatile since they are initialized lazily with a reference to appropriate accessor object in order to ensure that the accessor object is safely published to concurrent threads. If we replace volatile modifier with @Stable annotation on those fields, accessor objects are published to other threads via data race. In order for other threads to see the accessor objects fully initialized, their classes have to be modified to allow safe publication via data race. Mostly this can be performed by adding final modifier to their fields.
      With such change, benchmarks show improvements in speed of accessing fields and calling methods/constructors via reflection.

            plevart Peter Levart
            plevart Peter Levart
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: