Remove UseCCP from test/hotspot/jtreg/runtime/cds

This commit is contained in:
tstuefe 2025-11-17 14:59:44 +01:00
parent 8084ac2b16
commit 90bc506742
8 changed files with 31 additions and 193 deletions

View File

@ -55,7 +55,6 @@ public class CommandLineFlagCombo {
private static final String[] testTable = {
"-XX:+UseG1GC", "-XX:+UseSerialGC", "-XX:+UseParallelGC",
"-XX:+UseLargePages", // may only take effect on machines with large-pages
"-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
"-XX:+UseCompressedOops",
"-XX:ObjectAlignmentInBytes=16",
"-XX:ObjectAlignmentInBytes=32",
@ -123,7 +122,6 @@ public class CommandLineFlagCombo {
if (Platform.is32bit())
{
if (testEntry.equals("-XX:+UseCompressedOops") ||
testEntry.equals("-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE") ||
testEntry.contains("ObjectAlignmentInBytes") )
{
System.out.println("Test case not applicable on 32-bit platforms");

View File

@ -66,9 +66,9 @@ public class CommandLineFlagComboNegative {
"An error has occurred while processing the shared archive file", 1) );
}
testTable.add( new TestVector("-XX:+UseCompressedOops", "-XX:-UseCompressedOops",
"The saved state of UseCompressedOops and USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE is different from runtime, CDS will be disabled.", 1) );
testTable.add( new TestVector("-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE", "-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
"The saved state of UseCompressedOops and USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE is different from runtime, CDS will be disabled.", 1) );
"The saved state of UseCompressedOops (1) is different from runtime (0), CDS will be disabled.", 1) );
testTable.add( new TestVector("-XX:-UseCompressedOops", "-XX:+UseCompressedOops",
"The saved state of UseCompressedOops (0) is different from runtime (1), CDS will be disabled.", 1) );
}
private void runTests() throws Exception

View File

@ -1,53 +0,0 @@
/*
* Copyright (C) 2022, Tencent. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* bug 8286066
* @summary VM crash caused by unloaded FillerObject_klass
* @library /test/lib
* @requires vm.cds
* @requires vm.flagless
* @run driver FillerObjectLoadTest
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class FillerObjectLoadTest {
public static void main(String... args) throws Exception {
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:+IgnoreUnrecognizedVMOptions", "-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseEpsilonGC", "-Xshare:dump",
"-XX:SharedArchiveFile=" + TestCommon.getNewArchiveName());
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
analyzer.shouldHaveExitValue(0);
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:+IgnoreUnrecognizedVMOptions", "-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
"-XX:TLABSize=2048", "-Xshare:dump",
"-XX:SharedArchiveFile=" + TestCommon.getNewArchiveName());
analyzer = new OutputAnalyzer(pb.start());
analyzer.shouldHaveExitValue(0);
}
}

View File

@ -46,12 +46,10 @@ public class TestCombinedCompressedFlags {
static class ConfArg {
public boolean useCompressedOops; // UseCompressedOops
public boolean useCompressedClassPointers; // USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE
public String msg;
public int code;
public ConfArg(boolean useCompressedOops, boolean useCompressedClassPointers, String msg, int code) {
public ConfArg(boolean useCompressedOops, String msg, int code) {
this.useCompressedOops = useCompressedOops;
this.useCompressedClassPointers = useCompressedClassPointers;
this.msg = msg;
this.code = code;
}
@ -65,67 +63,13 @@ public class TestCombinedCompressedFlags {
initExecArgs();
}
private void initExecArgs() {
/* The combinations have four cases.
* UseCompressedOops USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE Result
* 1.
* dump: on on
* test: on on Pass
* on off Fail
* off on Fail
* off off Fail
* 2.
* dump: on off
* test: on off Pass
* on on Fail
* off on Pass
* off off Fail
* 3.
* dump: off on
* test: off on Pass
* on on Fail
* on off Fail
* 4.
* dump: off off
* test: off off Pass
* on on Fail
* on off Fail
**/
// We fail this test if the UseCompressedClassPointers setting used at dumptime differs from runtime,
// succeed if it is identical
execArgs = new ArrayList<ConfArg>();
if (dumpArg.useCompressedOops && dumpArg.useCompressedClassPointers) {
execArgs
.add(new ConfArg(true, true, HELLO_STRING, PASS));
execArgs
.add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(false, true, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(false, false, EXEC_ABNORMAL_MSG, FAIL));
} else if(dumpArg.useCompressedOops && !dumpArg.useCompressedClassPointers) {
execArgs
.add(new ConfArg(true, false, HELLO_STRING, PASS));
execArgs
.add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(false, true, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(false, false, EXEC_ABNORMAL_MSG, FAIL));
} else if (!dumpArg.useCompressedOops && dumpArg.useCompressedClassPointers) {
execArgs
.add(new ConfArg(false, true, HELLO_STRING, PASS));
execArgs
.add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
} else if (!dumpArg.useCompressedOops && !dumpArg.useCompressedClassPointers) {
execArgs
.add(new ConfArg(false, false, HELLO_STRING, PASS));
execArgs
.add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
execArgs
.add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
}
execArgs
.add(new ConfArg(dumpArg.useCompressedOops, HELLO_STRING, PASS));
execArgs
.add(new ConfArg(!dumpArg.useCompressedOops, EXEC_ABNORMAL_MSG, FAIL));
}
}
@ -134,23 +78,14 @@ public class TestCombinedCompressedFlags {
else return "-XX:-UseCompressedOops";
}
public static String getCompressedClassPointersArg(boolean on) {
if (on) return "-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE";
else return "-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE";
}
public static List<RunArg> runList;
public static void configureRunArgs() {
runList = new ArrayList<RunArg>();
runList
.add(new RunArg(new ConfArg(true, true, null, PASS)));
.add(new RunArg(new ConfArg(true, null, PASS)));
runList
.add(new RunArg(new ConfArg(true, false, null, PASS)));
runList
.add(new RunArg(new ConfArg(false, true, null, PASS)));
runList
.add(new RunArg(new ConfArg(false, false, null, PASS)));
.add(new RunArg(new ConfArg(false, null, PASS)));
}
public static void main(String[] args) throws Exception {
@ -162,7 +97,6 @@ public class TestCombinedCompressedFlags {
.dump(helloJar,
new String[] {"Hello"},
getCompressedOopsArg(t.dumpArg.useCompressedOops),
getCompressedClassPointersArg(t.dumpArg.useCompressedClassPointers),
"-Xlog:cds",
"-XX:NativeMemoryTracking=detail");
out.shouldContain("Dumping shared data to file:");
@ -175,7 +109,6 @@ public class TestCombinedCompressedFlags {
"-Xlog:cds",
"-XX:NativeMemoryTracking=detail",
getCompressedOopsArg(c.useCompressedOops),
getCompressedClassPointersArg(c.useCompressedClassPointers),
"Hello");
out.shouldContain(c.msg);
out.shouldHaveExitValue(c.code);

View File

@ -38,18 +38,20 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
public class TestZGCWithCDS {
public final static String HELLO = "Hello World";
public final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
public final static String ERR_MSG = "The saved state of UseCompressedOops and USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE is different from runtime, CDS will be disabled.";
private final static String HELLO = "Hello World";
private final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
private final static String ERR_MSG = "The saved state of UseCompressedOops (0) is different from runtime (1), CDS will be disabled.";
private final static String COMPACT_OBJECT_HEADERS = "-XX:+UseCompactObjectHeaders";
public static void main(String... args) throws Exception {
String compactHeaders = "-XX:+UseCompactObjectHeaders";
String helloJar = JarBuilder.build("hello", "Hello");
System.out.println("0. Dump with ZGC");
OutputAnalyzer out = TestCommon
.dump(helloJar,
new String[] {"Hello"},
"-XX:+UseZGC",
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds");
out.shouldContain("Dumping shared data to file:");
out.shouldHaveExitValue(0);
@ -58,93 +60,52 @@ public class TestZGCWithCDS {
out = TestCommon
.exec(helloJar,
"-XX:+UseZGC",
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds",
"Hello");
out.shouldContain(HELLO);
out.shouldHaveExitValue(0);
System.out.println("2. Run with +UseCompressedOops +USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
System.out.println("2. Run with +UseCompressedOops");
out = TestCommon
.exec(helloJar,
"-XX:-UseZGC",
"-XX:+UseCompressedOops", // in case turned off by vmoptions
"-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE", // by jtreg
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds",
"Hello");
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);
System.out.println("3. Run with -UseCompressedOops -USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
System.out.println("4. Run with -UseCompressedOops");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:-UseCompressedOops",
"-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
compactHeaders,
"-Xlog:cds",
"Hello");
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);
System.out.println("4. Run with -UseCompressedOops +USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:-UseCompressedOops",
"-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds",
"Hello");
out.shouldContain(HELLO);
out.shouldHaveExitValue(0);
System.out.println("5. Run with +UseCompressedOops -USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
System.out.println("6. Run with +UseCompressedOops");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:+UseCompressedOops",
"-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds",
"Hello");
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);
System.out.println("6. Run with +UseCompressedOops +USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:+UseCompressedOops",
"-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
compactHeaders,
"-Xlog:cds",
"Hello");
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);
System.out.println("7. Dump with -UseCompressedOops -USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE");
out = TestCommon
.dump(helloJar,
new String[] {"Hello"},
"-XX:+UseSerialGC",
"-XX:-UseCompressedOops",
"-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE",
compactHeaders,
"-Xlog:cds");
out.shouldContain("Dumping shared data to file:");
out.shouldHaveExitValue(0);
System.out.println("8. Run with ZGC");
out = TestCommon
.exec(helloJar,
"-XX:+UseZGC",
compactHeaders,
COMPACT_OBJECT_HEADERS,
"-Xlog:cds",
"Hello");
out.shouldContain(HELLO);

View File

@ -84,7 +84,7 @@ public class DifferentHeapSizes {
} else {
result
.assertAbnormalExit("Unable to use shared archive.",
"The saved state of UseCompressedOops and USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE is different from runtime, CDS will be disabled.");
"The saved state of UseCompressedOops (1) is different from runtime (0), CDS will be disabled.");
}
}
}

View File

@ -69,7 +69,7 @@ public class CDSStreamTestDriver extends DynamicArchiveTestBase {
} catch (SkippedException s) {
if (GC.Z.isSelected() && s.toString().equals(skippedException)) {
System.out.println("Got " + s.toString() + " as expected.");
System.out.println("Because the test was run with ZGC with UseCompressedOops and USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE disabled,");
System.out.println("Because the test was run with ZGC with UseCompressedOops disabled,");
System.out.println("but the base archive was created with the options enabled");
} else {
throw new RuntimeException("Archive mapping should always succeed after JDK-8231610 (did the machine run out of memory?)");

View File

@ -306,9 +306,8 @@ class DynamicArchiveTestBase {
* the JDK was built via cross-compilation on a different platform;
* - the VM under test was started with a different options than the ones
* when the default CDS archive was built. E.g. the VM was started with
* -XX:+UseZGC which implicitly disabled the UseCompressedOoops and the
* USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE options. Those "compressed" options were
* enabled when the default CDS archive was built.
* -XX:+UseZGC which implicitly disables the UseCompressedOoops option.
* UseCompressedOoops was enabled when the default CDS archive was built.
*/
public static boolean isUseSharedSpacesDisabled() {
return !WB.isSharingEnabled();