changeset 53098:6a25433b30ed

8215947: JVM crash with -XX:+DumpSharedSpaces Summary: disable JIT compilation if -XX:+DumpSharedSpaces is specified by the user Reviewed-by: lfoltan, jiangli
author ccheung
date Thu, 03 Jan 2019 14:33:58 -0800
parents 98580226126d
children 3ab3cb8a8d41
files src/hotspot/share/runtime/arguments.cpp test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Dec 14 11:22:26 2018 +0100
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jan 03 14:33:58 2019 -0800
@@ -3111,6 +3111,10 @@
       BytecodeVerificationRemote = true;
       log_info(cds)("All non-system classes will be verified (-Xverify:remote) during CDS dump time.");
     }
+
+    // Compilation is already disabled if the user specifies -Xshare:dump.
+    // Disable compilation in case user specifies -XX:+DumpSharedSpaces instead of -Xshare:dump.
+    set_mode_flags(_int);
   }
   if (UseSharedSpaces && patch_mod_javabase) {
     no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java	Fri Dec 14 11:22:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java	Thu Jan 03 14:33:58 2019 -0800
@@ -47,6 +47,13 @@
         OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
         CDSTestUtils.checkDump(out);
 
+        // -XX:+DumpSharedSpaces should behave the same as -Xshare:dump
+        pb = ProcessTools.createJavaProcessBuilder(true,
+                                "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
+                                "-XX:+DumpSharedSpaces");
+        out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
+        CDSTestUtils.checkDump(out);
+
         pb = ProcessTools.createJavaProcessBuilder(true,
                               "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
                               "-Xshare:on", "-version");