8163363: AArch64: Stack size in tools/launcher/Settings.java needs to be adjusted
authorqpzhang
Tue, 09 Apr 2019 18:46:51 +0800
changeset 54541 9ff8d175035d
parent 54540 4de70bc80f24
child 54542 0a4214c90a55
8163363: AArch64: Stack size in tools/launcher/Settings.java needs to be adjusted Summary: Specify a proper min stack size input to -Xss for aarch64 Reviewed-by: aph
test/jdk/tools/launcher/Settings.java
--- a/test/jdk/tools/launcher/Settings.java	Mon Apr 15 16:05:46 2019 -0700
+++ b/test/jdk/tools/launcher/Settings.java	Tue Apr 09 18:46:51 2019 +0800
@@ -68,6 +68,7 @@
     private static final String PROP_SETTINGS = "Property settings:";
     private static final String LOCALE_SETTINGS = "Locale settings:";
     private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
+    private static final String STACKSIZE_SETTINGS = "Stack Size:";
 
     static void containsAllOptions(TestResult tr) {
         checkContains(tr, VM_SETTINGS);
@@ -82,10 +83,22 @@
         int stackSize = 256; // in kb
         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
             stackSize = 800;
+        } else if (getArch().equals("aarch64")) {
+            /*
+             * The max value of minimum stack size allowed for aarch64 can be estimated as
+             * such: suppose the vm page size is 64KB and the test runs with a debug build,
+             * the initial _java_thread_min_stack_allowed defined in os_linux_aarch64.cpp is
+             * 72K, stack guard zones could take 192KB, and the shadow zone needs 128KB,
+             * after aligning up all parts to the page size, the final size would be 448KB.
+             * See details in JDK-8163363
+             */
+            stackSize = 448;
         }
         TestResult tr;
         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
+        // Check the stack size logs printed by -XshowSettings to verify -Xss meaningfully.
+        checkContains(tr, STACKSIZE_SETTINGS);
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr);
@@ -93,6 +106,7 @@
         }
         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
                 "-Xss" + (stackSize * 1024), "-XshowSettings", "-jar", testJar.getAbsolutePath());
+        checkContains(tr, STACKSIZE_SETTINGS);
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr);