8202951: Implementation of JEP 341: Default CDS Archives
authorjiangli
Fri, 05 Oct 2018 18:56:11 -0400
changeset 52030 57862a02bf4b
parent 52029 ccfa71bacd6f
child 52031 ecb72543c632
child 56939 df71c8d05835
8202951: Implementation of JEP 341: Default CDS Archives 8210592: Convert CDS-mode test sets in tier5 and tier6 to non-CDS-mode tests 8209739: [TESTBUG] javax/imageio/plugins/png/ItxtUtf8Test.java fails with OutOfMemoryError when running in CDS mode Summary: Generate the default CDS archive at JDK build time. Reviewed-by: erikj, ihse, dholmes, iklam, ccheung, mseledtsov Contributed-by: erik.joelsson@oracle.com, jiangli.zhou@oracle.com, calvin.cheung@oracle.com
make/Images.gmk
make/autoconf/configure.ac
make/autoconf/jdk-options.m4
make/autoconf/spec.gmk.in
make/scripts/compare.sh
src/hotspot/share/prims/whitebox.cpp
src/hotspot/share/runtime/arguments.cpp
src/hotspot/share/runtime/arguments.hpp
test/TestCommon.gmk
test/hotspot/jtreg/ProblemList-cds-mode.txt
test/hotspot/jtreg/ProblemList-non-cds-mode.txt
test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java
test/hotspot/jtreg/runtime/SharedArchiveFile/CheckSharingWithDefaultArchive.java
test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java
test/lib/jdk/test/lib/Platform.java
test/lib/sun/hotspot/WhiteBox.java
--- a/make/Images.gmk	Fri Oct 05 15:46:47 2018 -0700
+++ b/make/Images.gmk	Fri Oct 05 18:56:11 2018 -0400
@@ -90,24 +90,32 @@
 
 $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
     $(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(ECHO) Creating jdk image
+	$(call LogWarn, Creating jdk image)
 	$(RM) -r $(JDK_IMAGE_DIR)
 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
 	    $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
 	        $(JLINK_JDK_EXTRA_OPTS) \
 	        --output $(JDK_IMAGE_DIR) \
 	)
+        ifeq ($(BUILD_CDS_ARCHIVE), true)
+	  $(call LogWarn, Creating CDS archive for jdk image)
+	  $(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+        endif
 	$(TOUCH) $@
 
 $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
     $(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(ECHO) Creating legacy jre image
+	$(call LogWarn, Creating legacy jre image)
 	$(RM) -r $(JRE_IMAGE_DIR)
 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
 	    $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
 	        $(JLINK_JRE_EXTRA_OPTS) \
 	        --output $(JRE_IMAGE_DIR) \
 	)
+        ifeq ($(BUILD_CDS_ARCHIVE), true)
+	  $(call LogWarn, Creating CDS archive for jre image)
+	  $(JRE_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+        endif
 	$(TOUCH) $@
 
 TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
--- a/make/autoconf/configure.ac	Fri Oct 05 15:46:47 2018 -0700
+++ b/make/autoconf/configure.ac	Fri Oct 05 18:56:11 2018 -0400
@@ -233,6 +233,7 @@
 JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
 JDKOPT_EXCLUDE_TRANSLATIONS
 JDKOPT_ENABLE_DISABLE_MANPAGES
+JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE
 
 ###############################################################################
 #
--- a/make/autoconf/jdk-options.m4	Fri Oct 05 15:46:47 2018 -0700
+++ b/make/autoconf/jdk-options.m4	Fri Oct 05 18:56:11 2018 -0400
@@ -605,3 +605,38 @@
 
   AC_SUBST(BUILD_MANPAGES)
 ])
+
+################################################################################
+#
+# Disable the default CDS archive generation
+#   cross compilation - disabled
+#   zero              - off by default (not a tested configuration)
+#
+AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
+[
+  AC_ARG_ENABLE([cds-archive], [AS_HELP_STRING([--disable-cds-archive],
+      [Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])])
+
+  AC_MSG_CHECKING([if a default CDS archive should be generated])
+  if test "x$COMPILE_TYPE" = "xcross"; then
+    AC_MSG_RESULT([no, not possible with cross compilation])
+    BUILD_CDS_ARCHIVE="false"
+  elif test "x$enable_cds_archive" = "xyes"; then
+    AC_MSG_RESULT([yes, forced])
+    BUILD_CDS_ARCHIVE="true"
+  elif HOTSPOT_CHECK_JVM_VARIANT(zero); then
+    AC_MSG_RESULT([no])
+    BUILD_CDS_ARCHIVE="false"
+  elif test "x$enable_cds_archive" = "x"; then
+    AC_MSG_RESULT([yes])
+    BUILD_CDS_ARCHIVE="true"
+  elif test "x$enable_cds_archive" = "xno"; then
+    AC_MSG_RESULT([no, forced])
+    BUILD_CDS_ARCHIVE="false"
+  else
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([--enable-cds_archive can only be yes/no or empty])
+  fi
+
+  AC_SUBST(BUILD_CDS_ARCHIVE)
+])
--- a/make/autoconf/spec.gmk.in	Fri Oct 05 15:46:47 2018 -0700
+++ b/make/autoconf/spec.gmk.in	Fri Oct 05 18:56:11 2018 -0400
@@ -309,6 +309,8 @@
 
 BUILD_MANPAGES := @BUILD_MANPAGES@
 
+BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
+
 # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
 # it in sync.
 BOOT_JDK:=@BOOT_JDK@
--- a/make/scripts/compare.sh	Fri Oct 05 15:46:47 2018 -0700
+++ b/make/scripts/compare.sh	Fri Oct 05 18:56:11 2018 -0400
@@ -385,6 +385,7 @@
         ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \
         ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \
         ! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \
+        ! -name "classes.jsa" \
         | $GREP -v "./bin/"  | $SORT | $FILTER)
 
     echo Other files with binary differences...
--- a/src/hotspot/share/prims/whitebox.cpp	Fri Oct 05 15:46:47 2018 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Fri Oct 05 18:56:11 2018 -0400
@@ -1749,6 +1749,20 @@
   return NULL;
 WB_END
 
+WB_ENTRY(jobject, WB_GetDefaultArchivePath(JNIEnv* env, jobject wb))
+  const char* p = Arguments::get_default_shared_archive_path();
+  ThreadToNativeFromVM ttn(thread);
+  jstring path_string = env->NewStringUTF(p);
+
+  CHECK_JNI_EXCEPTION_(env, NULL);
+
+  return path_string;
+WB_END
+
+WB_ENTRY(jboolean, WB_IsSharingEnabled(JNIEnv* env, jobject wb))
+  return UseSharedSpaces;
+WB_END
+
 WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
   oop obj_oop = JNIHandles::resolve(obj);
   return MetaspaceShared::is_archive_object(obj_oop);
@@ -2185,6 +2199,9 @@
   {CC"getMethodStringOption",
       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
                                                       (void*)&WB_GetMethodStringOption},
+  {CC"getDefaultArchivePath",             CC"()Ljava/lang/String;",
+                                                      (void*)&WB_GetDefaultArchivePath},
+  {CC"isSharingEnabled",   CC"()Z",                   (void*)&WB_IsSharingEnabled},
   {CC"isShared",           CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
   {CC"isSharedClass",      CC"(Ljava/lang/Class;)Z",  (void*)&WB_IsSharedClass },
   {CC"areSharedStringsIgnored",           CC"()Z",    (void*)&WB_AreSharedStringsIgnored },
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Oct 05 15:46:47 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Fri Oct 05 18:56:11 2018 -0400
@@ -3450,21 +3450,27 @@
 
 // Sharing support
 // Construct the path to the archive
+char* Arguments::get_default_shared_archive_path() {
+  char *default_archive_path;
+  char jvm_path[JVM_MAXPATHLEN];
+  os::jvm_path(jvm_path, sizeof(jvm_path));
+  char *end = strrchr(jvm_path, *os::file_separator());
+  if (end != NULL) *end = '\0';
+  size_t jvm_path_len = strlen(jvm_path);
+  size_t file_sep_len = strlen(os::file_separator());
+  const size_t len = jvm_path_len + file_sep_len + 20;
+  default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
+  if (default_archive_path != NULL) {
+    jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
+      jvm_path, os::file_separator());
+  }
+  return default_archive_path;
+}
+
 static char* get_shared_archive_path() {
   char *shared_archive_path;
   if (SharedArchiveFile == NULL) {
-    char jvm_path[JVM_MAXPATHLEN];
-    os::jvm_path(jvm_path, sizeof(jvm_path));
-    char *end = strrchr(jvm_path, *os::file_separator());
-    if (end != NULL) *end = '\0';
-    size_t jvm_path_len = strlen(jvm_path);
-    size_t file_sep_len = strlen(os::file_separator());
-    const size_t len = jvm_path_len + file_sep_len + 20;
-    shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
-    if (shared_archive_path != NULL) {
-      jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa",
-        jvm_path, os::file_separator());
-    }
+    shared_archive_path = Arguments::get_default_shared_archive_path();
   } else {
     shared_archive_path = os::strdup_check_oom(SharedArchiveFile, mtArguments);
   }
--- a/src/hotspot/share/runtime/arguments.hpp	Fri Oct 05 15:46:47 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp	Fri Oct 05 18:56:11 2018 -0400
@@ -633,6 +633,7 @@
   static char* get_appclasspath() { return _java_class_path->value(); }
   static void  fix_appclasspath();
 
+  static char* get_default_shared_archive_path();
 
   // Operation modi
   static Mode mode()                        { return _mode; }
--- a/test/TestCommon.gmk	Fri Oct 05 15:46:47 2018 -0700
+++ b/test/TestCommon.gmk	Fri Oct 05 18:56:11 2018 -0400
@@ -178,20 +178,6 @@
   endif
 endif
 
