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

Add Unsafe.objectFieldOffset(Class, String)

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 10
    • 10
    • core-libs
    • b21

    Description

      Core libraries have a number of usages of Unsafe.objectFieldOffset(Field) happen during startup, which means we spend some time loading ReflectionData for these classes.

      I've explored adding a Unsafe.objectFieldOffset(Class, String) instead, and can validate that this approach has small, but measurable benefits to startup and total allocations:

      http://cr.openjdk.java.net/~redestad/scratch/unsafe.offset.jdk
      http://cr.openjdk.java.net/~redestad/scratch/unsafe.offset.hotspot

      - Drops 9 classes from loading altogether on minimal startup tests
      - Drops total instructions spent during startup by around 1.5-2.5M (0.5-1.5ms), scaling depending on how many of the changed classes are loaded (the speedup from not loading 9 classes is only a small part of this).

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: