RFR: 8372045: AOT assembly phase asserts with old class if AOT class linking is disabled

Ioi Lam iklam at openjdk.org
Tue Nov 18 05:10:42 UTC 2025


Old classes should be stored in the AOT cache only if `CDSConfig::is_preserving_verification_constraints() == true`. However, we miss this check in the AOT assembly phase: the `this` class is loaded from the AOT configuration file, which is a special type of AOT cache, so `AOTMetaspace::in_aot_cache(this)` returns true:


bool InstanceKlass::can_be_verified_at_dumptime() const {
  if (AOTMetaspace::in_aot_cache(this)) {
    // This is a class that was dumped into the base archive, so we know
    // it was verified at dump time.
    return true;
  }


The fix is

 ```
bool InstanceKlass::can_be_verified_at_dumptime() const {
  if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(this)) {


as this check is intended to be used only when dumping the dynamic archive.

This bug was found when running a complex application (specJBB) but I created a simple reproducer (OldClassSupport2.java).

-------------

Commit messages:
 - 8372045: AOT assembly phase asserts with old class if AOT class linking is disabled

Changes: https://git.openjdk.org/jdk/pull/28365/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28365&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372045
  Stats: 105 lines in 2 files changed: 104 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/28365.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28365/head:pull/28365

PR: https://git.openjdk.org/jdk/pull/28365


More information about the hotspot-dev mailing list