-
-# Optionally create a CDS archive before running tests
-ifeq ($(GENERATE_CDS_ARCHIVE), true)
-  CDS_ARCHIVE_FILE := $(ABS_TEST_OUTPUT_DIR)/cds_archive.jsa
-
-  $(CDS_ARCHIVE_FILE): $(PRODUCT_HOME)
-	$(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
-	    -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") -Xshare:dump
-
-  CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)")
-  JTREG_TEST_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
-  TEST_PREREQS += $(CDS_ARCHIVE_FILE)
-endif
-
 # How to create the test bundle (pass or fail, we want to create this)
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ifneq ($(ARCHIVE_BUNDLE), )
--- a/test/hotspot/jtreg/ProblemList-cds-mode.txt	Fri Oct 05 15:46:47 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#
-# Copyright (c) 2018, 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
-# 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.
-#
-
-#############################################################################
-#
-# Additional list of quarantined tests when CDS mode enabled.
-#
-#############################################################################
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/ProblemList-non-cds-mode.txt	Fri Oct 05 18:56:11 2018 -0400
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2018, 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
+# 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.
+#
+
+#############################################################################
+#
+# Additional list of quarantined tests when non-CDS mode enabled.
+#
+#############################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java	Fri Oct 05 18:56:11 2018 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 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
+ * 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 Default CDS archive file
+ * @summary JDK platforms/binaries do not support default CDS archive should
+ *          not contain classes.jsa in the default location.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI CheckDefaultArchiveFile
+ */
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cds.CDSTestUtils;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckDefaultArchiveFile {
+    public static void main(String[] args) throws Exception {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        String osArch = Platform.getOsArch();
+        String vmName = System.getProperty("java.vm.name");
+        String vmString = vmName + "(" + osArch + ")";
+        String jsaString = wb.getDefaultArchivePath();
+        Path jsa = Paths.get(jsaString);
+        if (Platform.isDefaultCDSArchiveSupported()) {
+            if (Files.exists(jsa)) {
+                System.out.println("Passed. " + vmString +
+                                   ": has default classes.jsa file");
+            } else {
+                throw new RuntimeException(vmString + "has no " + jsaString);
+            }
+        } else {
+            throw new SkippedException("Default CDS archive is not supported");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckSharingWithDefaultArchive.java	Fri Oct 05 18:56:11 2018 -0400
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018, 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
+ * 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 Default CDS archive
+ * @summary Sharing should be enabled by default on supported platform/binaries.
+ *          No -Xshare:dump is needed. No -Xshare:auto or -Xshare:on in needed.
+ *          Verify a set of well-known shared classes.
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI CheckSharingWithDefaultArchive -showversion
+ */
+import jdk.test.lib.Platform;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckSharingWithDefaultArchive {
+    public static void main(String[] args) throws Exception {
+        if (!Platform.isDefaultCDSArchiveSupported()) {
+            throw new SkippedException("Supported platform");
+        }
+
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        String classes[] = {"java.lang.Object",
+                            "java.lang.String",
+                            "java.lang.Class"};
+        // If maping fails, sharing is disabled
+        if (wb.isSharingEnabled()) {
+            for (int i = 0; i < classes.length; i++) {
+                Class c = Class.forName(classes[i]);
+                if (wb.isSharedClass(c)) {
+                    System.out.println(classes[i] + " is shared.");
+                } else {
+                    throw new RuntimeException(classes[i] + " is not shared");
+                }
+            }
+        } else {
+           throw new SkippedException("Sharing is not enabled.");
+        }
+    }
+}
--- a/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Fri Oct 05 15:46:47 2018 -0700
+++ b/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Fri Oct 05 18:56:11 2018 -0400
@@ -50,8 +50,9 @@
         OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
         MODE("isInt", "isMixed", "isComp"),
-        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
-                "hasSA", "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
+        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
+                "isSlowDebugBuild", "hasSA", "shouldSAAttach", "isTieredSupported",
+                "areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported");
 
         public final List<String> methodNames;
 
--- a/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Fri Oct 05 15:46:47 2018 -0700
+++ b/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Fri Oct 05 18:56:11 2018 -0400
@@ -30,7 +30,7 @@
  *
  * @run main ItxtUtf8Test
  *
- * @run main/othervm/timeout=10 -Xmx4m ItxtUtf8Test truncate
+ * @run main/othervm/timeout=10 -Xmx6m ItxtUtf8Test truncate
  */
 
 import java.awt.image.BufferedImage;
--- a/test/lib/jdk/test/lib/Platform.java	Fri Oct 05 15:46:47 2018 -0700
+++ b/test/lib/jdk/test/lib/Platform.java	Fri Oct 05 18:56:11 2018 -0400
@@ -325,6 +325,19 @@
         }
     }
 
+    public static boolean isDefaultCDSArchiveSupported() {
+        return (is64bit()  &&
+                isServer() &&
+                (isLinux()   ||
+                 isOSX()     ||
+                 isSolaris() ||
+                 isWindows()) &&
+                !isZero()    &&
+                !isMinimal() &&
+                !isAArch64() &&
+                !isARM());
+    }
+
     /*
      * This should match the #if condition in ClassListParser::load_class_from_source().
      */
--- a/test/lib/sun/hotspot/WhiteBox.java	Fri Oct 05 15:46:47 2018 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java	Fri Oct 05 18:56:11 2018 -0400
@@ -512,6 +512,8 @@
   public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
 
   // Sharing & archiving
+  public native String  getDefaultArchivePath();
+  public native boolean isSharingEnabled();
   public native boolean isShared(Object o);
   public native boolean isSharedClass(Class<?> c);
   public native boolean areSharedStringsIgnored();