From 157e5ad4a3abc7aea9ec2ec3d2381e42101990b8 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Sun, 2 Mar 2025 03:43:46 +0000 Subject: [PATCH] 8350916: Remove misleading warning "Cannot dump shared archive while using shared archive" Reviewed-by: ccheung --- src/hotspot/share/cds/cdsConfig.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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; }