RFR: 8317269: Store old classes in linked state in AOT cache [v8]
Ioi Lam
iklam at openjdk.org
Fri Sep 5 04:15:38 UTC 2025
> During the assembly phase of the AOT cache, we link and verify all classes that were loaded during the training run. When verifying a class like this:
>
>
> class X {
> A getA() { return new B(); } // Verifier requires B to be a subtype of A.
> }
>
>
> We remember `A` and `B` as the "verification dependencies" of `X`. A class will be excluded from the AOT cache if any of its verification dependencies are excluded. For example, `X` will be excluded if
>
> - `A` fails verification
> - `B` is a signed class, which is always excluded from the AOT cache
>
> Conversely, if both `A` and `B` are included in the AOT cache, in the production run, they will be unconditionally loaded during VM bootstrap. Therefore, we can guarantee that the verification result computed for `X` will remain valid during the production run.
>
> Notes for reviewers:
>
> - The checks for verification dependencies are done inside `SystemDictionaryShared::check_exclusion_for_self_and_dependencies()`. These checks are done for both old and new classes. Since the dependencies can form a cyclic graph, the checks cannot be implemented with a simple recursion. See "Algorithm notes" in this function for details.
> - The verification dependencies for "new" classes are already stored in `DumpTimeClassInfo::_verifier_constraints`.
> - This PR adds code to record the verification dependencies for "old" classes into `DumpTimeClassInfo::_old_verifier_dependencies`, by intercepting `JVM_FindClassFromCaller()`.
> - This new functionality (store old classes in linked state) is available only when using the AOT cache. For simplicity, this functionality is not available with the old CDS workflows. See comments in `CDSConfig::is_preserving_verification_dependencies()`.
Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
- Simplified SystemDictionaryShared::add_old_verification_constraint; added more test cases
- Fixed copyright
- Simplified code -- (1) store old verification constraints in the same array as for the new verifier; (2) renamed "verification dependencies" -> "verification constraints"; (3) avoid using "cds" in new method names
- Merge branch 'master' into 8317269-store-old-classes-in-linked-state-in-aot-cache
- Added assert that SystemDictionaryShared::should_be_excluded() can only be called within CDS safepoint
- updated comments
- Merge branch 'master' into 8317269-store-old-classes-in-linked-state-in-aot-cache
- @matias9927 comments: fixed typos
- clean up; removed unrelated change
- Cleaned up iterate_verification_dependency_names so a return value of false from <func> means early termination (similar to HashTable::iterate())
- ... and 5 more: https://git.openjdk.org/jdk/compare/945aaf89...526a0925
-------------
Changes: https://git.openjdk.org/jdk/pull/26754/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26754&range=07
Stats: 1404 lines in 35 files changed: 1310 ins; 22 del; 72 mod
Patch: https://git.openjdk.org/jdk/pull/26754.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26754/head:pull/26754
PR: https://git.openjdk.org/jdk/pull/26754
More information about the hotspot-dev
mailing list