-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8368199: Add @AOTSafeClassInitializer to jdk.internal.access.SharedSecrets #27880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a886aa8
c6ea93c
6ae1172
3121fd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |||||||||
|
|
||||||||||
| package jdk.internal.access; | ||||||||||
|
|
||||||||||
| import jdk.internal.vm.annotation.AOTSafeClassInitializer; | ||||||||||
| import jdk.internal.vm.annotation.Stable; | ||||||||||
|
|
||||||||||
| import javax.crypto.SealedObject; | ||||||||||
|
|
@@ -60,6 +61,9 @@ interface and provides the ability to call package-private methods | |||||||||
| * </strong> | ||||||||||
| */ | ||||||||||
|
|
||||||||||
| // Static fields in this class are stateless, so the values initialized in the | ||||||||||
| // AOT assembly phase can be safely cached. | ||||||||||
|
||||||||||
| @AOTSafeClassInitializer | ||||||||||
| public class SharedSecrets { | ||||||||||
| // This field is not necessarily stable | ||||||||||
| private static JavaAWTFontAccess javaAWTFontAccess; | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does aot initialization work with this field? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this field is safe. There are two places that could set it, but they will always set it to an instance of jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Lines 148 to 149 in eff6439
jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Lines 251 to 252 in eff6439
|
||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be true for the time being, but adding such an assumption is a constraint for the future and should be documented. Perhaps we should have an interface
Accessthat the various access classes implement, and where we could document this and other constraints of the access classes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this hard-coded check and instead added
CDSHeapVerifier::add_shared_secret_accessors(), which requires all AOT-initialized accessors to be stateless.I also added a negative test case for
SharedSecrets::javaObjectInputFilterAccess, which is not stateless so it cannot be initialized in the AOT assembly phase.