Skip to content

Commit

Permalink
8293563: [macos-aarch64] SA core file tests failing with sun.jvm.hots…
Browse files Browse the repository at this point in the history
…pot.oops.UnknownOopException

Reviewed-by: lucy
Backport-of: 76f1865
(cherry picked from commit 5eeb41a)
  • Loading branch information
GoeLin authored and RealCLanger committed May 3, 2024
1 parent 82af07d commit ec3b067
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -79,6 +79,7 @@ public static void main(String[] args) throws Exception {
"-Xshare:auto",
"-XX:+ProfileInterpreter",
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
CoreUtils.getAlwaysPretouchArg(true),
CrashApp.class.getName()
};

Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ private static void testFindPC(boolean withXcomp, boolean withCore) throws Excep
theApp = new LingeredAppWithTrivialMain();
theApp.setForceCrash(withCore);
if (withXcomp) {
LingeredApp.startApp(List.of("-Xcomp"), theApp);
LingeredApp.startApp(List.of("-Xcomp", CoreUtils.getAlwaysPretouchArg(withCore)), theApp);
} else {
LingeredApp.startApp(List.of("-Xint"), theApp);
LingeredApp.startApp(List.of("-Xint", CoreUtils.getAlwaysPretouchArg(withCore)), theApp);
}
System.out.print("Started LingeredApp ");
if (withXcomp) {
Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. 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
Expand All @@ -26,6 +26,7 @@
import java.util.Map;

import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.util.CoreUtils;
import jtreg.SkippedException;

/**
Expand All @@ -46,7 +47,7 @@ public static void main(String[] args) throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
theApp = LingeredApp.startApp();
theApp = LingeredApp.startApp(List.of(CoreUtils.getAlwaysPretouchArg(false)));
System.out.println("Started LingeredApp with pid " + theApp.getPid());

List<String> cmds = List.of("pmap");
Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. 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
Expand All @@ -26,6 +26,7 @@
import java.util.Map;

import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.util.CoreUtils;
import jtreg.SkippedException;

/**
Expand All @@ -45,7 +46,7 @@ public static void main(String[] args) throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
theApp = LingeredApp.startApp();
theApp = LingeredApp.startApp(List.of(CoreUtils.getAlwaysPretouchArg(false)));
System.out.println("Started LingeredApp with pid " + theApp.getPid());

List<String> cmds = List.of("pstack -v");
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/serviceability/sa/TestJmapCore.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -74,6 +74,7 @@ static void test(String type) throws Throwable {
"-Xmx512m", "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError", "-XX:-TransmitErrorReport",
// The test loads lots of small classes to exhaust Metaspace, skip method
// dependency verification to improve performance in debug builds.
CoreUtils.getAlwaysPretouchArg(true),
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "--show-version",
TestJmapCore.class.getName(), type);

Expand Down
12 changes: 11 additions & 1 deletion test/lib/jdk/test/lib/util/CoreUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,14 @@ private static void unzipCores(File dir) {
}
}

}
public static String getAlwaysPretouchArg(boolean withCore) {
// macosx-aarch64 has an issue where sometimes the java heap will not be dumped to the
// core file. Using -XX:+AlwaysPreTouch fixes the problem.
if (withCore && Platform.isOSX() && Platform.isAArch64()) {
return "-XX:+AlwaysPreTouch";
} else {
return "-XX:-AlwaysPreTouch";
}
}

}

0 comments on commit ec3b067

Please sign in to comment.