8387743: [aot] AOT tests fail intermittently with "incompatible CompressedOops::base()"

Reviewed-by: kvn, iklam
This commit is contained in:
Ashutosh Mehra 2026-07-24 18:09:00 +00:00
parent e6f5c5dc42
commit bb2cdfe569
3 changed files with 81 additions and 58 deletions

View File

@ -125,7 +125,10 @@ public class AOTCodeCompressedOopsTest {
switch (runMode) {
case RunMode.ASSEMBLY: {
List<String> args = getVMArgsForHeapConfig(zeroBaseInAsmPhase, zeroShiftInAsmPhase);
// By default CDSAppTester adds -XX:+AOTCompatibleOopCompression option,
// which defeats the purpose of this test. So disable this option.
args.addAll(List.of("-XX:+UnlockDiagnosticVMOptions",
"-XX:-AOTCompatibleOopCompression",
"-Xlog:aot=info",
"-Xlog:aot+codecache+init=debug",
"-Xlog:aot+codecache+exit=debug"));

View File

@ -72,6 +72,8 @@ public class AOTFlags {
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+AOTCompatibleOopCompression", // avoid production run failure due to incompatible CompressedOops::base
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
out.shouldContain("AOTCache creation is complete");
@ -142,6 +144,8 @@ public class AOTFlags {
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+AOTCompatibleOopCompression", // avoid production run failure due to incompatible CompressedOops::base
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
out.shouldContain("AOTCache creation is complete");

View File

@ -228,9 +228,18 @@ abstract public class CDSAppTester {
return output;
}
private String[] addCommonVMArgs(RunMode runMode, String[] cmdLine) {
// This method should be called before `vmArgs()`, so that subclasses of CDSAppTester
// can have a chance to override the flags set here.
private String[] addCommonVMArgs(RunMode runMode) {
String[] cmdLine = new String[0];
cmdLine = addClassOrModulePath(runMode, cmdLine);
cmdLine = addWhiteBox(cmdLine);
// In one-step workflow ASSEMBLY phase is not executed separately.
// Therefore AOTCompatibleOopCompression needs to be passed to the TRAINING phase,
// so that it can be propagated to the ASSEMBLY phase.
if (runMode == RunMode.TRAINING || runMode == RunMode.ASSEMBLY) {
cmdLine = StringArrayUtils.concat(cmdLine, "-XX:+UnlockDiagnosticVMOptions", "-XX:+AOTCompatibleOopCompression");
}
return cmdLine;
}
@ -261,30 +270,32 @@ abstract public class CDSAppTester {
private OutputAnalyzer recordAOTConfiguration() throws Exception {
RunMode runMode = RunMode.TRAINING;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
"-XX:AOTMode=record",
"-XX:AOTConfiguration=" + aotConfigurationFile,
logToFile(aotConfigurationFileLog,
"class+load=debug",
"aot=debug",
"cds=debug",
"aot+class=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-XX:AOTMode=record",
"-XX:AOTConfiguration=" + aotConfigurationFile,
logToFile(aotConfigurationFileLog,
"class+load=debug",
"aot=debug",
"cds=debug",
"aot+class=debug"));
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
return executeAndCheck(cmdLine, runMode, aotConfigurationFile, aotConfigurationFileLog);
}
private OutputAnalyzer createAOTCacheOneStep() throws Exception {
RunMode runMode = RunMode.TRAINING;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
"-XX:AOTMode=record",
"-XX:AOTCacheOutput=" + aotCacheFile,
logToFile(aotCacheFileLog,
"class+load=debug",
"aot=debug",
"aot+class=debug",
"cds=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-XX:AOTMode=record",
"-XX:AOTCacheOutput=" + aotCacheFile,
logToFile(aotCacheFileLog,
"class+load=debug",
"aot=debug",
"aot+class=debug",
"cds=debug"));
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
OutputAnalyzer out = executeAndCheck(cmdLine, runMode, aotCacheFile, aotCacheFileLog);
listOutputFile(aotCacheFileLog + ".0"); // the log file for the training run
@ -293,52 +304,55 @@ abstract public class CDSAppTester {
private OutputAnalyzer createClassList() throws Exception {
RunMode runMode = RunMode.TRAINING;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
"-Xshare:off",
"-XX:DumpLoadedClassList=" + classListFile,
logToFile(classListFileLog,
"class+load=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-Xshare:off",
"-XX:DumpLoadedClassList=" + classListFile,
logToFile(classListFileLog,
"class+load=debug"));
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
return executeAndCheck(cmdLine, runMode, classListFile, classListFileLog);
}
private OutputAnalyzer dumpStaticArchive() throws Exception {
RunMode runMode = RunMode.DUMP_STATIC;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
"-Xlog:aot",
"-Xlog:aot+heap=error",
"-Xlog:cds",
"-Xshare:dump",
"-XX:SharedArchiveFile=" + staticArchiveFile,
"-XX:SharedClassListFile=" + classListFile,
logToFile(staticArchiveFileLog,
"aot=debug",
"cds=debug",
"cds+class=debug",
"aot+heap=warning",
"aot+resolve=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-Xlog:aot",
"-Xlog:aot+heap=error",
"-Xlog:cds",
"-Xshare:dump",
"-XX:SharedArchiveFile=" + staticArchiveFile,
"-XX:SharedClassListFile=" + classListFile,
logToFile(staticArchiveFileLog,
"aot=debug",
"cds=debug",
"cds+class=debug",
"aot+heap=warning",
"aot+resolve=debug"));
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
return executeAndCheck(cmdLine, runMode, staticArchiveFile, staticArchiveFileLog);
}
private OutputAnalyzer createAOTCache() throws Exception {
RunMode runMode = RunMode.ASSEMBLY;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
"-Xlog:aot",
"-Xlog:aot+heap=error",
"-Xlog:cds",
"-XX:AOTMode=create",
"-XX:AOTConfiguration=" + aotConfigurationFile,
"-XX:AOTCache=" + aotCacheFile,
logToFile(aotCacheFileLog,
"cds=debug",
"aot=debug",
"aot+class=debug",
"aot+heap=warning",
"aot+resolve=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-Xlog:aot",
"-Xlog:aot+heap=error",
"-Xlog:cds",
"-XX:AOTMode=create",
"-XX:AOTConfiguration=" + aotConfigurationFile,
"-XX:AOTCache=" + aotCacheFile,
logToFile(aotCacheFileLog,
"cds=debug",
"aot=debug",
"aot+class=debug",
"aot+heap=warning",
"aot+resolve=debug"));
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
return executeAndCheck(cmdLine, runMode, aotCacheFile, aotCacheFileLog);
}
@ -387,7 +401,9 @@ abstract public class CDSAppTester {
String baseArchive = getBaseArchiveForDynamicArchive();
if (isDynamicWorkflow()) {
// "classic" dynamic archive
cmdLine = StringArrayUtils.concat(vmArgs(runMode),
cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
"-Xlog:aot",
"-Xlog:cds",
"-XX:ArchiveClassesAtExit=" + dynamicArchiveFile,
@ -397,7 +413,6 @@ abstract public class CDSAppTester {
"cds+class=debug",
"aot+resolve=debug",
"class+load=debug"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
}
if (baseArchive != null) {
cmdLine = StringArrayUtils.concat(cmdLine, "-XX:SharedArchiveFile=" + baseArchive);
@ -418,9 +433,10 @@ abstract public class CDSAppTester {
// using different args to the VM and application.
public OutputAnalyzer productionRun(String[] extraVmArgs, String[] extraAppArgs) throws Exception {
RunMode runMode = RunMode.PRODUCTION;
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
logToFile(productionRunLog(), "aot", "cds"));
cmdLine = addCommonVMArgs(runMode, cmdLine);
String[] cmdLine = addCommonVMArgs(runMode);
cmdLine = StringArrayUtils.concat(cmdLine, vmArgs(runMode));
cmdLine = StringArrayUtils.concat(cmdLine,
logToFile(productionRunLog(), "aot", "cds"));
if (isStaticWorkflow()) {
cmdLine = StringArrayUtils.concat(cmdLine, "-Xshare:on", "-XX:SharedArchiveFile=" + staticArchiveFile);