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

[leyden] Revert back to SoftReference for Class::reflectionData

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • repo-leyden
    • repo-leyden
    • hotspot

      Class::reflectionData was changed from a SoftReference to a direct reference in the leyden/premain branch, as the AOT cache didn't support Reference objects at the time

      https://github.com/openjdk/leyden/blame/432069bf72af6c26a922a0fe9a6b20b06c7c0599/src/java.base/share/classes/java/lang/Class.java#L2848

      - private transient volatile SoftReference<ReflectionData<T>> reflectionData;
      + private transient volatile ReflectionData<T> reflectionData;

      Since JDK-8341587, we can store Reference objects into the AOT cache. Therefore, we should revert the above change.

      Because the reflectionData object is stored in a SoftReference, there's a chance that it may be garbage collected in the assembly phase. To guard against this, after each call to AOTConstantPoolResolver::generate_reflection_data(), we should add the generated reflectionData into a global root to make sire it's not collected.

            Unassigned Unassigned
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: