Merge with default ihse-runtestprebuilt-branch
authorerikj
Fri, 05 Oct 2018 16:42:55 -0700
branchihse-runtestprebuilt-branch
changeset 56939 df71c8d05835
parent 56938 e03e5f61c53f (current diff)
parent 52030 57862a02bf4b (diff)
child 56945 35914fe36a9c
Merge with default
make/RunTests.gmk
test/hotspot/jtreg/ProblemList-cds-mode.txt
--- a/make/Images.gmk	Fri Oct 05 16:14:28 2018 -0700
+++ b/make/Images.gmk	Fri Oct 05 16:42:55 2018 -0700
@@ -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/RunTests.gmk	Fri Oct 05 16:14:28 2018 -0700
+++ b/make/RunTests.gmk	Fri Oct 05 16:42:55 2018 -0700
@@ -45,7 +45,7 @@
 endif
 
 $(eval $(call ParseKeywordVariable, TEST_OPTS, \
-    SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR GENERATE_CDS_ARCHIVE, \
+    SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR, \
     STRING_KEYWORDS := VM_OPTIONS, \
 ))
 
@@ -128,22 +128,6 @@
     }')
 endif
 
-# Optionally create a CDS archive before running tests
-ifeq ($(TEST_OPTS_GENERATE_CDS_ARCHIVE), true)
-  CDS_ARCHIVE_FILE := $(TEST_RESULTS_DIR)/cds_archive.jsa
-
-  $(CDS_ARCHIVE_FILE): $(JDK_IMAGE_DIR)/release
-	$(call MakeTargetDir)
-	$(call ExecuteWithLog, $(CDS_ARCHIVE_FILE), \
-	    $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -XX:+UnlockDiagnosticVMOptions \
-	        -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE) -Xshare:dump \
-	)
-
-  CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE)
-  JTREG_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
-  TEST_PREREQS += $(CDS_ARCHIVE_FILE)
-endif
-
 ################################################################################
 # Parse control variables
 ################################################################################
@@ -409,8 +393,7 @@
 	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
 	        -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
 	        --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
-	        $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) \
-	        $$(CDS_VM_ARGS) $$(GTEST_VM_OPTIONS) \
+	        $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
 	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
--- a/make/autoconf/configure.ac	Fri Oct 05 16:14:28 2018 -0700
+++ b/make/autoconf/configure.ac	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/make/autoconf/jdk-options.m4	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/make/autoconf/spec.gmk.in	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/make/scripts/compare.sh	Fri Oct 05 16:42:55 2018 -0700
@@ -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/aot/aotCodeHeap.cpp	Fri Oct 05 16:14:28 2018 -0700
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Fri Oct 05 16:42:55 2018 -0700
@@ -735,6 +735,14 @@
 
   NOT_PRODUCT( klasses_seen++; )
 
+  // AOT does not support custom class loaders.
+  ClassLoaderData* cld = ik->class_loader_data();
+  if (!cld->is_builtin_class_loader_data()) {
+    log_trace(aot, class, load)("skip class  %s  for custom classloader %s (%p) tid=" INTPTR_FORMAT,
+                                ik->internal_name(), cld->loader_name(), cld, p2i(thread));
+    return false;
+  }
+
   AOTKlassData* klass_data = find_klass(ik);
   if (klass_data == NULL) {
     return false;
@@ -759,9 +767,10 @@
 
   assert(klass_data->_class_id < _class_count, "invalid class id");
   AOTClass* aot_class = &_classes[klass_data->_class_id];
-  if (aot_class->_classloader != NULL && aot_class->_classloader != ik->class_loader_data()) {
-    log_trace(aot, class, load)("class  %s  in  %s already loaded for classloader %p vs %p tid=" INTPTR_FORMAT,
-                                ik->internal_name(), _lib->name(), aot_class->_classloader, ik->class_loader_data(), p2i(thread));
+  ClassLoaderData* aot_cld = aot_class->_classloader;
+  if (aot_cld != NULL && aot_cld != cld) {
+    log_trace(aot, class, load)("class  %s  in  %s already loaded for classloader %s (%p) vs %s (%p) tid=" INTPTR_FORMAT,
+                                ik->internal_name(), _lib->name(), aot_cld->loader_name(), aot_cld, cld->loader_name(), cld, p2i(thread));
     NOT_PRODUCT( aot_klasses_cl_miss++; )
     return false;
   }
@@ -774,9 +783,9 @@
 
   NOT_PRODUCT( aot_klasses_found++; )
 
-  log_trace(aot, class, load)("found  %s  in  %s for classloader %p tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), ik->class_loader_data(), p2i(thread));
+  log_trace(aot, class, load)("found  %s  in  %s for classloader %s (%p) tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), cld->loader_name(), cld, p2i(thread));
 
-  aot_class->_classloader = ik->class_loader_data();
+  aot_class->_classloader = cld;
   // Set klass's Resolve (second) got cell.
   _klasses_got[klass_data->_got_index] = ik;
   if (ik->is_initialized()) {
--- a/src/hotspot/share/prims/whitebox.cpp	Fri Oct 05 16:14:28 2018 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/test/TestCommon.gmk	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 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 16:42:55 2018 -0700
@@ -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 16:42:55 2018 -0700
@@ -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 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Fri Oct 05 16:42:55 2018 -0700
@@ -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/ProblemList.txt	Fri Oct 05 16:14:28 2018 -0700
+++ b/test/jdk/ProblemList.txt	Fri Oct 05 16:42:55 2018 -0700
@@ -565,7 +565,6 @@
 java/nio/channels/DatagramChannel/ChangingAddress.java          7141822 macosx-all
 
 java/nio/channels/Selector/Wakeup.java                          6963118 windows-all
-java/nio/channels/Selector/RacyDeregister.java                  8201765 windows-all
 
 java/nio/file/WatchService/Basic.java                           7158947 solaris-all Solaris 11
 java/nio/file/WatchService/MayFlies.java                        7158947 solaris-all Solaris 11
--- a/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Fri Oct 05 16:14:28 2018 -0700
+++ b/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/test/lib/jdk/test/lib/Platform.java	Fri Oct 05 16:42:55 2018 -0700
@@ -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 16:14:28 2018 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java	Fri Oct 05 16:42:55 2018 -0700
@@ -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();