diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp index a5c5742eaf2..ff11b807910 100644 --- a/src/hotspot/share/cds/cdsConfig.cpp +++ b/src/hotspot/share/cds/cdsConfig.cpp @@ -68,9 +68,16 @@ int CDSConfig::get_status() { void CDSConfig::initialize() { if (is_dumping_static_archive() && !is_dumping_final_static_archive()) { - if (RequireSharedSpaces) { - warning("Cannot dump shared archive while using shared archive"); - } + // Note: -Xshare and -XX:AOTMode flags are mutually exclusive. + // - Classic workflow: -Xshare:on and -Xshare:dump cannot take effect at the same time. + // - JEP 483 workflow: -XX:AOTMode:record and -XX:AOTMode=on cannot take effect at the same time. + // So we can never come to here with RequireSharedSpaces==true. + assert(!RequireSharedSpaces, "sanity"); + + // If dumping the classic archive, or making an AOT training run (dumping a preimage archive), + // for sanity, parse all classes from classfiles. + // TODO: in the future, if we want to support re-training on top of an existing AOT cache, this + // needs to be changed. UseSharedSpaces = false; }