-
Enhancement
-
Resolution: Unresolved
-
P4
-
repo-leyden
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;
SinceJDK-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.
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
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.
- relates to
-
JDK-8341587 [premain] Support Soft/Weak Reference in AOT cache
-
- Resolved
-