On Mon, 21 Jul 2025 07:16:30 GMT, Jiangli Zhou <jian...@openjdk.org> wrote:
> heapShared.cpp contains a list of hard coded classes & fields for archiving > the initialized states in CDS archive. With the support for using annotation > for pre-init being added to the mainline, the support can be applied to those > classes as well. I have looked into that; there is some difficulty, in particular, there are a lot of special handling for LMF classes, such as setting the protection domain, which distinguishes them from the LF/String concat classes. Since this is not as pure a migration, I am planning to do as a separate task; most likely, the string concat classes would be taken as the general hidden class template (which works for hidden classes like pattern matching, not sure about MethodHandleProxies, which also have publicly accessible instances like LMF) > There could be cases where AOTC is not enabled but CDS or heap archiving with > pre-initialization is enabled, it's good to consider more general naming for > the annotations rather than using AOT-only-context based annotations, like > `AOTSafeClassInitializer` and `AOTRuntimeSetup`. Now we are using the term AOT not only to describe code compilation (like JIT), but for general preprocessing, like jlink. So the term AOT is suitable. > As discussed during Leyden/premain meetings, there are classes/fields that > are not suitable for pre-init and caching, such as Thread, Random, System, > etc. We want to annotate or mark them so AOTC or CDS archiving ensures those > states are not cached. Also considered for a future patch. This relates to your safeguard proposal; we might add the safeguard implementation together with the warning annotation. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25922#issuecomment-3098961108