changeset 50978:538bf45dde71

Merge
author mikael
date Thu, 12 Jul 2018 13:04:33 -0700
parents c0f1fecafe20 69b438908512
children 03f5e2c372e6
files src/hotspot/os/linux/os_linux.cpp src/java.base/share/classes/sun/net/NetworkServer.java src/java.base/share/classes/sun/net/URLCanonicalizer.java test/jdk/java/lang/System/SetProperties.java test/langtools/tools/javac/6558548/T6558548_6.out test/langtools/tools/javac/8013179/T8013179.java test/langtools/tools/javac/8013179/T8013179.out test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1_6.out test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2_6.out test/langtools/tools/javac/StringsInSwitch/NonConstantLabel6.out test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.out test/langtools/tools/javac/StringsInSwitch/RSCL1_6.out test/langtools/tools/javac/StringsInSwitch/RSCL2_6.out test/langtools/tools/javac/TryWithResources/BadTwr6.out test/langtools/tools/javac/TryWithResources/BadTwrSyntax6.out test/langtools/tools/javac/TryWithResources/PlainTry6.out test/langtools/tools/javac/TryWithResources/TwrOnNonResource6.out test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion6.out test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified6.out test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple6.out test/langtools/tools/javac/literals/BadBinaryLiterals.6.out test/langtools/tools/javac/literals/BadUnderscoreLiterals.6.out test/langtools/tools/javac/types/CastObjectToPrimitiveTest.out
diffstat 151 files changed, 2735 insertions(+), 1104 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jul 05 14:47:50 2018 -0700
+++ b/.hgtags	Thu Jul 12 13:04:33 2018 -0700
@@ -493,3 +493,4 @@
 36ca515343e00b021dcfc902e986d26ec994a2e5 jdk-11+19
 95aad0c785e497f1bade3955c4e4a677b629fa9d jdk-12+0
 9816d7cc655e53ba081f938b656e31971b8f097a jdk-11+20
+00b16d0457e43d23f6ca5ade6b243edce62750a0 jdk-12+1
--- a/make/hotspot/lib/JvmFeatures.gmk	Thu Jul 05 14:47:50 2018 -0700
+++ b/make/hotspot/lib/JvmFeatures.gmk	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -109,6 +109,7 @@
       classListParser.cpp \
       classLoaderExt.cpp \
       filemap.cpp \
+      heapShared.cpp \
       metaspaceShared.cpp \
       metaspaceShared_$(HOTSPOT_TARGET_CPU).cpp \
       metaspaceShared_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
--- a/make/hotspot/symbols/symbols-unix	Thu Jul 05 14:47:50 2018 -0700
+++ b/make/hotspot/symbols/symbols-unix	Thu Jul 12 13:04:33 2018 -0700
@@ -136,6 +136,7 @@
 JVM_InitProperties
 JVM_InitStackTraceElement
 JVM_InitStackTraceElementArray
+JVM_InitializeFromArchive
 JVM_InternString
 JVM_Interrupt
 JVM_InvokeMethod
--- a/make/test/JtregNativeHotspot.gmk	Thu Jul 05 14:47:50 2018 -0700
+++ b/make/test/JtregNativeHotspot.gmk	Thu Jul 12 13:04:33 2018 -0700
@@ -836,6 +836,10 @@
 
 ################################################################################
 
+ifeq ($(TOOLCHAIN_TYPE), solstudio)
+   BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libji06t001 += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED
+endif
+
 # Platform specific setup
 ifneq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
   BUILD_HOTSPOT_JTREG_EXCLUDE += liboverflow.c exeThreadSignalMask.c
@@ -858,9 +862,13 @@
 
 BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exesigtest := -ljvm
 
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+    BUILD_HOTSPOT_JTREG_EXCLUDE += libterminatedThread.c
+endif
+
 ifeq ($(OPENJDK_TARGET_OS), windows)
     BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
-    BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c
+    BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c
 
 else
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
@@ -1494,6 +1502,7 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libvmdeath001 += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase001 += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase002 += -lpthread
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libterminatedThread += -lpthread
 endif
 
 $(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \
--- a/src/hotspot/cpu/x86/methodHandles_x86.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -440,8 +440,6 @@
         verify_ref_kind(_masm, JVM_REF_invokeInterface, member_reg, temp3);
       }
 
-      BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
-
       Register temp3_intf = temp3;
       __ load_heap_oop(temp3_intf, member_clazz);
       load_klass_from_Class(_masm, temp3_intf);
--- a/src/hotspot/os/aix/os_aix.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/os/aix/os_aix.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -576,7 +576,9 @@
       }
     }
     Arguments::set_java_home(buf);
-    set_boot_path('/', ':');
+    if (!set_boot_path('/', ':')) {
+      vm_exit_during_initialization("Failed setting boot class path.", NULL);
+    }
   }
 
   // Where to look for native libraries.
--- a/src/hotspot/os/bsd/os_bsd.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -372,7 +372,9 @@
       }
     }
     Arguments::set_java_home(buf);
-    set_boot_path('/', ':');
+    if (!set_boot_path('/', ':')) {
+      vm_exit_during_initialization("Failed setting boot class path.", NULL);
+    }
   }
 
   // Where to look for native libraries.
--- a/src/hotspot/os/linux/os_linux.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -366,7 +366,9 @@
       }
     }
     Arguments::set_java_home(buf);
-    set_boot_path('/', ':');
+    if (!set_boot_path('/', ':')) {
+      vm_exit_during_initialization("Failed setting boot class path.", NULL);
+    }
   }
 
   // Where to look for native libraries.
@@ -5633,14 +5635,18 @@
 
 static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time);
 
-static clockid_t thread_cpu_clockid(Thread* thread) {
-  pthread_t tid = thread->osthread()->pthread_id();
-  clockid_t clockid;
-
-  // Get thread clockid
-  int rc = os::Linux::pthread_getcpuclockid(tid, &clockid);
-  assert(rc == 0, "pthread_getcpuclockid is expected to return 0 code");
-  return clockid;
+static jlong fast_cpu_time(Thread *thread) {
+    clockid_t clockid;
+    int rc = os::Linux::pthread_getcpuclockid(thread->osthread()->pthread_id(),
+                                              &clockid);
+    if (rc == 0) {
+      return os::Linux::fast_thread_cpu_time(clockid);
+    } else {
+      // It's possible to encounter a terminated native thread that failed
+      // to detach itself from the VM - which should result in ESRCH.
+      assert_status(rc == ESRCH, rc, "pthread_getcpuclockid failed");
+      return -1;
+    }
 }
 
 // current_thread_cpu_time(bool) and thread_cpu_time(Thread*, bool)
@@ -5662,7 +5668,7 @@
 jlong os::thread_cpu_time(Thread* thread) {
   // consistent with what current_thread_cpu_time() returns
   if (os::Linux::supports_fast_thread_cpu_time()) {
-    return os::Linux::fast_thread_cpu_time(thread_cpu_clockid(thread));
+    return fast_cpu_time(thread);
   } else {
     return slow_thread_cpu_time(thread, true /* user + sys */);
   }
@@ -5678,7 +5684,7 @@
 
 jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
   if (user_sys_cpu_time && os::Linux::supports_fast_thread_cpu_time()) {
-    return os::Linux::fast_thread_cpu_time(thread_cpu_clockid(thread));
+    return fast_cpu_time(thread);
   } else {
     return slow_thread_cpu_time(thread, user_sys_cpu_time);
   }
--- a/src/hotspot/os/solaris/os_solaris.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -580,7 +580,9 @@
       }
     }
     Arguments::set_java_home(buf);
-    set_boot_path('/', ':');
+    if (!set_boot_path('/', ':')) {
+      vm_exit_during_initialization("Failed setting boot class path.", NULL);
+    }
   }
 
   // Where to look for native libraries.
--- a/src/hotspot/os/windows/os_windows.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/os/windows/os_windows.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -230,7 +230,7 @@
     FREE_C_HEAP_ARRAY(char, dll_path);
 
     if (!set_boot_path('\\', ';')) {
-      return;
+      vm_exit_during_initialization("Failed setting boot class path.", NULL);
     }
   }
 
--- a/src/hotspot/share/ci/ciEnv.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/ci/ciEnv.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -938,9 +938,9 @@
       _inc_decompile_count_on_failure = false;
       record_failure("call site target change");
     } else if (Dependencies::is_klass_type(result)) {
+      record_failure("concurrent class loading");
+    } else {
       record_failure("invalid non-klass dependency");
-    } else {
-      record_failure("concurrent class loading");
     }
   }
 }
--- a/src/hotspot/share/classfile/classLoader.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -298,8 +298,6 @@
   char *copy = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1, mtClass);
   strcpy(copy, zip_name);
   _zip_name = copy;
-  _is_boot_append = is_boot_append;
-  _multi_versioned = _unknown;
 }
 
 ClassPathZipEntry::~ClassPathZipEntry() {
@@ -338,95 +336,11 @@
   return buffer;
 }
 
-#if INCLUDE_CDS
-u1* ClassPathZipEntry::open_versioned_entry(const char* name, jint* filesize, TRAPS) {
-  u1* buffer = NULL;
-  if (DumpSharedSpaces && !_is_boot_append) {
-    // We presume default is multi-release enabled
-    const char* multi_ver = Arguments::get_property("jdk.util.jar.enableMultiRelease");
-    const char* verstr = Arguments::get_property("jdk.util.jar.version");
-    bool is_multi_ver = (multi_ver == NULL ||
-                         strcmp(multi_ver, "true") == 0 ||
-                         strcmp(multi_ver, "force")  == 0) &&
-                         is_multiple_versioned(THREAD);
-    // command line version setting
-    int version = 0;
-    const int base_version = 8; // JDK8
-    int cur_ver = JDK_Version::current().major_version();
-    if (verstr != NULL) {
-      version = atoi(verstr);
-      if (version < base_version || version > cur_ver) {
-        // If the specified version is lower than the base version, the base
-        // entry will be used; if the version is higher than the current
-        // jdk version, the highest versioned entry will be used.
-        if (version < base_version) {
-          is_multi_ver = false;
-        }
-        // print out warning, do not use assertion here since it will continue to look
-        // for proper version.
-        warning("JDK%d is not supported in multiple version jars", version);
-      }
-    }
-
-    if (is_multi_ver) {
-      int n;
-      const char* version_entry = "META-INF/versions/";
-      // 10 is the max length of a decimal 32-bit non-negative number
-      // 2 includes the '/' and trailing zero
-      size_t entry_name_len = strlen(version_entry) + 10 + strlen(name) + 2;
-      char* entry_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, entry_name_len);
-      if (version > 0) {
-        n = jio_snprintf(entry_name, entry_name_len, "%s%d/%s", version_entry, version, name);
-        entry_name[n] = '\0';
-        buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
-        if (buffer == NULL) {
-          warning("Could not find %s in %s, try to find highest version instead", entry_name, _zip_name);
-        }
-      }
-      if (buffer == NULL) {
-        for (int i = cur_ver; i >= base_version; i--) {
-          n = jio_snprintf(entry_name, entry_name_len, "%s%d/%s", version_entry, i, name);
-          entry_name[n] = '\0';
-          buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
-          if (buffer != NULL) {
-            break;
-          }
-        }
-      }
-      FREE_RESOURCE_ARRAY(char, entry_name, entry_name_len);
-    }
-  }
-  return buffer;
-}
-
-bool ClassPathZipEntry::is_multiple_versioned(TRAPS) {
-  assert(DumpSharedSpaces, "called only at dump time");
-  if (_multi_versioned != _unknown) {
-    return (_multi_versioned == _yes) ? true : false;
-  }
-  jint size;
-  char* buffer = (char*)open_entry("META-INF/MANIFEST.MF", &size, true, CHECK_false);
-  if (buffer != NULL) {
-    char* p = buffer;
-    for ( ; *p; ++p) *p = tolower(*p);
-    if (strstr(buffer, "multi-release: true") != NULL) {
-      _multi_versioned = _yes;
-      return true;
-    }
-  }
-  _multi_versioned = _no;
-  return false;
-}
-#endif // INCLUDE_CDS
-
 ClassFileStream* ClassPathZipEntry::open_stream(const char* name, TRAPS) {
   jint filesize;
-  u1* buffer = open_versioned_entry(name, &filesize, CHECK_NULL);
+  u1* buffer = open_entry(name, &filesize, false, CHECK_NULL);
   if (buffer == NULL) {
-    buffer = open_entry(name, &filesize, false, CHECK_NULL);
-    if (buffer == NULL) {
-      return NULL;
-    }
+    return NULL;
   }
   if (UsePerfData) {
     ClassLoader::perf_sys_classfile_bytes_read()->inc(filesize);
@@ -635,6 +549,7 @@
 
 void ClassLoader::setup_bootstrap_search_path() {
   const char* sys_class_path = Arguments::get_sysclasspath();
+  assert(sys_class_path != NULL, "System boot class path must not be NULL");
   if (PrintSharedArchiveAndExit) {
     // Don't print sys_class_path - this is the bootcp of this current VM process, not necessarily
     // the same as the bootcp of the shared archive.
--- a/src/hotspot/share/classfile/classLoader.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -94,17 +94,9 @@
 } jzentry;
 
 class ClassPathZipEntry: public ClassPathEntry {
- enum {
-   _unknown = 0,
-   _yes     = 1,
-   _no      = 2
- };
  private:
   jzfile* _zip;              // The zip archive
   const char*   _zip_name;   // Name of zip archive
-  bool _is_boot_append;      // entry coming from -Xbootclasspath/a
-  u1 _multi_versioned;       // indicates if the jar file has multi-versioned entries.
-                             // It can have value of "_unknown", "_yes", or "_no"
  public:
   bool is_modules_image() const { return false; }
   bool is_jar_file() const { return true;  }
@@ -113,10 +105,8 @@
   ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append);
   virtual ~ClassPathZipEntry();
   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
-  u1* open_versioned_entry(const char* name, jint* filesize, TRAPS) NOT_CDS_RETURN_(NULL);
   ClassFileStream* open_stream(const char* name, TRAPS);
   void contents_do(void f(const char* name, void* context), void* context);
-  bool is_multiple_versioned(TRAPS) NOT_CDS_RETURN_(false);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
--- a/src/hotspot/share/classfile/javaClasses.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -1051,8 +1051,9 @@
       ResetMirrorField reset(archived_mirror_h);
       InstanceKlass::cast(k)->do_nonstatic_fields(&reset);
 
-      log_trace(cds, mirror)("Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
-                             type2name((BasicType)t), p2i(Universe::_mirrors[t]), p2i(archived_m));
+      log_trace(cds, heap, mirror)(
+        "Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
+        type2name((BasicType)t), p2i(Universe::_mirrors[t]), p2i(archived_m));
 
       Universe::_mirrors[t] = archived_m;
     }
@@ -1133,8 +1134,9 @@
   k->set_has_raw_archived_mirror();
 
   ResourceMark rm;
-  log_trace(cds, mirror)("Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
-                         k->external_name(), p2i(mirror), p2i(archived_mirror));
+  log_trace(cds, heap, mirror)(
+    "Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
+    k->external_name(), p2i(mirror), p2i(archived_mirror));
 
   return archived_mirror;
 }
@@ -1186,8 +1188,9 @@
   // klass. Updated the field in the archived mirror to point to the relocated
   // klass in the archive.
   Klass *reloc_k = MetaspaceShared::get_relocated_klass(as_Klass(mirror));
-  log_debug(cds, mirror)("Relocate mirror metadata field at _klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT,
-                         p2i(as_Klass(mirror)), p2i(reloc_k));
+  log_debug(cds, heap, mirror)(
+    "Relocate mirror metadata field at _klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT,
+    p2i(as_Klass(mirror)), p2i(reloc_k));
   archived_mirror->metadata_field_put(_klass_offset, reloc_k);
 
   // The field at _array_klass_offset is pointing to the original one dimension
@@ -1195,8 +1198,9 @@
   Klass *arr = array_klass_acquire(mirror);
   if (arr != NULL) {
     Klass *reloc_arr = MetaspaceShared::get_relocated_klass(arr);
-    log_debug(cds, mirror)("Relocate mirror metadata field at _array_klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT,
-                           p2i(arr), p2i(reloc_arr));
+    log_debug(cds, heap, mirror)(
+      "Relocate mirror metadata field at _array_klass_offset from " PTR_FORMAT " ==> " PTR_FORMAT,
+      p2i(arr), p2i(reloc_arr));
     archived_mirror->metadata_field_put(_array_klass_offset, reloc_arr);
   }
   return archived_mirror;
@@ -1247,7 +1251,8 @@
   set_mirror_module_field(k, mirror, module, THREAD);
 
   ResourceMark rm;
-  log_trace(cds, mirror)("Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror()));
+  log_trace(cds, heap, mirror)(
+    "Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror()));
 
   return true;
 }
@@ -4273,6 +4278,9 @@
 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset;
 int reflect_ConstantPool::_oop_offset;
 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
+int jdk_internal_module_ArchivedModuleGraph::_archivedSystemModules_offset;
+int jdk_internal_module_ArchivedModuleGraph::_archivedModuleFinder_offset;
+int jdk_internal_module_ArchivedModuleGraph::_archivedMainModule_offset;
 
 #define STACKTRACEELEMENT_FIELDS_DO(macro) \
   macro(declaringClassObject_offset,  k, "declaringClassObject", class_signature, false); \
@@ -4435,6 +4443,23 @@
   return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes();
 }
 
+#define MODULEBOOTSTRAP_FIELDS_DO(macro) \
+  macro(_archivedSystemModules_offset,      k, "archivedSystemModules", systemModules_signature, true); \
+  macro(_archivedModuleFinder_offset,       k, "archivedModuleFinder",  moduleFinder_signature,  true); \
+  macro(_archivedMainModule_offset,         k, "archivedMainModule",    string_signature,        true)
+
+void jdk_internal_module_ArchivedModuleGraph::compute_offsets() {
+  InstanceKlass* k = SystemDictionary::ArchivedModuleGraph_klass();
+  assert(k != NULL, "must be loaded");
+  MODULEBOOTSTRAP_FIELDS_DO(FIELD_COMPUTE_OFFSET);
+}
+
+#if INCLUDE_CDS
+void jdk_internal_module_ArchivedModuleGraph::serialize(SerializeClosure* f) {
+  MODULEBOOTSTRAP_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
+}
+#endif
+
 // Compute hard-coded offsets
 // Invoked before SystemDictionary::initialize, so pre-loaded classes
 // are not available to determine the offset_of_static_fields.
@@ -4493,6 +4518,8 @@
   java_lang_LiveStackFrameInfo::compute_offsets();
   java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets();
 
+  jdk_internal_module_ArchivedModuleGraph::compute_offsets();
+
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
 }
--- a/src/hotspot/share/classfile/javaClasses.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -1491,6 +1491,19 @@
   static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
 };
 
+class jdk_internal_module_ArchivedModuleGraph: AllStatic {
+ private:
+  static int _archivedSystemModules_offset;
+  static int _archivedModuleFinder_offset;
+  static int _archivedMainModule_offset;
+ public:
+  static int  archivedSystemModules_offset()      { return _archivedSystemModules_offset; }
+  static int  archivedModuleFinder_offset()       { return _archivedModuleFinder_offset; }
+  static int  archivedMainModule_offset()         { return _archivedMainModule_offset; }
+  static void compute_offsets();
+  static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
+};
+
 // Use to declare fields that need to be injected into Java classes
 // for the JVM to use.  The name_index and signature_index are
 // declared in vmSymbols.  The may_be_java flag is used to declare
--- a/src/hotspot/share/classfile/stringTable.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -785,6 +785,10 @@
 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 
+  if (MetaspaceShared::is_archive_object(s)) {
+    return s;
+  }
+
   oop new_s = NULL;
   typeArrayOop v = java_lang_String::value_no_keepalive(s);
   typeArrayOop new_v =
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -187,6 +187,7 @@
   do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader,       Pre ) \
   do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader,  Pre ) \
   do_klass(CodeSource_klass,                            java_security_CodeSource,                  Pre                 ) \
+  do_klass(ArchivedModuleGraph_klass,                   jdk_internal_module_ArchivedModuleGraph,   Pre                 ) \
                                                                                                                          \
   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
                                                                                                                          \
--- a/src/hotspot/share/classfile/vmSymbols.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/classfile/vmSymbols.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -124,6 +124,7 @@
   template(getBootClassPathEntryForClass_name,        "getBootClassPathEntryForClass")            \
   template(jdk_internal_vm_PostVMInitHook,            "jdk/internal/vm/PostVMInitHook")           \
   template(sun_net_www_ParseUtil,                     "sun/net/www/ParseUtil")                    \
+  template(jdk_internal_module_ArchivedModuleGraph,   "jdk/internal/module/ArchivedModuleGraph")  \
                                                                                                   \
   template(jdk_internal_loader_ClassLoaders_AppClassLoader,      "jdk/internal/loader/ClassLoaders$AppClassLoader")      \
   template(jdk_internal_loader_ClassLoaders_PlatformClassLoader, "jdk/internal/loader/ClassLoaders$PlatformClassLoader") \
@@ -652,6 +653,8 @@
   template(url_void_signature,                     "(Ljava/net/URL;)V")                                           \
   template(toFileURL_name,                         "toFileURL")                                                   \
   template(toFileURL_signature,                    "(Ljava/lang/String;)Ljava/net/URL;")                          \
+  template(moduleFinder_signature,                 "Ljava/lang/module/ModuleFinder;")                             \
+  template(systemModules_signature,                "Ljdk/internal/module/SystemModules;")                         \
                                                                                                                   \
   /*end*/
 
--- a/src/hotspot/share/gc/shared/barrierSet.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/barrierSet.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -199,7 +199,7 @@
 
     template <typename T>
     static T atomic_cmpxchg_in_heap_at(T new_value, oop base, ptrdiff_t offset, T compare_value) {
-      return Raw::oop_atomic_cmpxchg_at(new_value, base, offset, compare_value);
+      return Raw::atomic_cmpxchg_at(new_value, base, offset, compare_value);
     }
 
     template <typename T>
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -45,47 +45,47 @@
 #include "utilities/ostream.hpp"
 #include "utilities/spinYield.hpp"
 
-OopStorage::AllocateEntry::AllocateEntry() : _prev(NULL), _next(NULL) {}
+OopStorage::AllocationListEntry::AllocationListEntry() : _prev(NULL), _next(NULL) {}
 
-OopStorage::AllocateEntry::~AllocateEntry() {
+OopStorage::AllocationListEntry::~AllocationListEntry() {
   assert(_prev == NULL, "deleting attached block");
   assert(_next == NULL, "deleting attached block");
 }
 
-OopStorage::AllocateList::AllocateList() : _head(NULL), _tail(NULL) {}
+OopStorage::AllocationList::AllocationList() : _head(NULL), _tail(NULL) {}
 
-OopStorage::AllocateList::~AllocateList() {
+OopStorage::AllocationList::~AllocationList() {
   // ~OopStorage() empties its lists before destroying them.
   assert(_head == NULL, "deleting non-empty block list");
   assert(_tail == NULL, "deleting non-empty block list");
 }
 
-void OopStorage::AllocateList::push_front(const Block& block) {
+void OopStorage::AllocationList::push_front(const Block& block) {
   const Block* old = _head;
   if (old == NULL) {
     assert(_tail == NULL, "invariant");
     _head = _tail = &block;
   } else {
-    block.allocate_entry()._next = old;
-    old->allocate_entry()._prev = &block;
+    block.allocation_list_entry()._next = old;
+    old->allocation_list_entry()._prev = &block;
     _head = &block;
   }
 }
 
-void OopStorage::AllocateList::push_back(const Block& block) {
+void OopStorage::AllocationList::push_back(const Block& block) {
   const Block* old = _tail;
   if (old == NULL) {
     assert(_head == NULL, "invariant");
     _head = _tail = &block;
   } else {
-    old->allocate_entry()._next = &block;
-    block.allocate_entry()._prev = old;
+    old->allocation_list_entry()._next = &block;
+    block.allocation_list_entry()._prev = old;
     _tail = &block;
   }
 }
 
-void OopStorage::AllocateList::unlink(const Block& block) {
-  const AllocateEntry& block_entry = block.allocate_entry();
+void OopStorage::AllocationList::unlink(const Block& block) {
+  const AllocationListEntry& block_entry = block.allocation_list_entry();
   const Block* prev_blk = block_entry._prev;
   const Block* next_blk = block_entry._next;
   block_entry._prev = NULL;
@@ -96,15 +96,15 @@
     _head = _tail = NULL;
   } else if (prev_blk == NULL) {
     assert(_head == &block, "invariant");
-    next_blk->allocate_entry()._prev = NULL;
+    next_blk->allocation_list_entry()._prev = NULL;
     _head = next_blk;
   } else if (next_blk == NULL) {
     assert(_tail == &block, "invariant");
-    prev_blk->allocate_entry()._next = NULL;
+    prev_blk->allocation_list_entry()._next = NULL;
     _tail = prev_blk;
   } else {
-    next_blk->allocate_entry()._prev = prev_blk;
-    prev_blk->allocate_entry()._next = next_blk;
+    next_blk->allocation_list_entry()._prev = prev_blk;
+    prev_blk->allocation_list_entry()._next = next_blk;
   }
 }
 
@@ -210,7 +210,7 @@
   _owner(owner),
   _memory(memory),
   _active_index(0),
-  _allocate_entry(),
+  _allocation_list_entry(),
   _deferred_updates_next(NULL),
   _release_refcount(0)
 {
@@ -367,65 +367,65 @@
 //////////////////////////////////////////////////////////////////////////////
 // Allocation
 //
-// Allocation involves the _allocate_list, which contains a subset of the
+// Allocation involves the _allocation_list, which contains a subset of the
 // blocks owned by a storage object.  This is a doubly-linked list, linked
 // through dedicated fields in the blocks.  Full blocks are removed from this
 // list, though they are still present in the _active_array.  Empty blocks are
-// kept at the end of the _allocate_list, to make it easy for empty block
+// kept at the end of the _allocation_list, to make it easy for empty block
 // deletion to find them.
 //
 // allocate(), and delete_empty_blocks_concurrent() lock the
-// _allocate_mutex while performing any list and array modifications.
+// _allocation_mutex while performing any list and array modifications.
 //
 // allocate() and release() update a block's _allocated_bitmask using CAS
 // loops.  This prevents loss of updates even though release() performs
 // its updates without any locking.
 //
-// allocate() obtains the entry from the first block in the _allocate_list,
+// allocate() obtains the entry from the first block in the _allocation_list,
 // and updates that block's _allocated_bitmask to indicate the entry is in
 // use.  If this makes the block full (all entries in use), the block is
-// removed from the _allocate_list so it won't be considered by future
+// removed from the _allocation_list so it won't be considered by future
 // allocations until some entries in it are released.
 //
 // release() is performed lock-free. release() first looks up the block for
 // the entry, using address alignment to find the enclosing block (thereby
 // avoiding iteration over the _active_array).  Once the block has been
 // determined, its _allocated_bitmask needs to be updated, and its position in
-// the _allocate_list may need to be updated.  There are two cases:
+// the _allocation_list may need to be updated.  There are two cases:
 //
 // (a) If the block is neither full nor would become empty with the release of
 // the entry, only its _allocated_bitmask needs to be updated.  But if the CAS
 // update fails, the applicable case may change for the retry.
 //
-// (b) Otherwise, the _allocate_list also needs to be modified.  This requires
-// locking the _allocate_mutex.  To keep the release() operation lock-free,
-// rather than updating the _allocate_list itself, it instead performs a
+// (b) Otherwise, the _allocation_list also needs to be modified.  This requires
+// locking the _allocation_mutex.  To keep the release() operation lock-free,
+// rather than updating the _allocation_list itself, it instead performs a
 // lock-free push of the block onto the _deferred_updates list.  Entries on
 // that list are processed by allocate() and delete_empty_blocks_XXX(), while
 // they already hold the necessary lock.  That processing makes the block's
 // list state consistent with its current _allocated_bitmask.  The block is
-// added to the _allocate_list if not already present and the bitmask is not
-// full.  The block is moved to the end of the _allocated_list if the bitmask
+// added to the _allocation_list if not already present and the bitmask is not
+// full.  The block is moved to the end of the _allocation_list if the bitmask
 // is empty, for ease of empty block deletion processing.
 
 oop* OopStorage::allocate() {
-  MutexLockerEx ml(_allocate_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
   // Do some deferred update processing every time we allocate.
-  // Continue processing deferred updates if _allocate_list is empty,
+  // Continue processing deferred updates if _allocation_list is empty,
   // in the hope that we'll get a block from that, rather than
   // allocating a new block.
-  while (reduce_deferred_updates() && (_allocate_list.head() == NULL)) {}
+  while (reduce_deferred_updates() && (_allocation_list.head() == NULL)) {}
 
-  // Use the first block in _allocate_list for the allocation.
-  Block* block = _allocate_list.head();
+  // Use the first block in _allocation_list for the allocation.
+  Block* block = _allocation_list.head();
   if (block == NULL) {
     // No available blocks; make a new one, and add to storage.
     {
-      MutexUnlockerEx mul(_allocate_mutex, Mutex::_no_safepoint_check_flag);
+      MutexUnlockerEx mul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
       block = Block::new_block(this);
     }
     if (block == NULL) {
-      while (_allocate_list.head() == NULL) {
+      while (_allocation_list.head() == NULL) {
         if (!reduce_deferred_updates()) {
           // Failed to make new block, no other thread made a block
           // available while the mutex was released, and didn't get
@@ -448,13 +448,13 @@
           return NULL;
         }
       }
-      // Add to end of _allocate_list.  The mutex release allowed
-      // other threads to add blocks to the _allocate_list.  We prefer
+      // Add to end of _allocation_list.  The mutex release allowed
+      // other threads to add blocks to the _allocation_list.  We prefer
       // to allocate from non-empty blocks, to allow empty blocks to
       // be deleted.
-      _allocate_list.push_back(*block);
+      _allocation_list.push_back(*block);
     }
-    block = _allocate_list.head();
+    block = _allocation_list.head();
   }
   // Allocate from first block.
   assert(block != NULL, "invariant");
@@ -471,7 +471,7 @@
     // Transitioning from not full to full.
     // Remove full blocks from consideration by future allocates.
     log_debug(oopstorage, blocks)("%s: block full " PTR_FORMAT, name(), p2i(block));
-    _allocate_list.unlink(*block);
+    _allocation_list.unlink(*block);
   }
   log_info(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result));
   return result;
@@ -482,7 +482,7 @@
 // Return true if the array was successfully expanded, false to
 // indicate allocation failure.
 bool OopStorage::expand_active_array() {
-  assert_lock_strong(_allocate_mutex);
+  assert_lock_strong(_allocation_mutex);
   ActiveArray* old_array = _active_array;
   size_t new_size = 2 * old_array->size();
   log_info(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT,
@@ -632,7 +632,7 @@
   // (updated bitmask is empty or old bitmask was full), atomically push
   // this block onto the deferred updates list.  Some future call to
   // reduce_deferred_updates will make any needed changes related to this
-  // block and _allocate_list.  This deferral avoids list updates and the
+  // block and _allocation_list.  This deferral avoids list updates and the
   // associated locking here.
   if ((releasing == old_allocated) || is_full_bitmask(old_allocated)) {
     // Log transitions.  Both transitions are possible in a single update.
@@ -663,7 +663,7 @@
 
 // Process one available deferred update.  Returns true if one was processed.
 bool OopStorage::reduce_deferred_updates() {
-  assert_locked_or_safepoint(_allocate_mutex);
+  assert_locked_or_safepoint(_allocation_mutex);
   // Atomically pop a block off the list, if any available.
   // No ABA issue because this is only called by one thread at a time.
   // The atomicity is wrto pushes by release().
@@ -687,20 +687,20 @@
   uintx allocated = block->allocated_bitmask();
 
   // Make membership in list consistent with bitmask state.
-  if ((_allocate_list.ctail() != NULL) &&
-      ((_allocate_list.ctail() == block) ||
-       (_allocate_list.next(*block) != NULL))) {
-    // Block is in the allocate list.
+  if ((_allocation_list.ctail() != NULL) &&
+      ((_allocation_list.ctail() == block) ||
+       (_allocation_list.next(*block) != NULL))) {
+    // Block is in the _allocation_list.
     assert(!is_full_bitmask(allocated), "invariant");
   } else if (!is_full_bitmask(allocated)) {
-    // Block is not in the allocate list, but now should be.
-    _allocate_list.push_front(*block);
+    // Block is not in the _allocation_list, but now should be.
+    _allocation_list.push_front(*block);
   } // Else block is full and not in list, which is correct.
 
   // Move empty block to end of list, for possible deletion.
   if (is_empty_bitmask(allocated)) {
-    _allocate_list.unlink(*block);
-    _allocate_list.push_back(*block);
+    _allocation_list.unlink(*block);
+    _allocation_list.push_back(*block);
   }
 
   log_debug(oopstorage, blocks)("%s: processed deferred update " PTR_FORMAT,
@@ -759,24 +759,24 @@
 const size_t initial_active_array_size = 8;
 
 OopStorage::OopStorage(const char* name,
-                       Mutex* allocate_mutex,
+                       Mutex* allocation_mutex,
                        Mutex* active_mutex) :
   _name(dup_name(name)),
   _active_array(ActiveArray::create(initial_active_array_size)),
-  _allocate_list(),
+  _allocation_list(),
   _deferred_updates(NULL),
-  _allocate_mutex(allocate_mutex),
+  _allocation_mutex(allocation_mutex),
   _active_mutex(active_mutex),
   _allocation_count(0),
   _concurrent_iteration_active(false)
 {
   _active_array->increment_refcount();
-  assert(_active_mutex->rank() < _allocate_mutex->rank(),
-         "%s: active_mutex must have lower rank than allocate_mutex", _name);
+  assert(_active_mutex->rank() < _allocation_mutex->rank(),
+         "%s: active_mutex must have lower rank than allocation_mutex", _name);
   assert(_active_mutex->_safepoint_check_required != Mutex::_safepoint_check_always,
          "%s: active mutex requires safepoint check", _name);
-  assert(_allocate_mutex->_safepoint_check_required != Mutex::_safepoint_check_always,
-         "%s: allocate mutex requires safepoint check", _name);
+  assert(_allocation_mutex->_safepoint_check_required != Mutex::_safepoint_check_always,
+         "%s: allocation mutex requires safepoint check", _name);
 }
 
 void OopStorage::delete_empty_block(const Block& block) {
@@ -791,8 +791,8 @@
     _deferred_updates = block->deferred_updates_next();
     block->set_deferred_updates_next(NULL);
   }
-  while ((block = _allocate_list.head()) != NULL) {
-    _allocate_list.unlink(*block);
+  while ((block = _allocation_list.head()) != NULL) {
+    _allocation_list.unlink(*block);
   }
   bool unreferenced = _active_array->decrement_refcount();
   assert(unreferenced, "deleting storage while _active_array is referenced");
@@ -811,18 +811,18 @@
   while (reduce_deferred_updates()) {}
   // Don't interfere with a concurrent iteration.
   if (_concurrent_iteration_active) return;
-  // Delete empty (and otherwise deletable) blocks from end of _allocate_list.
-  for (Block* block = _allocate_list.tail();
+  // Delete empty (and otherwise deletable) blocks from end of _allocation_list.
+  for (Block* block = _allocation_list.tail();
        (block != NULL) && block->is_deletable();
-       block = _allocate_list.tail()) {
+       block = _allocation_list.tail()) {
     _active_array->remove(block);
-    _allocate_list.unlink(*block);
+    _allocation_list.unlink(*block);
     delete_empty_block(*block);
   }
 }
 
 void OopStorage::delete_empty_blocks_concurrent() {
-  MutexLockerEx ml(_allocate_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
   // Other threads could be adding to the empty block count while we
   // release the mutex across the block deletions.  Set an upper bound
   // on how many blocks we'll try to release, so other threads can't
@@ -834,7 +834,7 @@
     // lock.  But limit number processed to limit lock duration.
     reduce_deferred_updates();
 
-    Block* block = _allocate_list.tail();
+    Block* block = _allocation_list.tail();
     if ((block == NULL) || !block->is_deletable()) {
       // No block to delete, so done.  There could be more pending
       // deferred updates that could give us more work to do; deal with
@@ -848,10 +848,10 @@
       if (_concurrent_iteration_active) return;
       _active_array->remove(block);
     }
-    // Remove block from _allocate_list and delete it.
-    _allocate_list.unlink(*block);
+    // Remove block from _allocation_list and delete it.
+    _allocation_list.unlink(*block);
     // Release mutex while deleting block.
-    MutexUnlockerEx ul(_allocate_mutex, Mutex::_no_safepoint_check_flag);
+    MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
     delete_empty_block(*block);
   }
 }
@@ -860,7 +860,7 @@
   const Block* block = find_block_or_null(ptr);
   if (block != NULL) {
     // Prevent block deletion and _active_array modification.
-    MutexLockerEx ml(_allocate_mutex, Mutex::_no_safepoint_check_flag);
+    MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
     // Block could be a false positive, so get index carefully.
     size_t index = Block::active_index_safe(block);
     if ((index < _active_array->block_count()) &&
--- a/src/hotspot/share/gc/shared/oopStorage.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -73,7 +73,7 @@
 
 class OopStorage : public CHeapObj<mtGC> {
 public:
-  OopStorage(const char* name, Mutex* allocate_mutex, Mutex* active_mutex);
+  OopStorage(const char* name, Mutex* allocation_mutex, Mutex* active_mutex);
   ~OopStorage();
 
   // These count and usage accessors are racy unless at a safepoint.
@@ -94,12 +94,12 @@
     ALLOCATED_ENTRY
   };
 
-  // Locks _allocate_mutex.
+  // Locks _allocation_mutex.
   // precondition: ptr != NULL.
   EntryStatus allocation_status(const oop* ptr) const;
 
   // Allocates and returns a new entry.  Returns NULL if memory allocation
-  // failed.  Locks _allocate_mutex.
+  // failed.  Locks _allocation_mutex.
   // postcondition: *result == NULL.
   oop* allocate();
 
@@ -152,7 +152,7 @@
 
   // Block cleanup functions are for the exclusive use of the GC.
   // Both stop deleting if there is an in-progress concurrent iteration.
-  // Concurrent deletion locks both the allocate_mutex and the active_mutex.
+  // Concurrent deletion locks both the _allocation_mutex and the _active_mutex.
   void delete_empty_blocks_safepoint();
   void delete_empty_blocks_concurrent();
 
@@ -172,20 +172,20 @@
 NOT_AIX( private: )
   class Block;                  // Fixed-size array of oops, plus bookkeeping.
   class ActiveArray;            // Array of Blocks, plus bookkeeping.
-  class AllocateEntry;          // Provides AllocateList links in a Block.
+  class AllocationListEntry;    // Provides AllocationList links in a Block.
 
   // Doubly-linked list of Blocks.
-  class AllocateList {
+  class AllocationList {
     const Block* _head;
     const Block* _tail;
 
     // Noncopyable.
-    AllocateList(const AllocateList&);
-    AllocateList& operator=(const AllocateList&);
+    AllocationList(const AllocationList&);
+    AllocationList& operator=(const AllocationList&);
 
   public:
-    AllocateList();
-    ~AllocateList();
+    AllocationList();
+    ~AllocationList();
 
     Block* head();
     Block* tail();
@@ -219,10 +219,10 @@
 private:
   const char* _name;
   ActiveArray* _active_array;
-  AllocateList _allocate_list;
+  AllocationList _allocation_list;
   Block* volatile _deferred_updates;
 
-  Mutex* _allocate_mutex;
+  Mutex* _allocation_mutex;
   Mutex* _active_mutex;
 
   // Volatile for racy unlocked accesses.
--- a/src/hotspot/share/gc/shared/oopStorage.inline.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.inline.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -107,10 +107,10 @@
   return *block_ptr(index);
 }
 
-// A Block has an embedded AllocateEntry to provide the links between
-// Blocks in a AllocateList.
-class OopStorage::AllocateEntry {
-  friend class OopStorage::AllocateList;
+// A Block has an embedded AllocationListEntry to provide the links between
+// Blocks in an AllocationList.
+class OopStorage::AllocationListEntry {
+  friend class OopStorage::AllocationList;
 
   // Members are mutable, and we deal exclusively with pointers to
   // const, to make const blocks easier to use; a block being const
@@ -119,18 +119,18 @@
   mutable const Block* _next;
 
   // Noncopyable.
-  AllocateEntry(const AllocateEntry&);
-  AllocateEntry& operator=(const AllocateEntry&);
+  AllocationListEntry(const AllocationListEntry&);
+  AllocationListEntry& operator=(const AllocationListEntry&);
 
 public:
-  AllocateEntry();
-  ~AllocateEntry();
+  AllocationListEntry();
+  ~AllocationListEntry();
 };
 
 // Fixed-sized array of oops, plus bookkeeping data.
 // All blocks are in the storage's _active_array, at the block's _active_index.
-// Non-full blocks are in the storage's _allocate_list, linked through the
-// block's _allocate_entry.  Empty blocks are at the end of that list.
+// Non-full blocks are in the storage's _allocation_list, linked through the
+// block's _allocation_list_entry.  Empty blocks are at the end of that list.
 class OopStorage::Block /* No base class, to avoid messing up alignment. */ {
   // _data must be the first non-static data member, for alignment.
   oop _data[BitsPerWord];
@@ -140,7 +140,7 @@
   const OopStorage* _owner;
   void* _memory;              // Unaligned storage containing block.
   size_t _active_index;
-  AllocateEntry _allocate_entry;
+  AllocationListEntry _allocation_list_entry;
   Block* volatile _deferred_updates_next;
   volatile uintx _release_refcount;
 
@@ -158,7 +158,7 @@
   Block& operator=(const Block&);
 
 public:
-  const AllocateEntry& allocate_entry() const;
+  const AllocationListEntry& allocation_list_entry() const;
 
   static size_t allocation_size();
   static size_t allocation_alignment_shift();
@@ -197,36 +197,36 @@
   template<typename F> bool iterate(F f) const;
 }; // class Block
 
-inline OopStorage::Block* OopStorage::AllocateList::head() {
+inline OopStorage::Block* OopStorage::AllocationList::head() {
   return const_cast<Block*>(_head);
 }
 
-inline OopStorage::Block* OopStorage::AllocateList::tail() {
+inline OopStorage::Block* OopStorage::AllocationList::tail() {
   return const_cast<Block*>(_tail);
 }
 
-inline const OopStorage::Block* OopStorage::AllocateList::chead() const {
+inline const OopStorage::Block* OopStorage::AllocationList::chead() const {
   return _head;
 }
 
-inline const OopStorage::Block* OopStorage::AllocateList::ctail() const {
+inline const OopStorage::Block* OopStorage::AllocationList::ctail() const {
   return _tail;
 }
 
-inline OopStorage::Block* OopStorage::AllocateList::prev(Block& block) {
-  return const_cast<Block*>(block.allocate_entry()._prev);
+inline OopStorage::Block* OopStorage::AllocationList::prev(Block& block) {
+  return const_cast<Block*>(block.allocation_list_entry()._prev);
 }
 
-inline OopStorage::Block* OopStorage::AllocateList::next(Block& block) {
-  return const_cast<Block*>(block.allocate_entry()._next);
+inline OopStorage::Block* OopStorage::AllocationList::next(Block& block) {
+  return const_cast<Block*>(block.allocation_list_entry()._next);
 }
 
-inline const OopStorage::Block* OopStorage::AllocateList::prev(const Block& block) const {
-  return block.allocate_entry()._prev;
+inline const OopStorage::Block* OopStorage::AllocationList::prev(const Block& block) const {
+  return block.allocation_list_entry()._prev;
 }
 
-inline const OopStorage::Block* OopStorage::AllocateList::next(const Block& block) const {
-  return block.allocate_entry()._next;
+inline const OopStorage::Block* OopStorage::AllocationList::next(const Block& block) const {
+  return block.allocation_list_entry()._next;
 }
 
 template<typename Closure>
@@ -298,8 +298,8 @@
 
 // Inline Block accesses for use in iteration loops.
 
-inline const OopStorage::AllocateEntry& OopStorage::Block::allocate_entry() const {
-  return _allocate_entry;
+inline const OopStorage::AllocationListEntry& OopStorage::Block::allocation_list_entry() const {
+  return _allocation_list_entry;
 }
 
 inline void OopStorage::Block::check_index(unsigned index) const {
--- a/src/hotspot/share/gc/shared/oopStorageParState.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorageParState.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -52,7 +52,7 @@
 // interfering with with each other.
 //
 // Both allocate() and delete_empty_blocks_concurrent() lock the
-// _allocate_mutex while performing their respective list and array
+// _allocation_mutex while performing their respective list and array
 // manipulations, preventing them from interfering with each other.
 //
 // When allocate() creates a new block, it is added to the end of the
--- a/src/hotspot/share/gc/shared/taskqueue.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -61,10 +61,11 @@
 public:
   inline TaskQueueStats()       { reset(); }
 
-  inline void record_push()     { ++_stats[push]; }
-  inline void record_pop()      { ++_stats[pop]; }
-  inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
-  inline void record_steal(bool success);
+  inline void record_push()          { ++_stats[push]; }
+  inline void record_pop()           { ++_stats[pop]; }
+  inline void record_pop_slow()      { record_pop(); ++_stats[pop_slow]; }
+  inline void record_steal_attempt() { ++_stats[steal_attempt]; }
+  inline void record_steal()         { ++_stats[steal]; }
   inline void record_overflow(size_t new_length);
 
   TaskQueueStats & operator +=(const TaskQueueStats & addend);
@@ -87,11 +88,6 @@
   static const char * const _names[last_stat_id];
 };
 
-void TaskQueueStats::record_steal(bool success) {
-  ++_stats[steal_attempt];
-  if (success) ++_stats[steal];
-}
-
 void TaskQueueStats::record_overflow(size_t new_len) {
   ++_stats[overflow];
   if (new_len > _stats[overflow_max_len]) _stats[overflow_max_len] = new_len;
@@ -364,18 +360,19 @@
 
 template<class T, MEMFLAGS F>
 class GenericTaskQueueSet: public TaskQueueSetSuperImpl<F> {
+public:
+  typedef typename T::element_type E;
+
 private:
   uint _n;
   T** _queues;
 
+  bool steal_best_of_2(uint queue_num, int* seed, E& t);
+
 public:
-  typedef typename T::element_type E;
-
   GenericTaskQueueSet(int n);
   ~GenericTaskQueueSet();
 
-  bool steal_best_of_2(uint queue_num, int* seed, E& t);
-
   void register_queue(uint i, T* q);
 
   T* queue(uint n);
--- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -252,12 +252,12 @@
 template<class T, MEMFLAGS F> bool
 GenericTaskQueueSet<T, F>::steal(uint queue_num, int* seed, E& t) {
   for (uint i = 0; i < 2 * _n; i++) {
+    TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal_attempt());
     if (steal_best_of_2(queue_num, seed, t)) {
-      TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(true));
+      TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal());
       return true;
     }
   }
-  TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(false));
   return false;
 }
 
--- a/src/hotspot/share/include/jvm.h	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/include/jvm.h	Thu Jul 12 13:04:33 2018 -0700
@@ -171,6 +171,8 @@
 JNIEXPORT jobjectArray JNICALL
 JVM_GetVmArguments(JNIEnv *env);
 
+JNIEXPORT void JNICALL
+JVM_InitializeFromArchive(JNIEnv* env, jclass cls);
 
 /*
  * java.lang.Throwable
--- a/src/hotspot/share/interpreter/linkResolver.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -1221,17 +1221,14 @@
       // check if the method is not <init>
       resolved_method->name() != vmSymbols::object_initializer_name()) {
 
-     // check if this is an old-style super call and do a new lookup if so
-     // a) check if ACC_SUPER flag is set for the current class
     Klass* current_klass = link_info.current_klass();
-    if ((current_klass->is_super() || !AllowNonVirtualCalls) &&
-        // b) check if the class of the resolved_klass is a superclass
-        // (not supertype in order to exclude interface classes) of the current class.
-        // This check is not performed for super.invoke for interface methods
-        // in super interfaces.
-        current_klass->is_subclass_of(resolved_klass) &&
-        current_klass != resolved_klass
-        ) {
+
+    // Check if the class of the resolved_klass is a superclass
+    // (not supertype in order to exclude interface classes) of the current class.
+    // This check is not performed for super.invoke for interface methods
+    // in super interfaces.
+    if (current_klass->is_subclass_of(resolved_klass) &&
+        current_klass != resolved_klass) {
       // Lookup super method
       Klass* super_klass = current_klass->super();
       sel_method = lookup_instance_method_in_klasses(super_klass,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/memory/heapShared.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,506 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/javaClasses.inline.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
+#include "logging/logMessage.hpp"
+#include "logging/logStream.hpp"
+#include "memory/heapShared.hpp"
+#include "memory/iterator.inline.hpp"
+#include "memory/metadataFactory.hpp"
+#include "memory/metaspaceClosure.hpp"
+#include "memory/metaspaceShared.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/compressedOops.inline.hpp"
+#include "oops/oop.inline.hpp"
+
+#if INCLUDE_CDS_JAVA_HEAP
+KlassSubGraphInfo* HeapShared::_subgraph_info_list = NULL;
+int HeapShared::_num_archived_subgraph_info_records = 0;
+Array<ArchivedKlassSubGraphInfoRecord>* HeapShared::_archived_subgraph_info_records = NULL;
+
+// Currently there is only one class mirror (ArchivedModuleGraph) with archived
+// sub-graphs.
+KlassSubGraphInfo* HeapShared::find_subgraph_info(Klass* k) {
+  KlassSubGraphInfo* info = _subgraph_info_list;
+  while (info != NULL) {
+    if (info->klass() == k) {
+      return info;
+    }
+    info = info->next();
+  }
+  return NULL;
+}
+
+// Get the subgraph_info for Klass k. A new subgraph_info is created if
+// there is no existing one for k. The subgraph_info records the relocated
+// Klass* of the original k.
+KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
+  Klass* relocated_k = MetaspaceShared::get_relocated_klass(k);
+  KlassSubGraphInfo* info = find_subgraph_info(relocated_k);
+  if (info != NULL) {
+    return info;
+  }
+
+  info = new KlassSubGraphInfo(relocated_k, _subgraph_info_list);
+  _subgraph_info_list = info;
+  return info;
+}
+
+int HeapShared::num_of_subgraph_infos() {
+  int num = 0;
+  KlassSubGraphInfo* info = _subgraph_info_list;
+  while (info != NULL) {
+    num ++;
+    info = info->next();
+  }
+  return num;
+}
+
+// Add an entry field to the current KlassSubGraphInfo.
+void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) {
+  assert(DumpSharedSpaces, "dump time only");
+  if (_subgraph_entry_fields == NULL) {
+    _subgraph_entry_fields =
+      new(ResourceObj::C_HEAP, mtClass) GrowableArray<juint>(10, true);
+  }
+  _subgraph_entry_fields->append((juint)static_field_offset);
+  _subgraph_entry_fields->append(CompressedOops::encode(v));
+}
+
+// Add the Klass* for an object in the current KlassSubGraphInfo's subgraphs.
+// Only objects of boot classes can be included in sub-graph.
+void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k, Klass *relocated_k) {
+  assert(DumpSharedSpaces, "dump time only");
+  assert(relocated_k == MetaspaceShared::get_relocated_klass(orig_k),
+         "must be the relocated Klass in the shared space");
+
+  if (_subgraph_object_klasses == NULL) {
+    _subgraph_object_klasses =
+      new(ResourceObj::C_HEAP, mtClass) GrowableArray<Klass*>(50, true);
+  }
+
+  assert(relocated_k->is_shared(), "must be a shared class");
+  if (relocated_k->is_instance_klass()) {
+    assert(InstanceKlass::cast(relocated_k)->is_shared_boot_class(),
+          "must be boot class");
+    // SystemDictionary::xxx_klass() are not updated, need to check
+    // the original Klass*
+    if (orig_k == SystemDictionary::String_klass() ||
+        orig_k == SystemDictionary::Object_klass()) {
+      // Initialized early during VM initialization. No need to be added
+      // to the sub-graph object class list.
+      return;
+    }
+  } else if (relocated_k->is_objArray_klass()) {
+    Klass* abk = ObjArrayKlass::cast(relocated_k)->bottom_klass();
+    if (abk->is_instance_klass()) {
+      assert(InstanceKlass::cast(abk)->is_shared_boot_class(),
+            "must be boot class");
+    }
+    if (relocated_k == Universe::objectArrayKlassObj()) {
+      // Initialized early during Universe::genesis. No need to be added
+      // to the list.
+      return;
+    }
+  } else {
+    assert(relocated_k->is_typeArray_klass(), "must be");
+    // Primitive type arrays are created early during Universe::genesis.
+    return;
+  }
+
+  _subgraph_object_klasses->append_if_missing(relocated_k);
+}
+
+// Initialize an archived subgraph_info_record from the given KlassSubGraphInfo.
+void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
+  _k = info->klass();
+  _next = NULL;
+  _entry_field_records = NULL;
+  _subgraph_klasses = NULL;
+
+  // populate the entry fields
+  GrowableArray<juint>* entry_fields = info->subgraph_entry_fields();
+  if (entry_fields != NULL) {
+    int num_entry_fields = entry_fields->length();
+    assert(num_entry_fields % 2 == 0, "sanity");
+    _entry_field_records =
+      MetaspaceShared::new_ro_array<juint>(num_entry_fields);
+    for (int i = 0 ; i < num_entry_fields; i++) {
+      _entry_field_records->at_put(i, entry_fields->at(i));
+    }
+  }
+
+  // the Klasses of the objects in the sub-graphs
+  GrowableArray<Klass*>* subgraph_klasses = info->subgraph_object_klasses();
+  if (subgraph_klasses != NULL) {
+    int num_subgraphs_klasses = subgraph_klasses->length();
+    _subgraph_klasses =
+      MetaspaceShared::new_ro_array<Klass*>(num_subgraphs_klasses);
+    for (int i = 0; i < num_subgraphs_klasses; i++) {
+      Klass* subgraph_k = subgraph_klasses->at(i);
+      if (log_is_enabled(Info, cds, heap)) {
+        ResourceMark rm;
+        log_info(cds, heap)(
+          "Archived object klass (%d): %s in %s sub-graphs",
+          i, subgraph_k->external_name(), _k->external_name());
+      }
+      _subgraph_klasses->at_put(i, subgraph_k);
+    }
+  }
+}
+
+// Build the records of archived subgraph infos, which include:
+// - Entry points to all subgraphs from the containing class mirror. The entry
+//   points are static fields in the mirror. For each entry point, the field
+//   offset and value are recorded in the sub-graph info. The value are stored
+//   back to the corresponding field at runtime.
+// - A list of klasses that need to be loaded/initialized before archived
+//   java object sub-graph can be accessed at runtime.
+//
+// The records are saved in the archive file and reloaded at runtime. Currently
+// there is only one class mirror (ArchivedModuleGraph) with archived sub-graphs.
+//
+// Layout of the archived subgraph info records:
+//
+// records_size | num_records | records*
+// ArchivedKlassSubGraphInfoRecord | entry_fields | subgraph_object_klasses
+size_t HeapShared::build_archived_subgraph_info_records(int num_records) {
+  // remember the start address
+  char* start_p = MetaspaceShared::read_only_space_top();
+
+  // now populate the archived subgraph infos, which will be saved in the
+  // archive file
+  _archived_subgraph_info_records =
+    MetaspaceShared::new_ro_array<ArchivedKlassSubGraphInfoRecord>(num_records);
+  KlassSubGraphInfo* info = _subgraph_info_list;
+  int i = 0;
+  while (info != NULL) {
+    assert(i < _archived_subgraph_info_records->length(), "sanity");
+    ArchivedKlassSubGraphInfoRecord* record =
+      _archived_subgraph_info_records->adr_at(i);
+    record->init(info);
+    info = info->next();
+    i ++;
+  }
+
+  // _subgraph_info_list is no longer needed
+  delete _subgraph_info_list;
+  _subgraph_info_list = NULL;
+
+  char* end_p = MetaspaceShared::read_only_space_top();
+  size_t records_size = end_p - start_p;
+  return records_size;
+}
+
+// Write the subgraph info records in the shared _ro region
+void HeapShared::write_archived_subgraph_infos() {
+  assert(DumpSharedSpaces, "dump time only");
+
+  Array<intptr_t>* records_header = MetaspaceShared::new_ro_array<intptr_t>(3);
+
+  _num_archived_subgraph_info_records = num_of_subgraph_infos();
+  size_t records_size = build_archived_subgraph_info_records(
+                             _num_archived_subgraph_info_records);
+
+  // Now write the header information:
+  // records_size, num_records, _archived_subgraph_info_records
+  assert(records_header != NULL, "sanity");
+  intptr_t* p = (intptr_t*)(records_header->data());
+  *p = (intptr_t)records_size;
+  p ++;
+  *p = (intptr_t)_num_archived_subgraph_info_records;
+  p ++;
+  *p = (intptr_t)_archived_subgraph_info_records;
+}
+
+char* HeapShared::read_archived_subgraph_infos(char* buffer) {
+  Array<intptr_t>* records_header = (Array<intptr_t>*)buffer;
+  intptr_t* p = (intptr_t*)(records_header->data());
+  size_t records_size = (size_t)(*p);
+  p ++;
+  _num_archived_subgraph_info_records = *p;
+  p ++;
+  _archived_subgraph_info_records =
+    (Array<ArchivedKlassSubGraphInfoRecord>*)(*p);
+
+  buffer = (char*)_archived_subgraph_info_records + records_size;
+  return buffer;
+}
+
+void HeapShared::initialize_from_archived_subgraph(Klass* k) {
+  if (!MetaspaceShared::open_archive_heap_region_mapped()) {
+    return; // nothing to do
+  }
+
+  if (_num_archived_subgraph_info_records == 0) {
+    return; // no subgraph info records
+  }
+
+  // Initialize from archived data. Currently only ArchivedModuleGraph
+  // has archived object subgraphs, which is used during VM initialization
+  // time when bootstraping the system modules. No lock is needed.
+  Thread* THREAD = Thread::current();
+  for (int i = 0; i < _archived_subgraph_info_records->length(); i++) {
+    ArchivedKlassSubGraphInfoRecord* record = _archived_subgraph_info_records->adr_at(i);
+    if (record->klass() == k) {
+      int i;
+      // Found the archived subgraph info record for the requesting klass.
+      // Load/link/initialize the klasses of the objects in the subgraph.
+      // NULL class loader is used.
+      Array<Klass*>* klasses = record->subgraph_klasses();
+      if (klasses != NULL) {
+        for (i = 0; i < klasses->length(); i++) {
+          Klass* obj_k = klasses->at(i);
+          Klass* resolved_k = SystemDictionary::resolve_or_null(
+                                                (obj_k)->name(), THREAD);
+          if (resolved_k != obj_k) {
+            return;
+          }
+          if ((obj_k)->is_instance_klass()) {
+            InstanceKlass* ik = InstanceKlass::cast(obj_k);
+            ik->initialize(THREAD);
+          } else if ((obj_k)->is_objArray_klass()) {
+            ObjArrayKlass* oak = ObjArrayKlass::cast(obj_k);
+            oak->initialize(THREAD);
+          }
+        }
+      }
+
+      if (HAS_PENDING_EXCEPTION) {
+        CLEAR_PENDING_EXCEPTION;
+        // None of the field value will be set if there was an exception.
+        // The java code will not see any of the archived objects in the
+        // subgraphs referenced from k in this case.
+        return;
+      }
+
+      // Load the subgraph entry fields from the record and store them back to
+      // the corresponding fields within the mirror.
+      oop m = k->java_mirror();
+      Array<juint>* entry_field_records = record->entry_field_records();
+      if (entry_field_records != NULL) {
+        int efr_len = entry_field_records->length();
+        assert(efr_len % 2 == 0, "sanity");
+        for (i = 0; i < efr_len;) {
+          int field_offset = entry_field_records->at(i);
+          // The object refereced by the field becomes 'known' by GC from this
+          // point. All objects in the subgraph reachable from the object are
+          // also 'known' by GC.
+          oop v = MetaspaceShared::materialize_archived_object(
+            CompressedOops::decode(entry_field_records->at(i+1)));
+          m->obj_field_put(field_offset, v);
+          i += 2;
+        }
+      }
+
+      // Done. Java code can see the archived sub-graphs referenced from k's
+      // mirror after this point.
+      return;
+    }
+  }
+}
+
+class WalkOopAndArchiveClosure: public BasicOopIterateClosure {
+  int _level;
+  KlassSubGraphInfo* _subgraph_info;
+  oop _orig_referencing_obj;
+  oop _archived_referencing_obj;
+ public:
+  WalkOopAndArchiveClosure(int level, KlassSubGraphInfo* subgraph_info,
+           oop orig, oop archived) : _level(level),
+                                     _subgraph_info(subgraph_info),
+                                     _orig_referencing_obj(orig),
+                                     _archived_referencing_obj(archived) {}
+  void do_oop(narrowOop *p) { WalkOopAndArchiveClosure::do_oop_work(p); }
+  void do_oop(      oop *p) { WalkOopAndArchiveClosure::do_oop_work(p); }
+
+ protected:
+  template <class T> void do_oop_work(T *p) {
+    oop obj = RawAccess<>::oop_load(p);
+    if (!CompressedOops::is_null(obj)) {
+      // A java.lang.Class instance can not be included in an archived
+      // object sub-graph.
+      if (java_lang_Class::is_instance(obj)) {
+        tty->print("Unknown java.lang.Class object is in the archived sub-graph\n");
+        vm_exit(1);
+      }
+
+      LogTarget(Debug, cds, heap) log;
+      LogStream ls(log);
+      outputStream* out = &ls;
+      {
+        ResourceMark rm;
+        log.print("(%d) %s <--- referenced from:  %s",
+                  _level, obj->klass()->external_name(),
+                  CompressedOops::is_null(_orig_referencing_obj) ?
+                         "" : _orig_referencing_obj->klass()->external_name());
+        obj->print_on(out);
+      }
+
+      if (MetaspaceShared::is_archive_object(obj)) {
+        // The current oop is an archived oop, nothing needs to be done
+        log.print("--- object is already archived ---");
+        return;
+      }
+
+      size_t field_delta = pointer_delta(
+        p, _orig_referencing_obj, sizeof(char));
+      T* new_p = (T*)(address(_archived_referencing_obj) + field_delta);
+      oop archived = MetaspaceShared::find_archived_heap_object(obj);
+      if (archived != NULL) {
+        // There is an archived copy existing, update reference to point
+        // to the archived copy
+        RawAccess<IS_NOT_NULL>::oop_store(new_p, archived);
+        log.print(
+          "--- found existing archived copy, store archived " PTR_FORMAT " in " PTR_FORMAT,
+          p2i(archived), p2i(new_p));
+        return;
+      }
+
+      int l = _level + 1;
+      Thread* THREAD = Thread::current();
+      // Archive the current oop before iterating through its references
+      archived = MetaspaceShared::archive_heap_object(obj, THREAD);
+      assert(MetaspaceShared::is_archive_object(archived), "must be archived");
+      log.print("=== archiving oop " PTR_FORMAT " ==> " PTR_FORMAT,
+                 p2i(obj), p2i(archived));
+
+      // Following the references in the current oop and archive any
+      // encountered objects during the process
+      WalkOopAndArchiveClosure walker(l, _subgraph_info, obj, archived);
+      obj->oop_iterate(&walker);
+
+      // Update the reference in the archived copy of the referencing object
+      RawAccess<IS_NOT_NULL>::oop_store(new_p, archived);
+      log.print("=== store archived " PTR_FORMAT " in " PTR_FORMAT,
+                p2i(archived), p2i(new_p));
+
+      // Add the klass to the list of classes that need to be loaded before
+      // module system initialization
+      Klass *orig_k = obj->klass();
+      Klass *relocated_k = archived->klass();
+      _subgraph_info->add_subgraph_object_klass(orig_k, relocated_k);
+    }
+  }
+};
+
+//
+// Start from the given static field in a java mirror and archive the
+// complete sub-graph of java heap objects that are reached directly
+// or indirectly from the starting object by following references.
+// Currently, only ArchivedModuleGraph class instance (mirror) has archived
+// object subgraphs. Sub-graph archiving restrictions (current):
+//
+// - All classes of objects in the archived sub-graph (including the
+//   entry class) must be boot class only.
+// - No java.lang.Class instance (java mirror) can be included inside
+//   an archived sub-graph. Mirror can only be the sub-graph entry object.
+//
+// The Java heap object sub-graph archiving process (see
+// WalkOopAndArchiveClosure):
+//
+// 1) Java object sub-graph archiving starts from a given static field
+// within a Class instance (java mirror). If the static field is a
+// refererence field and points to a non-null java object, proceed to
+// the next step.
+//
+// 2) Archives the referenced java object. If an archived copy of the
+// current object already exists, updates the pointer in the archived
+// copy of the referencing object to point to the current archived object.
+// Otherwise, proceed to the next step.
+//
+// 3) Follows all references within the current java object and recursively
+// archive the sub-graph of objects starting from each reference.
+//
+// 4) Updates the pointer in the archived copy of referencing object to
+//    point to the current archived object.
+//
+// 5) The Klass of the current java object is added to the list of Klasses
+// for loading and initialzing before any object in the archived graph can
+// be accessed at runtime.
+//
+void HeapShared::archive_reachable_objects_from_static_field(Klass *k,
+                                                             int field_offset,
+                                                             BasicType field_type,
+                                                             TRAPS) {
+  assert(DumpSharedSpaces, "dump time only");
+  assert(k->is_instance_klass(), "sanity");
+  assert(InstanceKlass::cast(k)->is_shared_boot_class(),
+         "must be boot class");
+
+  oop m = k->java_mirror();
+  oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+  if (CompressedOops::is_null(archived_m)) {
+    return;
+  }
+
+  if (field_type == T_OBJECT) {
+    // obtain k's subGraph Info
+    KlassSubGraphInfo* subgraph_info = get_subgraph_info(k);
+
+    // get the object referenced by the field
+    oop f = m->obj_field(field_offset);
+    if (!CompressedOops::is_null(f)) {
+      LogTarget(Debug, cds, heap) log;
+      LogStream ls(log);
+      outputStream* out = &ls;
+      log.print("Start from: ");
+      f->print_on(out);
+
+      // get the archived copy of the field referenced object
+      oop af = MetaspaceShared::archive_heap_object(f, THREAD);
+      if (!MetaspaceShared::is_archive_object(f)) {
+        WalkOopAndArchiveClosure walker(1, subgraph_info, f, af);
+        f->oop_iterate(&walker);
+      }
+
+      // The field value is not preserved in the archived mirror.
+      // Record the field as a new subGraph entry point. The recorded
+      // information is restored from the archive at runtime.
+      subgraph_info->add_subgraph_entry_field(field_offset, af);
+      Klass *relocated_k = af->klass();
+      Klass *orig_k = f->klass();
+      subgraph_info->add_subgraph_object_klass(orig_k, relocated_k);
+    } else {
+      // The field contains null, we still need to record the entry point,
+      // so it can be restored at runtime.
+      subgraph_info->add_subgraph_entry_field(field_offset, NULL);
+    }
+  } else {
+    ShouldNotReachHere();
+  }
+}
+
+#define do_module_object_graph(archive_object_graph_do) \
+  archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedSystemModules_offset(), T_OBJECT, CHECK); \
+  archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedModuleFinder_offset(), T_OBJECT, CHECK); \
+  archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedMainModule_offset(), T_OBJECT, CHECK)
+
+void HeapShared::archive_module_graph_objects(Thread* THREAD) {
+  do_module_object_graph(archive_reachable_objects_from_static_field);
+}
+#endif // INCLUDE_CDS_JAVA_HEAP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/memory/heapShared.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
+#define SHARE_VM_MEMORY_HEAPSHARED_HPP
+
+#include "classfile/systemDictionary.hpp"
+#include "memory/universe.hpp"
+#include "oops/objArrayKlass.hpp"
+#include "oops/oop.hpp"
+#include "oops/typeArrayKlass.hpp"
+#include "utilities/growableArray.hpp"
+
+#if INCLUDE_CDS_JAVA_HEAP
+// A dump time sub-graph info for Klass _k. It includes the entry points
+// (static fields in _k's mirror) of the archived sub-graphs reachable
+// from _k's mirror. It also contains a list of Klasses of the objects
+// within the sub-graphs.
+class KlassSubGraphInfo: public CHeapObj<mtClass> {
+ private:
+  KlassSubGraphInfo* _next;
+  // The class that contains the static field(s) as the entry point(s)
+  // of archived object sub-graph(s).
+  Klass* _k;
+  // A list of classes need to be loaded and initialized before the archived
+  // object sub-graphs can be accessed at runtime.
+  GrowableArray<Klass*>* _subgraph_object_klasses;
+  // A list of _k's static fields as the entry points of archived sub-graphs.
+  // For each entry field, it is a pair of field_offset and field_value.
+  GrowableArray<juint>*  _subgraph_entry_fields;
+
+ public:
+  KlassSubGraphInfo(Klass* k, KlassSubGraphInfo* next) :
+    _next(next), _k(k),  _subgraph_object_klasses(NULL),
+    _subgraph_entry_fields(NULL) {}
+  ~KlassSubGraphInfo() {
+    if (_subgraph_object_klasses != NULL) {
+      delete _subgraph_object_klasses;
+    }
+    if (_subgraph_entry_fields != NULL) {
+      delete _subgraph_entry_fields;
+    }
+  };
+
+  KlassSubGraphInfo* next() { return _next; }
+  Klass* klass()            { return _k; }
+  GrowableArray<Klass*>* subgraph_object_klasses() {
+    return _subgraph_object_klasses;
+  }
+  GrowableArray<juint>*  subgraph_entry_fields() {
+    return _subgraph_entry_fields;
+  }
+  void add_subgraph_entry_field(int static_field_offset, oop v);
+  void add_subgraph_object_klass(Klass *orig_k, Klass *relocated_k);
+};
+
+// An archived record of object sub-graphs reachable from static
+// fields within _k's mirror. The record is reloaded from the archive
+// at runtime.
+class ArchivedKlassSubGraphInfoRecord {
+ private:
+  ArchivedKlassSubGraphInfoRecord* _next;
+  Klass* _k;
+
+  // contains pairs of field offset and value for each subgraph entry field
+  Array<juint>* _entry_field_records;
+
+  // klasses of objects in archived sub-graphs referenced from the entry points
+  // (static fields) in the containing class
+  Array<Klass*>* _subgraph_klasses;
+ public:
+  ArchivedKlassSubGraphInfoRecord() :
+    _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_klasses(NULL) {}
+  void init(KlassSubGraphInfo* info);
+  Klass* klass() { return _k; }
+  ArchivedKlassSubGraphInfoRecord* next() { return _next; }
+  void set_next(ArchivedKlassSubGraphInfoRecord* next) { _next = next; }
+  Array<juint>*  entry_field_records() { return _entry_field_records; }
+  Array<Klass*>* subgraph_klasses() { return _subgraph_klasses; }
+};
+#endif // INCLUDE_CDS_JAVA_HEAP
+
+class HeapShared: AllStatic {
+ private:
+#if INCLUDE_CDS_JAVA_HEAP
+  // This is a list of subgraph infos built at dump time while
+  // archiving object subgraphs.
+  static KlassSubGraphInfo* _subgraph_info_list;
+
+  // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored
+  // in the archive file and reloaded at runtime.
+  static int _num_archived_subgraph_info_records;
+  static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records;
+
+  // Archive object sub-graph starting from the given static field
+  // in Klass k's mirror.
+  static void archive_reachable_objects_from_static_field(
+    Klass* k, int field_ofset, BasicType field_type, TRAPS);
+
+  static KlassSubGraphInfo* find_subgraph_info(Klass *k);
+  static KlassSubGraphInfo* get_subgraph_info(Klass *k);
+  static int num_of_subgraph_infos();
+
+  static size_t build_archived_subgraph_info_records(int num_records);
+#endif // INCLUDE_CDS_JAVA_HEAP
+ public:
+  static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
+  static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
+  static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
+
+  static void archive_module_graph_objects(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+};
+#endif // SHARE_VM_MEMORY_HEAPSHARED_HPP
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -39,6 +39,7 @@
 #include "logging/log.hpp"
 #include "logging/logMessage.hpp"
 #include "memory/filemap.hpp"
+#include "memory/heapShared.hpp"
 #include "memory/metaspace.hpp"
 #include "memory/metaspaceClosure.hpp"
 #include "memory/metaspaceShared.hpp"
@@ -207,6 +208,10 @@
   return _ro_region.allocate(num_bytes);
 }
 
+char* MetaspaceShared::read_only_space_top() {
+  return _ro_region.top();
+}
+
 void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
   assert(UseSharedSpaces, "Must be called when UseSharedSpaces is enabled");
 
@@ -456,6 +461,7 @@
   java_lang_StackFrameInfo::serialize(soc);
   java_lang_LiveStackFrameInfo::serialize(soc);
   java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(soc);
+  jdk_internal_module_ArchivedModuleGraph::serialize(soc);
 }
 
 address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {
@@ -1350,6 +1356,11 @@
   char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
   SystemDictionary::copy_table(table_top, _ro_region.top());
 
+  // Write the archived object sub-graph infos. For each klass with sub-graphs,
+  // the info includes the static fields (sub-graph entry points) and Klasses
+  // of objects included in the sub-graph.
+  HeapShared::write_archived_subgraph_infos();
+
   // Write the other data to the output array.
   WriteClosure wc(&_ro_region);
   MetaspaceShared::serialize(&wc);
@@ -1861,6 +1872,8 @@
 
   MetaspaceShared::archive_klass_objects(THREAD);
 
+  HeapShared::archive_module_graph_objects(THREAD);
+
   G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
                                                    os::vm_allocation_granularity());
 }
@@ -1906,14 +1919,16 @@
     ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
     cache->put(obj, archived_oop);
   }
-  log_debug(cds)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
-                 p2i(obj), p2i(archived_oop));
+  log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
+                       p2i(obj), p2i(archived_oop));
   return archived_oop;
 }
 
 oop MetaspaceShared::materialize_archived_object(oop obj) {
-  assert(obj != NULL, "sanity");
-  return G1CollectedHeap::heap()->materialize_archived_object(obj);
+  if (obj != NULL) {
+    return G1CollectedHeap::heap()->materialize_archived_object(obj);
+  }
+  return NULL;
 }
 
 void MetaspaceShared::archive_klass_objects(Thread* THREAD) {
@@ -2121,6 +2136,9 @@
   buffer += sizeof(intptr_t);
   buffer += len;
 
+  // The table of archived java heap object sub-graph infos
+  buffer = HeapShared::read_archived_subgraph_infos(buffer);
+
   // Verify various attributes of the archive, plus initialize the
   // shared string/symbol tables
   intptr_t* array = (intptr_t*)buffer;
--- a/src/hotspot/share/memory/metaspaceShared.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -232,6 +232,8 @@
   static char* misc_code_space_alloc(size_t num_bytes);
   static char* read_only_space_alloc(size_t num_bytes);
 
+  static char* read_only_space_top();
+
   template <typename T>
   static Array<T>* new_ro_array(int length) {
 #if INCLUDE_CDS
--- a/src/hotspot/share/prims/jniCheck.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/prims/jniCheck.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -1995,9 +1995,6 @@
   checked_jni_GetModule(JNIEnv *env,
                         jclass clazz))
     functionEnter(thr);
-    IN_VM(
-      jniCheck::validate_class(thr, clazz, false);
-    )
     jobject result = UNCHECKED()->GetModule(env,clazz);
     functionExit(thr);
     return result;
--- a/src/hotspot/share/prims/jvm.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -39,6 +39,7 @@
 #include "interpreter/bytecode.hpp"
 #include "jfr/jfrEvents.hpp"
 #include "logging/log.hpp"
+#include "memory/heapShared.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/referenceType.hpp"
 #include "memory/resourceArea.hpp"
@@ -3598,6 +3599,13 @@
   return VM_Version::supports_cx8();
 JVM_END
 
+JVM_ENTRY(void, JVM_InitializeFromArchive(JNIEnv* env, jclass cls))
+  JVMWrapper("JVM_InitializeFromArchive");
+  Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
+  assert(k->is_klass(), "just checking");
+  HeapShared::initialize_from_archived_subgraph(k);
+JVM_END
+
 // Returns an array of all live Thread objects (VM internal JavaThreads,
 // jvmti agent threads, and JNI attaching threads  are skipped)
 // See CR 6404306 regarding JNI attaching threads
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -539,8 +539,6 @@
   { "PrintSafepointStatisticsTimeout", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "PrintSafepointStatisticsCount",JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "AggressiveOpts",               JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
-  { "AllowNonVirtualCalls",         JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
-  { "UnlinkSymbolsALot",            JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -573,6 +571,8 @@
   { "NativeMonitorTimeout",          JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "NativeMonitorSpinLimit",        JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "NativeMonitorFlags",            JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "UnlinkSymbolsALot",             JDK_Version::jdk(11),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
+  { "AllowNonVirtualCalls",          JDK_Version::jdk(11),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
--- a/src/hotspot/share/runtime/globals.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -486,9 +486,6 @@
   notproduct(bool, ZombieALot, false,                                       \
           "Create zombies (non-entrant) at exit from the runtime system")   \
                                                                             \
-  product(bool, UnlinkSymbolsALot, false,                                   \
-          "Unlink unreferenced symbols from the symbol table at safepoints")\
-                                                                            \
   notproduct(bool, WalkStackALot, false,                                    \
           "Trace stack (no print) at every exit from the runtime system")   \
                                                                             \
@@ -2571,9 +2568,6 @@
            "Default survivor space alignment in bytes")                     \
            constraint(SurvivorAlignmentInBytesConstraintFunc,AfterErgo)     \
                                                                             \
-  product(bool , AllowNonVirtualCalls, false,                               \
-          "Obey the ACC_SUPER flag and allow invokenonvirtual calls")       \
-                                                                            \
   product(ccstr, DumpLoadedClassList, NULL,                                 \
           "Dump the names all loaded classes, that could be stored into "   \
           "the CDS archive, in the specified file")                         \
--- a/src/hotspot/share/runtime/interfaceSupport.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/interfaceSupport.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -66,9 +66,6 @@
   if (ZombieALot) {
     InterfaceSupport::zombieAll();
   }
-  if (UnlinkSymbolsALot) {
-    InterfaceSupport::unlinkSymbols();
-  }
   // do verification AFTER potential deoptimization
   if (VerifyStack) {
     InterfaceSupport::verify_stack();
@@ -208,11 +205,6 @@
   zombieAllCounter++;
 }
 
-void InterfaceSupport::unlinkSymbols() {
-  VM_UnlinkSymbols op;
-  VMThread::execute(&op);
-}
-
 void InterfaceSupport::deoptimizeAll() {
   // This method is called by all threads when a thread make
   // transition to VM state (for example, runtime calls).
--- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -60,7 +60,6 @@
   static void walk_stack();
 
   static void zombieAll();
-  static void unlinkSymbols();
   static void deoptimizeAll();
   static void stress_derived_pointers();
   static void verify_stack();
--- a/src/hotspot/share/runtime/vm_operations.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/vm_operations.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -192,12 +192,6 @@
 
 #endif // !PRODUCT
 
-void VM_UnlinkSymbols::doit() {
-  JavaThread *thread = (JavaThread *)calling_thread();
-  assert(thread->is_Java_thread(), "must be a Java thread");
-  SymbolTable::unlink();
-}
-
 void VM_Verify::doit() {
   Universe::heap()->prepare_for_verify();
   Universe::verify();
--- a/src/hotspot/share/runtime/vm_operations.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/runtime/vm_operations.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -52,7 +52,6 @@
   template(DeoptimizeFrame)                       \
   template(DeoptimizeAll)                         \
   template(ZombieAll)                             \
-  template(UnlinkSymbols)                         \
   template(Verify)                                \
   template(PrintJNI)                              \
   template(HeapDumper)                            \
@@ -353,14 +352,6 @@
 };
 #endif // PRODUCT
 
-class VM_UnlinkSymbols: public VM_Operation {
- public:
-  VM_UnlinkSymbols() {}
-  VMOp_Type type() const                         { return VMOp_UnlinkSymbols; }
-  void doit();
-  bool allow_nested_vm_operations() const        { return true; }
-};
-
 class VM_Verify: public VM_Operation {
  public:
   VMOp_Type type() const { return VMOp_Verify; }
--- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Thu Jul 12 13:04:33 2018 -0700
@@ -263,8 +263,11 @@
       Prefetch::read(*pref->value(), 0);
       pref = pref->next();
     }
-    if (next->next() != NULL) {
-      Prefetch::read(*next->next()->value(), 0);
+    // Read next() Node* once.  May be racing with a thread moving the next
+    // pointers.
+    Node* next_pref = next->next();
+    if (next_pref != NULL) {
+      Prefetch::read(*next_pref->value(), 0);
     }
     if (eval_f(next->value())) {
       return true;
@@ -546,8 +549,9 @@
     lookup_f.equals(rem_n->value(), &is_dead);
     if (is_dead) {
       ndel[dels++] = rem_n;
-      bucket->release_assign_node_ptr(rem_n_prev, rem_n->next());
-      rem_n = rem_n->next();
+      Node* next_node = rem_n->next();
+      bucket->release_assign_node_ptr(rem_n_prev, next_node);
+      rem_n = next_node;
       if (dels == BULK_DELETE_LIMIT) {
         break;
       }
@@ -654,32 +658,33 @@
   while (aux != NULL) {
     bool dead_hash = false;
     size_t aux_hash = CONFIG::get_hash(*aux->value(), &dead_hash);
+    Node* aux_next = aux->next();
     if (dead_hash) {
       delete_me = aux;
       // This item is dead, move both list to next
       new_table->get_bucket(odd_index)->release_assign_node_ptr(odd,
-                                                                aux->next());
+                                                                aux_next);
       new_table->get_bucket(even_index)->release_assign_node_ptr(even,
-                                                                 aux->next());
+                                                                 aux_next);
     } else {
       size_t aux_index = bucket_idx_hash(new_table, aux_hash);
       if (aux_index == even_index) {
         // This is a even, so move odd to aux/even next
         new_table->get_bucket(odd_index)->release_assign_node_ptr(odd,
-                                                                  aux->next());
+                                                                  aux_next);
         // Keep in even list
         even = aux->next_ptr();
       } else if (aux_index == odd_index) {
         // This is a odd, so move odd to aux/odd next
         new_table->get_bucket(even_index)->release_assign_node_ptr(even,
-                                                                   aux->next());
+                                                                   aux_next);
         // Keep in odd list
         odd = aux->next_ptr();
       } else {
         fatal("aux_index does not match even or odd indices");
       }
     }
-    aux = aux->next();
+    aux = aux_next;
 
     // We can only move 1 pointer otherwise a reader might be moved to the wrong
     // chain. E.g. looking for even hash value but got moved to the odd bucket
@@ -976,8 +981,9 @@
   while (rem_n != NULL) {
     if (eval_f(rem_n->value())) {
       ndel[dels++] = rem_n;
-      bucket->release_assign_node_ptr(rem_n_prev, rem_n->next());
-      rem_n = rem_n->next();
+      Node* next_node = rem_n->next();
+      bucket->release_assign_node_ptr(rem_n_prev, next_node);
+      rem_n = next_node;
       if (dels == num_del) {
         break;
       }
--- a/src/java.base/share/classes/java/util/ArrayDeque.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/classes/java/util/ArrayDeque.java	Thu Jul 12 13:04:33 2018 -0700
@@ -180,7 +180,7 @@
      * sufficient to hold 16 elements.
      */
     public ArrayDeque() {
-        elements = new Object[16];
+        elements = new Object[16 + 1];
     }
 
     /**
--- a/src/java.base/share/classes/java/util/HashMap.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/classes/java/util/HashMap.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1263,9 +1263,7 @@
     @Override
     public V merge(K key, V value,
                    BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
-        if (value == null)
-            throw new NullPointerException();
-        if (remappingFunction == null)
+        if (value == null || remappingFunction == null)
             throw new NullPointerException();
         int hash = hash(key);
         Node<K,V>[] tab; Node<K,V> first; int n, i;
@@ -1308,8 +1306,7 @@
             else
                 removeNode(hash, key, null, false, true);
             return v;
-        }
-        if (value != null) {
+        } else {
             if (t != null)
                 t.putTreeVal(this, tab, hash, key, value);
             else {
@@ -1320,8 +1317,8 @@
             ++modCount;
             ++size;
             afterNodeInsertion(true);
+            return value;
         }
-        return value;
     }
 
     @Override
--- a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java	Thu Jul 12 13:04:33 2018 -0700
@@ -582,7 +582,9 @@
                 uctime > UPPER_UNIXTIME_BOUND) {
                 elen += 36;         // NTFS time total 36 bytes
             } else {
-                elen += 9;          // headid(2) + sz(2) + flag(1) + mtime (4)
+                elen += 5;          // headid(2) + sz(2) + flag(1)
+                if (e.mtime != null)
+                    elen += 4;      // + mtime (4)
             }
         }
         writeShort(elen);
--- a/src/java.base/share/classes/jdk/internal/misc/VM.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/VM.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -413,4 +413,15 @@
         initialize();
     }
     private static native void initialize();
+
+    /**
+     * Initialize archived static fields in the given Class using archived
+     * values from CDS dump time. Also initialize the classes of objects in
+     * the archived graph referenced by those fields.
+     *
+     * Those static fields remain as uninitialized if there is no mapped CDS
+     * java heap data or there is any error during initialization of the
+     * object class in the archived graph.
+     */
+    public static native void initializeFromArchive(Class<?> c);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package jdk.internal.module;
+
+import java.lang.module.ModuleFinder;
+import java.util.Objects;
+import jdk.internal.misc.VM;
+
+/**
+ * Used by ModuleBootstrap to obtain the archived system modules and finder.
+ */
+final class ArchivedModuleGraph {
+    private static String archivedMainModule;
+    private static SystemModules archivedSystemModules;
+    private static ModuleFinder archivedModuleFinder;
+
+    private final SystemModules systemModules;
+    private final ModuleFinder finder;
+
+    private ArchivedModuleGraph(SystemModules modules, ModuleFinder finder) {
+        this.systemModules = modules;
+        this.finder = finder;
+    }
+
+    SystemModules systemModules() {
+        return systemModules;
+    }
+
+    ModuleFinder finder() {
+        return finder;
+    }
+
+    // A factory method that ModuleBootstrap can use to obtain the
+    // ArchivedModuleGraph.
+    static ArchivedModuleGraph get(String mainModule) {
+        if (Objects.equals(mainModule, archivedMainModule)
+                && archivedSystemModules != null
+                && archivedModuleFinder != null) {
+            return new ArchivedModuleGraph(archivedSystemModules,
+                                           archivedModuleFinder);
+        } else {
+            return null;
+        }
+    }
+
+    // Used at CDS dump time
+    static void archive(String mainModule, SystemModules systemModules,
+                        ModuleFinder finder) {
+        if (archivedMainModule != null)
+            throw new UnsupportedOperationException();
+        archivedMainModule = mainModule;
+        archivedSystemModules = systemModules;
+        archivedModuleFinder = finder;
+    }
+
+    static {
+        VM.initializeFromArchive(ArchivedModuleGraph.class);
+    }
+}
--- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Thu Jul 12 13:04:33 2018 -0700
@@ -54,6 +54,7 @@
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.JavaLangModuleAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.misc.VM;
 import jdk.internal.perf.PerfCounter;
 
 /**
@@ -172,23 +173,45 @@
         boolean haveModulePath = (appModulePath != null || upgradeModulePath != null);
         boolean needResolution = true;
 
-        if (!haveModulePath && addModules.isEmpty() && limitModules.isEmpty()) {
-            systemModules = SystemModuleFinders.systemModules(mainModule);
-            if (systemModules != null && !isPatched && (traceOutput == null)) {
-                needResolution = false;
+        // If the java heap was archived at CDS dump time and the environment
+        // at dump time matches the current environment then use the archived
+        // system modules and finder.
+        ArchivedModuleGraph archivedModuleGraph = ArchivedModuleGraph.get(mainModule);
+        if (archivedModuleGraph != null
+                && !haveModulePath
+                && addModules.isEmpty()
+                && limitModules.isEmpty()
+                && !isPatched) {
+            systemModules = archivedModuleGraph.systemModules();
+            systemModuleFinder = archivedModuleGraph.finder();
+            needResolution = (traceOutput != null);
+        } else {
+            boolean canArchive = false;
+            if (!haveModulePath && addModules.isEmpty() && limitModules.isEmpty()) {
+                systemModules = SystemModuleFinders.systemModules(mainModule);
+                if (systemModules != null && !isPatched) {
+                    needResolution = (traceOutput != null);
+                    canArchive = true;
+                }
             }
-        }
-        if (systemModules == null) {
-            // all system modules are observable
-            systemModules = SystemModuleFinders.allSystemModules();
-        }
-        if (systemModules != null) {
-            // images build
-            systemModuleFinder = SystemModuleFinders.of(systemModules);
-        } else {
-            // exploded build or testing
-            systemModules = new ExplodedSystemModules();
-            systemModuleFinder = SystemModuleFinders.ofSystem();
+            if (systemModules == null) {
+                // all system modules are observable
+                systemModules = SystemModuleFinders.allSystemModules();
+            }
+            if (systemModules != null) {
+                // images build
+                systemModuleFinder = SystemModuleFinders.of(systemModules);
+            } else {
+                // exploded build or testing
+                systemModules = new ExplodedSystemModules();
+                systemModuleFinder = SystemModuleFinders.ofSystem();
+            }
+
+            // Module graph can be archived at CDS dump time. Only allow the
+            // unnamed module case for now.
+            if (canArchive && (mainModule == null)) {
+                ArchivedModuleGraph.archive(mainModule, systemModules, systemModuleFinder);
+            }
         }
 
         Counters.add("jdk.module.boot.1.systemModulesTime", t1);
--- a/src/java.base/share/classes/sun/net/NetworkServer.java	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package sun.net;
-
-import java.io.*;
-import java.net.Socket;
-import java.net.ServerSocket;
-
-/**
- * This is the base class for network servers.  To define a new type
- * of server define a new subclass of NetworkServer with a serviceRequest
- * method that services one request.  Start the server by executing:
- * <pre>
- *      new MyServerClass().startServer(port);
- * </pre>
- */
-public class NetworkServer implements Runnable, Cloneable {
-    /** Socket for communicating with client. */
-    public Socket clientSocket = null;
-    private Thread serverInstance;
-    private ServerSocket serverSocket;
-
-    /** Stream for printing to the client. */
-    public PrintStream clientOutput;
-
-    /** Buffered stream for reading replies from client. */
-    public InputStream clientInput;
-
-    /** Close an open connection to the client. */
-    public void close() throws IOException {
-        clientSocket.close();
-        clientSocket = null;
-        clientInput = null;
-        clientOutput = null;
-    }
-
-    /** Return client connection status */
-    public boolean clientIsOpen() {
-        return clientSocket != null;
-    }
-
-    public final void run() {
-        if (serverSocket != null) {
-            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
-            // System.out.print("Server starts " + serverSocket + "\n");
-            while (true) {
-                try {
-                    Socket ns = serverSocket.accept();
-//                  System.out.print("New connection " + ns + "\n");
-                    NetworkServer n = (NetworkServer)clone();
-                    n.serverSocket = null;
-                    n.clientSocket = ns;
-                    new Thread(null, n, "NetworkServer", 0, false).start();
-                } catch(Exception e) {
-                    System.out.print("Server failure\n");
-                    e.printStackTrace();
-                    try {
-                        serverSocket.close();
-                    } catch(IOException e2) {}
-                    System.out.print("cs="+serverSocket+"\n");
-                    break;
-                }
-            }
-//          close();
-        } else {
-            try {
-                clientOutput = new PrintStream(
-                        new BufferedOutputStream(clientSocket.getOutputStream()),
-                                               false, "ISO8859_1");
-                clientInput = new BufferedInputStream(clientSocket.getInputStream());
-                serviceRequest();
-                // System.out.print("Service handler exits
-                // "+clientSocket+"\n");
-            } catch(Exception e) {
-                // System.out.print("Service handler failure\n");
-                // e.printStackTrace();
-            }
-            try {
-                close();
-            } catch(IOException e2) {}
-        }
-    }
-
-    /** Start a server on port <i>port</i>.  It will call serviceRequest()
-        for each new connection. */
-    public final void startServer(int port) throws IOException {
-        serverSocket = new ServerSocket(port, 50);
-        serverInstance = new Thread(null, this, "NetworkServer", 0, false);
-        serverInstance.start();
-    }
-
-    /** Service one request.  It is invoked with the clientInput and
-        clientOutput streams initialized.  This method handles one client
-        connection. When it is done, it can simply exit. The default
-        server just echoes it's input. It is invoked in it's own private
-        thread. */
-    public void serviceRequest() throws IOException {
-        byte buf[] = new byte[300];
-        int n;
-        clientOutput.print("Echo server " + getClass().getName() + "\n");
-        clientOutput.flush();
-        while ((n = clientInput.read(buf, 0, buf.length)) >= 0) {
-            clientOutput.write(buf, 0, n);
-        }
-    }
-
-    public static void main(String argv[]) {
-        try {
-            new NetworkServer ().startServer(8888);
-        } catch (IOException e) {
-            System.out.print("Server failed: "+e+"\n");
-        }
-    }
-
-    /**
-     * Clone this object;
-     */
-    public Object clone() {
-        try {
-            return super.clone();
-        } catch (CloneNotSupportedException e) {
-            // this shouldn't happen, since we are Cloneable
-            throw new InternalError(e);
-        }
-    }
-
-    public NetworkServer () {
-    }
-}
--- a/src/java.base/share/classes/sun/net/URLCanonicalizer.java	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 1996, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-package sun.net;
-
-/**
- * Helper class to map URL "abbreviations" to real URLs.
- * The default implementation supports the following mappings:
- * <pre>{@code
- *   ftp.mumble.bar/... => ftp://ftp.mumble.bar/...
- *   gopher.mumble.bar/... => gopher://gopher.mumble.bar/...
- *   other.name.dom/... => http://other.name.dom/...
- *   /foo/... => file:/foo/...
- * }</pre>
- *
- * Full URLs (those including a protocol name) are passed through unchanged.
- *
- * Subclassers can override or extend this behavior to support different
- * or additional canonicalization policies.
- *
- * @author      Steve Byrne
- */
-
-public class URLCanonicalizer {
-    /**
-     * Creates the default canonicalizer instance.
-     */
-    public URLCanonicalizer() { }
-
-    /**
-     * Given a possibly abbreviated URL (missing a protocol name, typically),
-     * this method's job is to transform that URL into a canonical form,
-     * by including a protocol name and additional syntax, if necessary.
-     *
-     * For a correctly formed URL, this method should just return its argument.
-     */
-    public String canonicalize(String simpleURL) {
-        String resultURL = simpleURL;
-        if (simpleURL.startsWith("ftp.")) {
-            resultURL = "ftp://" + simpleURL;
-        } else if (simpleURL.startsWith("gopher.")) {
-            resultURL = "gopher://" + simpleURL;
-        } else if (simpleURL.startsWith("/")) {
-            resultURL = "file:" + simpleURL;
-        } else if (!hasProtocolName(simpleURL)) {
-            if (isSimpleHostName(simpleURL)) {
-                simpleURL = "www." + simpleURL + ".com";
-            }
-            resultURL = "http://" + simpleURL;
-        }
-
-        return resultURL;
-    }
-
-    /**
-     * Given a possibly abbreviated URL, this predicate function returns
-     * true if it appears that the URL contains a protocol name
-     */
-    public boolean hasProtocolName(String url) {
-        int index = url.indexOf(':');
-        if (index <= 0) {       // treat ":foo" as not having a protocol spec
-            return false;
-        }
-
-        for (int i = 0; i < index; i++) {
-            char c = url.charAt(i);
-
-            // REMIND: this is a guess at legal characters in a protocol --
-            // need to be verified
-            if ((c >= 'A' && c <= 'Z')
-                || (c >= 'a' && c <= 'z')
-                || (c == '-')) {
-                continue;
-            }
-
-            // found an illegal character
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns true if the URL is just a single name, no periods or
-     * slashes, false otherwise
-     **/
-    protected boolean isSimpleHostName(String url) {
-
-        for (int i = 0; i < url.length(); i++) {
-            char c = url.charAt(i);
-
-            // REMIND: this is a guess at legal characters in a protocol --
-            // need to be verified
-            if ((c >= 'A' && c <= 'Z')
-                || (c >= 'a' && c <= 'z')
-                || (c >= '0' && c <= '9')
-                || (c == '-')) {
-                continue;
-            }
-
-            // found an illegal character
-            return false;
-        }
-
-        return true;
-    }
-}
--- a/src/java.base/share/native/libjava/VM.c	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.base/share/native/libjava/VM.c	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -60,3 +60,9 @@
 Java_jdk_internal_misc_VM_getRuntimeArguments(JNIEnv *env, jclass cls) {
     return JVM_GetVmArguments(env);
 }
+
+JNIEXPORT void JNICALL
+Java_jdk_internal_misc_VM_initializeFromArchive(JNIEnv *env, jclass ignore,
+                                                jclass c) {
+    JVM_InitializeFromArchive(env, c);
+}
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -84,7 +84,7 @@
  * @author G. Todd Miller
  * @author Morten Jorgensen
  * @author Santiago Pericas-Geertsen
- * @LastModified: Nov 2017
+ * @LastModified: July 2018
  */
 public class TransformerFactoryImpl
     extends SAXTransformerFactory implements SourceLoader, ErrorListener
@@ -1211,7 +1211,7 @@
                     return null;
                 }
                 catch (TransformerException e2) {
-                    new TransformerConfigurationException(e2);
+                    throw new TransformerConfigurationException(e2);
                 }
             }
             throw e1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/**
+ *  This package provides the javadoc implementation of relevant
+ *  public API defined in {@link javax.tools}, which provides an
+ *  API alternative to invoking javadoc via the command line.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+package jdk.javadoc.internal.api;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,17 +24,18 @@
  */
 
 /**
- * This package contains classes that create and write HTML markup tags.
+ *  This package contains classes that create and write HTML markup tags.
  *
- * The primary low level classes are {@link HtmlTree} and subtypes
- * of {@code Content}. In addition, there are mid-level builders
- * like {@link TableHeader} and {@link Table} to help build more
- * complex HTML trees.
+ *  <p>The primary low level classes are
+ *  {@link jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree HtmlTree}
+ *  and other subtypes of {@code Content}. In addition, there are mid-level builders
+ *  like {@link jdk.javadoc.internal.doclets.formats.html.markup.TableHeader TableHeader}
+ *  and {@link jdk.javadoc.internal.doclets.formats.html.markup.Table Table}
+ *  to help build more complex HTML trees.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-
 package jdk.javadoc.internal.doclets.formats.html.markup;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+
+/**
+ *  The set of low-level file-formats, to be used in conjunction with
+ *  the {@link jdk.javadoc.internal.doclets.toolkit doclets.toolkit} API.
+ *
+ *  <p>Currently, only {@link jdk.javadoc.internal.doclets.formats.html HTML}
+ *  format is supported.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+package jdk.javadoc.internal.doclets.formats;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,10 +24,25 @@
  */
 
 /**
-    <p><b>This is NOT part of any supported API.
-    If you write code that depends on this, you do so at your own risk.
-    This code and its internal interfaces are subject to change or
-    deletion without notice.</b>
+ *  Doclets provide the user-selectable backends for processing the
+ *  documentation comnments in Java source code.
+ *
+ *  <p>Doclets are implementations of the {@link jdk.javadoc.doclet Doclet API}.</p>
+ *
+ *  <p>Currently, there is only one supported doclet, the
+ *  {@link jdk.javadoc.internal.doclets.formats.html.HtmlDoclet HtmlDoclet},
+ *  for writing API documentation in HTML. Nevertheless, in order to
+ *  separate the high-level code for the general content of each page
+ *  from the low-level details of how to write such content, the code is
+ *  organized in two sections: a format-neutral
+ *  {@link jdk.javadoc.internal.doclets.toolkit toolkit API},
+ *  and a specific {@link jdk.javadoc.internal.doclets.formats format},
+ *  such as {@link jdk.javadoc.internal.doclets.formats.html HTML format}.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
 */
 
 package jdk.javadoc.internal.doclets;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,17 +24,17 @@
  */
 
 /**
-    This doclet-independent package has a set of classes and
-    interfaces that are the building blocks for doclets. They
-    define the basic structure of doclets and make doclet
-    writing much easier because they provide the content generation
-    code to be shared among different doclets. Builders only provide
-    the structure and content of API documentation.
-    They will not provide any style markup.
-
-    <p><b>This is NOT part of any supported API.
-    If you write code that depends on this, you do so at your own risk.
-    This code and its internal interfaces are subject to change or
-    deletion without notice.</b>
-*/
+ *  This doclet-independent package has a set of classes and
+ *  interfaces that are the building blocks for doclets. They
+ *  define the basic structure of doclets and make doclet
+ *  writing much easier because they provide the content generation
+ *  code to be shared among different doclets. Builders only provide
+ *  the structure and content of API documentation.
+ *  They do not directly provide any style markup.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
 package jdk.javadoc.internal.doclets.toolkit.builders;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,29 +24,28 @@
  */
 
 /**
-    This package has classes used to generate Javadoc tag documentation.
-    Doclets no longer have to implement its own version of standard tags
-    such as &#64;param and &#64;throws.  This is the single, doclet
-    implementation of each standard tag that is shared by all
-    doclets.  Each doclet must have a taglet writer that takes a taglet
-    as input and writes doclet-dependent output. The taglet itself will
-    do the tag processing. For example, suppose we are outputing
-    &#64;throws tags. The taglet would:
-    <ul>
-        <li> Retrieve the list of throws tags to be documented.
-        <li> Replace {&#64;inheritDoc} with the appropriate documentation.
-        <li> Add throws documentation for exceptions that are declared in
-             the signature of the method but
-             not documented with the throws tags.
-    </ul>
-    After doing the steps above, the taglet would pass the information to
-    the taglet writer for writing. The taglets are essentially builders for
-    tags.
-
-    <p><b>This is NOT part of any supported API.
-    If you write code that depends on this, you do so at your own risk.
-    This code and its internal interfaces are subject to change or
-    deletion without notice.</b>
-*/
-
+ *  This package has classes used to generate output for Javadoc tags.
+ *
+ *  <p>Doclets no longer have to implement their own version of standard tags
+ *  such as &#64;param and &#64;throws.  Individual taglets provide
+ *  common processing, independent of the output format.
+ *  Each doclet must have a taglet writer that takes a taglet
+ *  as input and writes doclet-dependent output. The taglet itself will
+ *  do the tag processing. For example, suppose we are outputing
+ *  &#64;throws tags. The taglet would:
+ *  <ul>
+ *      <li> Retrieve the list of throws tags to be documented.
+ *      <li> Replace {&#64;inheritDoc} with the appropriate documentation.
+ *      <li> Add throws documentation for exceptions that are declared in
+ *           the signature of the method but not documented with the throws tags.
+ *  </ul>
+ *  After doing the steps above, the taglet would pass the information to
+ *  the taglet writer for writing. The taglets are essentially builders for
+ *  tags.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
 package jdk.javadoc.internal.doclets.toolkit.taglets;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -33,14 +33,14 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 
 /**
- * Encapsulates information about a link.
+ *  Encapsulates information about a link.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  *
- * @author Jamie Ho
+ *  @author Jamie Ho
  */
 public abstract class LinkInfo {
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkOutput.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkOutput.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,7 +26,7 @@
 package jdk.javadoc.internal.doclets.toolkit.util.links;
 
 /**
- * Stores output of a link.
+ *  Stores output of a link.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,12 +24,11 @@
  */
 
 /**
-    Provides a factory for constructing links.
-
-    <p><b>This is NOT part of any supported API.
-    If you write code that depends on this, you do so at your own risk.
-    This code and its internal interfaces are subject to change or
-    deletion without notice.</b>
-*/
-
+ *  Provides a factory for constructing links.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
 package jdk.javadoc.internal.doclets.toolkit.util.links;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/package-info.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,13 +24,12 @@
  */
 
 /**
-    This package has utility classes that perform common services required
-    for API documentation generation.
-
-    <p><b>This is NOT part of any supported API.
-    If you write code that depends on this, you do so at your own risk.
-    This code and its internal interfaces are subject to change or
-    deletion without notice.</b>
-*/
-
+ *  This package has utility classes that perform common services required
+ *  for API documentation generation.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
 package jdk.javadoc.internal.doclets.toolkit.util;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/**
+ *  The implementation of the javadoc tool, and associated doclets.
+ *
+ *  <p>Internally, javadoc is composed of two primary parts:
+ *  the {@link jdk.javadoc.internal.tool tool}, and a series of
+ *  {@link jdk.javadoc.internal.doclets doclets}.
+ *
+ *  The tool provides a common infrastructure for command-line processing,
+ *  and for reading the documentation comments in Java source files,
+ *  while doclets provide a user-selectable backend for determining
+ *  how to process the documentation comments.
+ *
+ *  <p><em>Historical Note:</em> Prior to the introduction of the
+ *  {@link javax.lang.model Language Model API} in JDK 6, it was
+ *  not unusual to use the {@link com.sun.javadoc} API as a
+ *  modeling API. But the Language Model API, and associated
+ *  {@link javax.annotation.processing Annotation Processing API}
+ *  provided a better way to model programs, and in JDK 9,
+ *  javadoc itself was converted to using the Language Model API,
+ *  with the {@code com.sun.javadoc API} being deprecated for
+ *  eventual removal.
+ *  </p>
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+package jdk.javadoc.internal;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/package-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/**
+ *  Provides the front end for the javadoc tool.
+ *
+ *  <p>The main entry points are in {@link jdk.javadoc.internal.tool.Main}
+ *  which calls the (poorly-named) {@link jdk.javadoc.internal.tool.Start}
+ *  which provides the overall functionality of the tool.
+ *
+ *  <p>The classes provide a framework for processing command-line options
+ *  and determining the set of elements (modules, packages, types and members)
+ *  to be documented.
+ *
+ *  <p>The classes also provide the means to use the javac front end to read
+ *  source files, including the documentation comments.
+ *
+ *  <p>Finally, once the appropriate files have been read, the classes invoke
+ *  the selected doclet to process those files, typically to generate API
+ *  documentation.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+package jdk.javadoc.internal.tool;
--- a/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Thu Jul 12 13:04:33 2018 -0700
@@ -52,23 +52,23 @@
 class OopStorage::TestAccess : public AllStatic {
 public:
   typedef OopStorage::Block Block;
-  typedef OopStorage::AllocateList AllocateList;
+  typedef OopStorage::AllocationList AllocationList;
   typedef OopStorage::ActiveArray ActiveArray;
 
   static ActiveArray& active_array(const OopStorage& storage) {
     return *storage._active_array;
   }
 
-  static AllocateList& allocate_list(OopStorage& storage) {
-    return storage._allocate_list;
+  static AllocationList& allocation_list(OopStorage& storage) {
+    return storage._allocation_list;
   }
 
-  static const AllocateList& allocate_list(const OopStorage& storage) {
-    return storage._allocate_list;
+  static const AllocationList& allocation_list(const OopStorage& storage) {
+    return storage._allocation_list;
   }
 
-  static Mutex* allocate_mutex(const OopStorage& storage) {
-    return storage._allocate_mutex;
+  static Mutex* allocation_mutex(const OopStorage& storage) {
+    return storage._allocation_mutex;
   }
 
   static bool reduce_deferred_updates(OopStorage& storage) {
@@ -109,13 +109,13 @@
 // building with precompiled headers, or for consistency with that
 // workaround.  There really should be an opto namespace.
 typedef TestAccess::Block OopBlock;
-typedef TestAccess::AllocateList AllocateList;
+typedef TestAccess::AllocationList AllocationList;
 typedef TestAccess::ActiveArray ActiveArray;
 
 // Using EXPECT_EQ can't use NULL directly. Otherwise AIX build breaks.
 const OopBlock* const NULL_BLOCK = NULL;
 
-static size_t list_length(const AllocateList& list) {
+static size_t list_length(const AllocationList& list) {
   size_t result = 0;
   for (const OopBlock* block = list.chead();
        block != NULL;
@@ -125,7 +125,7 @@
   return result;
 }
 
-static void clear_list(AllocateList& list) {
+static void clear_list(AllocationList& list) {
   OopBlock* next;
   for (OopBlock* block = list.head(); block != NULL; block = next) {
     next = list.next(*block);
@@ -133,12 +133,12 @@
   }
 }
 
-static bool is_list_empty(const AllocateList& list) {
+static bool is_list_empty(const AllocationList& list) {
   return list.chead() == NULL;
 }
 
 static bool process_deferred_updates(OopStorage& storage) {
-  MutexLockerEx ml(TestAccess::allocate_mutex(storage), Mutex::_no_safepoint_check_flag);
+  MutexLockerEx ml(TestAccess::allocation_mutex(storage), Mutex::_no_safepoint_check_flag);
   bool result = false;
   while (TestAccess::reduce_deferred_updates(storage)) {
     result = true;
@@ -155,7 +155,7 @@
 }
 
 static size_t empty_block_count(const OopStorage& storage) {
-  const AllocateList& list = TestAccess::allocate_list(storage);
+  const AllocationList& list = TestAccess::allocation_list(storage);
   size_t count = 0;
   for (const OopBlock* block = list.ctail();
        (block != NULL) && block->is_empty();
@@ -183,7 +183,7 @@
   OopStorageTest();
   ~OopStorageTest();
 
-  Mutex _allocate_mutex;
+  Mutex _allocation_mutex;
   Mutex _active_mutex;
   OopStorage _storage;
 
@@ -195,19 +195,19 @@
 };
 
 OopStorageTest::OopStorageTest() :
-  _allocate_mutex(_allocate_rank,
-                  "test_OopStorage_allocate",
-                  false,
-                  Mutex::_safepoint_check_never),
+  _allocation_mutex(_allocate_rank,
+                    "test_OopStorage_allocation",
+                    false,
+                    Mutex::_safepoint_check_never),
   _active_mutex(_active_rank,
                 "test_OopStorage_active",
                 false,
                 Mutex::_safepoint_check_never),
-  _storage("Test Storage", &_allocate_mutex, &_active_mutex)
+  _storage("Test Storage", &_allocation_mutex, &_active_mutex)
 { }
 
 OopStorageTest::~OopStorageTest() {
-  clear_list(TestAccess::allocate_list(_storage));
+  clear_list(TestAccess::allocation_list(_storage));
 }
 
 class OopStorageTestWithAllocation : public OopStorageTest {
@@ -243,10 +243,10 @@
   OopStorage* _storage;
 };
 
-static bool is_allocate_list_sorted(const OopStorage& storage) {
-  // The allocate_list isn't strictly sorted.  Rather, all empty
+static bool is_allocation_list_sorted(const OopStorage& storage) {
+  // The allocation_list isn't strictly sorted.  Rather, all empty
   // blocks are segregated to the end of the list.
-  const AllocateList& list = TestAccess::allocate_list(storage);
+  const AllocationList& list = TestAccess::allocation_list(storage);
   const OopBlock* block = list.ctail();
   for ( ; (block != NULL) && block->is_empty(); block = list.prev(*block)) {}
   for ( ; block != NULL; block = list.prev(*block)) {
@@ -269,7 +269,7 @@
 
 TEST_VM_F(OopStorageTest, allocate_one) {
   EXPECT_EQ(0u, active_count(_storage));
-  EXPECT_TRUE(is_list_empty(TestAccess::allocate_list(_storage)));
+  EXPECT_TRUE(is_list_empty(TestAccess::allocation_list(_storage)));
 
   oop* ptr = _storage.allocate();
   EXPECT_TRUE(ptr != NULL);
@@ -277,11 +277,11 @@
 
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(TestAccess::allocate_list(_storage)));
+  EXPECT_EQ(1u, list_length(TestAccess::allocation_list(_storage)));
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  const OopBlock* block = TestAccess::allocate_list(_storage).chead();
+  const OopBlock* block = TestAccess::allocation_list(_storage).chead();
   EXPECT_NE(block, (OopBlock*)NULL);
   EXPECT_EQ(block, active_head(_storage));
   EXPECT_FALSE(TestAccess::block_is_empty(*block));
@@ -293,11 +293,11 @@
 
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(TestAccess::allocate_list(_storage)));
+  EXPECT_EQ(1u, list_length(TestAccess::allocation_list(_storage)));
 
   EXPECT_EQ(1u, empty_block_count(_storage));
 
-  const OopBlock* new_block = TestAccess::allocate_list(_storage).chead();
+  const OopBlock* new_block = TestAccess::allocation_list(_storage).chead();
   EXPECT_EQ(block, new_block);
   EXPECT_EQ(block, active_head(_storage));
   EXPECT_TRUE(TestAccess::block_is_empty(*block));
@@ -309,11 +309,11 @@
   static const size_t max_entries = 1000;
   oop* entries[max_entries];
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(0u, active_count(_storage));
   EXPECT_EQ(0u, _storage.block_count());
-  EXPECT_TRUE(is_list_empty(allocate_list));
+  EXPECT_TRUE(is_list_empty(allocation_list));
 
   size_t allocated = 0;
   for ( ; allocated < max_entries; ++allocated) {
@@ -326,8 +326,8 @@
       if (TestAccess::block_is_full(block)) {
         break;
       } else {
-        EXPECT_FALSE(is_list_empty(allocate_list));
-        EXPECT_EQ(&block, allocate_list.chead());
+        EXPECT_FALSE(is_list_empty(allocation_list));
+        EXPECT_EQ(&block, allocation_list.chead());
       }
     }
     entries[allocated] = _storage.allocate();
@@ -336,7 +336,7 @@
   EXPECT_EQ(allocated, _storage.allocation_count());
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_TRUE(is_list_empty(allocate_list));
+  EXPECT_TRUE(is_list_empty(allocation_list));
   const OopBlock& block = *TestAccess::active_array(_storage).at(0);
   EXPECT_TRUE(TestAccess::block_is_full(block));
   EXPECT_EQ(allocated, TestAccess::block_allocation_count(block));
@@ -346,7 +346,7 @@
     size_t remaining = allocated - (i + 1);
     EXPECT_EQ(remaining, TestAccess::block_allocation_count(block));
     EXPECT_EQ(remaining, _storage.allocation_count());
-    EXPECT_FALSE(is_list_empty(allocate_list));
+    EXPECT_FALSE(is_list_empty(allocation_list));
   }
 }
 
@@ -354,7 +354,7 @@
   static const size_t max_entries = 1000;
   oop* entries[max_entries];
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
@@ -362,12 +362,12 @@
   ASSERT_TRUE(entries[0] != NULL);
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(allocate_list));
+  EXPECT_EQ(1u, list_length(allocation_list));
   EXPECT_EQ(0u, empty_block_count(_storage));
 
   const OopBlock* block = TestAccess::active_array(_storage).at(0);
   EXPECT_EQ(1u, TestAccess::block_allocation_count(*block));
-  EXPECT_EQ(block, allocate_list.chead());
+  EXPECT_EQ(block, allocation_list.chead());
 
   for (size_t i = 1; i < max_entries; ++i) {
     entries[i] = _storage.allocate();
@@ -376,40 +376,40 @@
     EXPECT_EQ(0u, empty_block_count(_storage));
 
     if (block == NULL) {
-      ASSERT_FALSE(is_list_empty(allocate_list));
-      EXPECT_EQ(1u, list_length(allocate_list));
-      block = allocate_list.chead();
+      ASSERT_FALSE(is_list_empty(allocation_list));
+      EXPECT_EQ(1u, list_length(allocation_list));
+      block = allocation_list.chead();
       EXPECT_EQ(1u, TestAccess::block_allocation_count(*block));
       EXPECT_EQ(block, active_head(_storage));
     } else if (TestAccess::block_is_full(*block)) {
-      EXPECT_TRUE(is_list_empty(allocate_list));
+      EXPECT_TRUE(is_list_empty(allocation_list));
       block = NULL;
     } else {
-      EXPECT_FALSE(is_list_empty(allocate_list));
-      EXPECT_EQ(block, allocate_list.chead());
+      EXPECT_FALSE(is_list_empty(allocation_list));
+      EXPECT_EQ(block, allocation_list.chead());
       EXPECT_EQ(block, active_head(_storage));
     }
   }
 
   if (block != NULL) {
     EXPECT_NE(0u, TestAccess::block_allocation_count(*block));
-    EXPECT_FALSE(is_list_empty(allocate_list));
-    EXPECT_EQ(block, allocate_list.chead());
+    EXPECT_FALSE(is_list_empty(allocation_list));
+    EXPECT_EQ(block, allocation_list.chead());
     EXPECT_EQ(block, active_head(_storage));
   }
 
   for (size_t i = 0; i < max_entries; ++i) {
     release_entry(_storage, entries[i]);
-    EXPECT_TRUE(is_allocate_list_sorted(_storage));
+    EXPECT_TRUE(is_allocation_list_sorted(_storage));
     EXPECT_EQ(max_entries - (i + 1), total_allocation_count(_storage));
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(active_count(_storage), empty_block_count(_storage));
-  for (const OopBlock* block = allocate_list.chead();
+  for (const OopBlock* block = allocation_list.chead();
        block != NULL;
-       block = allocate_list.next(*block)) {
+       block = allocation_list.next(*block)) {
     EXPECT_TRUE(TestAccess::block_is_empty(*block));
   }
 }
@@ -420,10 +420,10 @@
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(_max_entries, total_allocation_count(_storage));
-  EXPECT_GE(1u, list_length(allocate_list));
+  EXPECT_GE(1u, list_length(allocation_list));
 
   // Release all entries in "random" order.
   size_t released = 0;
@@ -433,14 +433,14 @@
       _entries[i] = NULL;
       ++released;
       EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-      EXPECT_TRUE(is_allocate_list_sorted(_storage));
+      EXPECT_TRUE(is_allocation_list_sorted(_storage));
     }
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(0u, total_allocation_count(_storage));
-  EXPECT_EQ(list_length(allocate_list), empty_block_count(_storage));
+  EXPECT_EQ(list_length(allocation_list), empty_block_count(_storage));
 }
 
 TEST_VM_F(OopStorageTestWithAllocation, random_allocate_release) {
@@ -450,10 +450,10 @@
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(_max_entries, total_allocation_count(_storage));
-  EXPECT_GE(1u, list_length(allocate_list));
+  EXPECT_GE(1u, list_length(allocation_list));
 
   // Release all entries in "random" order, "randomly" interspersed
   // with additional allocations.
@@ -466,20 +466,20 @@
       ++released;
       ++total_released;
       EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-      EXPECT_TRUE(is_allocate_list_sorted(_storage));
+      EXPECT_TRUE(is_allocation_list_sorted(_storage));
       if (total_released % allocate_step == 0) {
         _entries[i] = _storage.allocate();
         --released;
         EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-        EXPECT_TRUE(is_allocate_list_sorted(_storage));
+        EXPECT_TRUE(is_allocation_list_sorted(_storage));
       }
     }
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(0u, total_allocation_count(_storage));
-  EXPECT_EQ(list_length(allocate_list), empty_block_count(_storage));
+  EXPECT_EQ(list_length(allocation_list), empty_block_count(_storage));
 }
 
 template<bool sorted>
@@ -1200,10 +1200,10 @@
 const size_t OopStorageBlockCollectionTest::nvalues;
 const void* const OopStorageBlockCollectionTest::_pseudo_owner[] = {};
 
-class OopStorageAllocateListTest : public OopStorageBlockCollectionTest {};
+class OopStorageAllocationListTest : public OopStorageBlockCollectionTest {};
 
-TEST_F(OopStorageAllocateListTest, empty_list) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, empty_list) {
+  AllocationList list;
 
   EXPECT_TRUE(is_list_empty(list));
   EXPECT_EQ(NULL_BLOCK, list.head());
@@ -1211,8 +1211,8 @@
   EXPECT_EQ(NULL_BLOCK, list.ctail());
 }
 
-TEST_F(OopStorageAllocateListTest, push_back) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, push_back) {
+  AllocationList list;
 
   for (size_t i = 0; i < nvalues; ++i) {
     list.push_back(*values[i]);
@@ -1241,8 +1241,8 @@
   clear_list(list);
 }
 
-TEST_F(OopStorageAllocateListTest, push_front) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, push_front) {
+  AllocationList list;
 
   for (size_t i = 0; i < nvalues; ++i) {
     list.push_front(*values[i]);
@@ -1271,22 +1271,22 @@
   clear_list(list);
 }
 
-class OopStorageAllocateListTestWithList : public OopStorageAllocateListTest {
+class OopStorageAllocationListTestWithList : public OopStorageAllocationListTest {
 public:
-  OopStorageAllocateListTestWithList() : list() {
+  OopStorageAllocationListTestWithList() : list() {
     for (size_t i = 0; i < nvalues; ++i) {
       list.push_back(*values[i]);
     }
   }
 
-  ~OopStorageAllocateListTestWithList() {
+  ~OopStorageAllocationListTestWithList() {
     clear_list(list);
   }
 
-  AllocateList list;
+  AllocationList list;
 };
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_front) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_front) {
   EXPECT_EQ(list.chead(), values[0]);
   EXPECT_EQ(list.ctail(), values[nvalues - 1]);
 
@@ -1304,7 +1304,7 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_back) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_back) {
   EXPECT_EQ(list.chead(), values[0]);
 
   list.unlink(*values[nvalues - 1]);
@@ -1321,7 +1321,7 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_middle) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_middle) {
   EXPECT_EQ(list.chead(), values[0]);
 
   size_t index = nvalues / 2;
@@ -1344,8 +1344,8 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTest, single) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, single) {
+  AllocationList list;
 
   list.push_back(*values[0]);
   EXPECT_EQ(NULL_BLOCK, list.next(*values[0]));
--- a/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -108,6 +108,16 @@
             out.shouldNotContain("shared class paths mismatch");
             out.shouldNotContain("BOOT classpath mismatch");
         }
+
+        // Test with no modules image in the <java home>/lib directory
+        renameModulesFile(java_home_dst);
+        {
+            ProcessBuilder pb = makeBuilder(java_home_dst + "/bin/java",
+                                            "-version");
+            OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-missing-modules");
+            out.shouldHaveExitValue(1);
+            out.shouldContain("Failed setting boot class path.");
+        }
     }
 
     // Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so"
@@ -144,6 +154,24 @@
         }
     }
 
+    static void renameModulesFile(String javaHome) throws Exception {
+        String modulesDir = javaHome + File.separator + "lib";
+        File origModules = new File(modulesDir, "modules");
+        if (!origModules.exists()) {
+            throw new RuntimeException("modules file not found");
+        }
+
+        File renamedModules = new File(modulesDir, "orig_modules");
+        if (renamedModules.exists()) {
+            throw new RuntimeException("found orig_modules unexpectedly");
+        }
+
+        boolean success = origModules.renameTo(renamedModules);
+        if (!success) {
+            throw new RuntimeException("rename modules file failed");
+        }
+    }
+
     static ProcessBuilder makeBuilder(String... args) throws Exception {
         System.out.print("[");
         for (String s : args) {
--- a/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Thu Jul 12 13:04:33 2018 -0700
@@ -33,6 +33,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import java.io.File;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Date;
 
@@ -343,4 +344,22 @@
         }
         return dirFile.getPath();
     }
+
+    public static boolean checkOutputStrings(String outputString1,
+                                             String outputString2,
+                                             String split_regex) {
+        String[] sa1 = outputString1.split(split_regex);
+        String[] sa2 = outputString2.split(split_regex);
+        Arrays.sort(sa1);
+        Arrays.sort(sa2);
+
+        int i = 0;
+        for (String s : sa1) {
+            if (!s.equals(sa2[i])) {
+                throw new RuntimeException(s + " is different from " + sa2[i]);
+            }
+            i ++;
+        }
+        return true;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleComboTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,138 @@
+/*
+ * 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
+ * @summary Test archived system module sub-graph and verify objects are archived.
+ * @requires vm.cds.archived.java.heap
+ * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @compile CheckArchivedModuleApp.java
+ * @run driver ClassFileInstaller -jar app.jar CheckArchivedModuleApp
+ * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
+ * @run main ArchivedModuleComboTest
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import sun.hotspot.WhiteBox;
+
+public class ArchivedModuleComboTest {
+    public static void main(String[] args) throws Exception {
+        String wbJar = ClassFileInstaller.getJarPath("WhiteBox.jar");
+        String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
+        String appJar = ClassFileInstaller.getJarPath("app.jar");
+
+        Path userDir = Paths.get(System.getProperty("user.dir"));
+        Path moduleDir = Files.createTempDirectory(userDir, "mods");
+
+        // Dump without --module-path
+        OutputAnalyzer output = TestCommon.dump(appJar,
+                                    TestCommon.list("CheckArchivedModuleApp"),
+                                    use_whitebox_jar);
+        TestCommon.checkDump(output);
+
+        // Test case 1)
+        // - Dump without --module-path
+        // - Run from -cp only, archived boot layer module ModuleDescriptors
+        //   should be used.
+        System.out.println("----------------------- Test case 1 ----------------------");
+        output = TestCommon.exec(appJar, use_whitebox_jar,
+                                 "-XX:+UnlockDiagnosticVMOptions",
+                                 "-XX:+WhiteBoxAPI",
+                                 "CheckArchivedModuleApp",
+                                 "yes");
+        TestCommon.checkExec(output);
+
+        // Test case 2)
+        // - Dump without --module-path
+        // - Run from -cp only, archived boot layer module ModuleDescriptors
+        //   should be used with --show-module-resolution (requires resolution).
+        System.out.println("----------------------- Test case 2 ----------------------");
+        output = TestCommon.exec(appJar, use_whitebox_jar,
+                                 "--show-module-resolution",
+                                 "-XX:+UnlockDiagnosticVMOptions",
+                                 "-XX:+WhiteBoxAPI",
+                                 "CheckArchivedModuleApp",
+                                 "yes");
+        TestCommon.checkExec(output);
+
+        // Test case 3)
+        // - Dump without --module-path
+        // - Run with --module-path, archived boot layer module ModuleDescriptors
+        //   should be disabled.
+        System.out.println("----------------------- Test case 3 ----------------------");
+        output = TestCommon.exec(appJar, use_whitebox_jar,
+                                 "--module-path",
+                                 moduleDir.toString(),
+                                 "-XX:+UnlockDiagnosticVMOptions",
+                                 "-XX:+WhiteBoxAPI",
+                                 "CheckArchivedModuleApp",
+                                 "no");
+        TestCommon.checkExec(output);
+
+        // Dump with --module-path specified (test case 4, 5). Use an
+        // empty directory as it's simple and still triggers the case
+        // where system module objects are not archived.
+        output = TestCommon.dump(appJar,
+                                 TestCommon.list("CheckArchivedModuleApp"),
+                                 "--module-path",
+                                 moduleDir.toString(),
+                                 use_whitebox_jar);
+        TestCommon.checkDump(output);
+
+        // Test case 4)
+        // - Dump with --module-path
+        // - Run from -cp only, no archived boot layer module ModuleDescriptors
+        //   should be found.
+        System.out.println("----------------------- Test case 4 ----------------------");
+        output = TestCommon.exec(appJar, use_whitebox_jar,
+                                 "-XX:+UnlockDiagnosticVMOptions",
+                                 "-XX:+WhiteBoxAPI",
+                                 "CheckArchivedModuleApp",
+                                 "no");
+        TestCommon.checkExec(output);
+
+        // Test case 5)
+        // - Dump with --module-path
+        // - Run with --module-path, no archived boot layer module ModuleDescriptors
+        //   should be found.
+        System.out.println("----------------------- Test case 5 ----------------------");
+        output = TestCommon.exec(appJar, use_whitebox_jar,
+                                 "--module-path",
+                                 moduleDir.toString(),
+                                 "-XX:+UnlockDiagnosticVMOptions",
+                                 "-XX:+WhiteBoxAPI",
+                                 "CheckArchivedModuleApp",
+                                 "no");
+        TestCommon.checkExec(output);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleCompareTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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
+ * @summary Compare archived system modules with non-archived.
+ * @requires vm.cds.archived.java.heap
+ * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
+ * @compile PrintSystemModulesApp.java
+ * @run driver ClassFileInstaller -jar app.jar PrintSystemModulesApp
+ * @run main ArchivedModuleCompareTest
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class ArchivedModuleCompareTest {
+    public static void main(String[] args) throws Exception {
+        String appJar = ClassFileInstaller.getJarPath("app.jar");
+
+        // Test case 1)
+        // Compare the list of archived system module names with non-archived
+        // list. They must be the same.
+        System.out.println("---------------- Test case 1 -----------------");
+        OutputAnalyzer output = TestCommon.dump(appJar,
+                        TestCommon.list("PrintSystemModulesApp"));
+        TestCommon.checkDump(output);
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                                 "-cp", appJar,
+                                 "-Xshare:off",
+                                 "PrintSystemModulesApp");
+        output = TestCommon.executeAndLog(pb, "print.system.module.share.off");
+        output.shouldHaveExitValue(0);
+        String bootModules1 = output.getStdout();
+
+        output = TestCommon.exec(appJar,
+                                 "PrintSystemModulesApp");
+        TestCommon.checkExec(output);
+        if (output.getStderr().contains("sharing")) {
+            String bootModules2 = output.getStdout();
+            TestCommon.checkOutputStrings(bootModules1, bootModules2, ", ");
+        }
+
+        // Test case 2)
+        // Verify --show-module-resolution output with the output from
+        // -Xshare:off run
+        System.out.println("---------------- Test case 2 -----------------");
+        pb = ProcessTools.createJavaProcessBuilder(
+                                 "-Xshare:off",
+                                 "--show-module-resolution",
+                                 "-version");
+        output = TestCommon.executeAndLog(pb, "show.module.resolution.share.off");
+        output.shouldHaveExitValue(0);
+        String moduleResolutionOut1 = output.getStdout();
+
+        output = TestCommon.exec(appJar,
+                                 "--show-module-resolution",
+                                 "-version");
+        TestCommon.checkExec(output);
+        if (output.getStderr().contains("sharing")) {
+            String moduleResolutionOut2 = output.getStdout();
+            TestCommon.checkOutputStrings(
+                moduleResolutionOut1, moduleResolutionOut2, "\n");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,184 @@
+/**
+ * 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
+ * @summary Test archived module graph with custom runtime image
+ * @requires vm.cds.archived.java.heap
+ * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules java.base/jdk.internal.module
+ *          java.management
+ *          jdk.jlink
+ *          jdk.compiler
+ * @build sun.hotspot.WhiteBox
+ * @compile CheckArchivedModuleApp.java
+ * @run driver ClassFileInstaller -jar app.jar CheckArchivedModuleApp
+ * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox
+ * @run main ArchivedModuleWithCustomImageTest
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class ArchivedModuleWithCustomImageTest {
+    private static final String JAVA_HOME = System.getProperty("java.home");
+    private static final String TEST_MODULE = "test";
+    private static final Path jdkHome = Paths.get(System.getProperty("test.jdk"));
+    private static final Path jdkMods = jdkHome.resolve("jmods");
+    private static final Path testSrc = Paths.get(System.getProperty("test.src"));
+    private static final Path src = testSrc.resolve("src").resolve(TEST_MODULE);
+    private static final Path classes = Paths.get("classes");
+    private static final Path jmods = Paths.get("jmods");
+
+    public static void main(String[] args) throws Throwable {
+        if (Files.notExists(jdkMods)) {
+            System.out.println("No jmods/ in test JDK, not supported.");
+            return;
+        }
+
+        // compile test module class
+        if (!CompilerUtils.compile(src, classes)) {
+            throw new RuntimeException("Compilation failure.");
+        }
+
+        // create custom runtime image named 'myimage'
+        Files.createDirectories(jmods);
+        Path image = Paths.get("myimage");
+        runJmod(classes.toString(), TEST_MODULE);
+        runJlink(image, TEST_MODULE);
+
+        // test using 'myimage'
+        testArchivedModuleUsingImage(image);
+
+        Files.delete(jmods.resolve(TEST_MODULE + ".jmod"));
+    }
+
+    private static void runJlink(Path image, String modName) throws Throwable {
+        Path jlink = Paths.get(JAVA_HOME, "bin", "jlink");
+        OutputAnalyzer output = ProcessTools.executeProcess(jlink.toString(),
+                        "--output", image.toString(),
+                        "--add-modules", modName,
+                        "--module-path", jdkMods + File.pathSeparator + jmods);
+        output.shouldHaveExitValue(0);
+    }
+
+    private static void runJmod(String cp, String modName) throws Throwable {
+        Path jmod = Paths.get(JAVA_HOME, "bin", "jmod");
+        OutputAnalyzer output = ProcessTools.executeProcess(jmod.toString(),
+                       "create",
+                       "--class-path", cp,
+                       "--module-version", "1.0",
+                       "--main-class", "jdk.test.Test",
+                       jmods.resolve(modName + ".jmod").toString());
+        output.shouldHaveExitValue(0);
+    }
+
+    private static void testArchivedModuleUsingImage(Path image)
+                            throws Throwable {
+        String wbJar = ClassFileInstaller.getJarPath("WhiteBox.jar");
+        String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
+        String appJar = ClassFileInstaller.getJarPath("app.jar");
+        Path customJava = Paths.get(image.toString(), "bin", "java");
+
+        // -Xshare:dump with custom runtime image
+        String[] dumpCmd = {
+            customJava.toString(),
+            "-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa",
+            "-Xshare:dump"};
+        printCommand(dumpCmd);
+        ProcessBuilder pbDump = new ProcessBuilder();
+        pbDump.command(dumpCmd);
+        OutputAnalyzer output = TestCommon.executeAndLog(
+            pbDump, "custom.runtime.image.dump");
+        TestCommon.checkDump(output);
+
+        // Test case 1):
+        // test archived module graph objects are used with custome runtime image
+        System.out.println("------------------- Test case 1 -------------------");
+        String[] runCmd = {customJava.toString(),
+                           use_whitebox_jar,
+                           "-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa",
+                           "-cp",
+                           appJar,
+                           "-Xshare:on",
+                           "-XX:+UnlockDiagnosticVMOptions",
+                           "-XX:+WhiteBoxAPI",
+                           "CheckArchivedModuleApp",
+                           "yes"};
+        printCommand(runCmd);
+        ProcessBuilder pbRun = new ProcessBuilder();
+        pbRun.command(runCmd);
+        output = TestCommon.executeAndLog(pbRun, "custom.runtime.image.run");
+        output.shouldHaveExitValue(0);
+
+
+        // Test case 2):
+        // verify --show-module-resolution output
+        System.out.println("------------------- Test case 2 -------------------");
+
+        // myimage/bin/java -Xshare:off --show-module-resolution -version
+        String[] showModuleCmd1 = {customJava.toString(),
+                                   "-Xshare:off",
+                                   "--show-module-resolution",
+                                   "-version"};
+        printCommand(showModuleCmd1);
+        pbRun = new ProcessBuilder();
+        pbRun.command(showModuleCmd1);
+        output = TestCommon.executeAndLog(
+            pbRun, "custom.runtime.image.showModuleResolution.nocds");
+        output.shouldHaveExitValue(0);
+        String moduleResolutionOut1 = output.getStdout();
+
+        // myimage/bin/java -Xshare:on --show-module-resolution -version
+        //    -XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa
+        String[] showModuleCmd2 = {
+            customJava.toString(),
+            "-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa",
+            "-Xshare:on",
+            "--show-module-resolution",
+            "-version"};
+        printCommand(showModuleCmd2);
+        pbRun = new ProcessBuilder();
+        pbRun.command(showModuleCmd2);
+        output = TestCommon.executeAndLog(
+            pbRun, "custom.runtime.image.showModuleResolution.cds");
+        if (output.getStderr().contains("sharing")) {
+            String moduleResolutionOut2 = output.getStdout();
+            TestCommon.checkOutputStrings(
+                moduleResolutionOut1, moduleResolutionOut2, "\n");
+        }
+    }
+
+    private static void printCommand(String opts[]) {
+        StringBuilder cmdLine = new StringBuilder();
+        for (String cmd : opts)
+            cmdLine.append(cmd).append(' ');
+        System.out.println("Command line: [" + cmdLine.toString() + "]");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ *
+ */
+
+import java.io.File;
+import java.lang.module.ModuleDescriptor;
+import java.util.Set;
+import sun.hotspot.WhiteBox;
+
+//
+// Test archived system module graph when open archive heap objects are mapped:
+//
+public class CheckArchivedModuleApp {
+    static WhiteBox wb;
+    public static void main(String args[]) throws Exception {
+        wb = WhiteBox.getWhiteBox();
+
+        if (!wb.areOpenArchiveHeapObjectsMapped()) {
+            System.out.println("Archived open_archive_heap objects are not mapped.");
+            System.out.println("This may happen during normal operation. Test Skipped.");
+            return;
+        }
+
+        boolean expectArchived = "yes".equals(args[0]);
+        checkModuleDescriptors(expectArchived);
+    }
+
+    private static void checkModuleDescriptors(boolean expectArchived) {
+        Set<Module> modules = ModuleLayer.boot().modules();
+        for (Module m : modules) {
+            ModuleDescriptor md = m.getDescriptor();
+            String name = md.name();
+            if (expectArchived) {
+                if (wb.isShared(md)) {
+                    System.out.println(name + " is archived. Expected.");
+                } else {
+                    throw new RuntimeException(
+                        "FAILED. " + name + " is not archived. Expect archived.");
+                }
+            } else {
+                if (!wb.isShared(md)) {
+                    System.out.println(name + " is not archived. Expected.");
+                } else {
+                    throw new RuntimeException(
+                        "FAILED. " + name + " is archived. Expect not archived.");
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/PrintSystemModulesApp.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ */
+
+//
+// Print the system module names
+//
+public class PrintSystemModulesApp {
+    public static void main(String args[]) throws Exception {
+        String modules = ModuleLayer.boot().toString();
+        System.out.println(modules + ", ");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/src/test/jdk/test/Test.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+package jdk.test;
+
+public class Test {
+    public static void main(String[] args) {
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ClassLoader cl1 = Test.class.getClassLoader();
+        Module testModule = Test.class.getModule();
+        ClassLoader cl2 = ModuleLayer.boot().findLoader(testModule.getName());
+
+        if (cl1 != scl)
+            throw new RuntimeException("Not loaded by system class loader");
+        if (cl2 != scl)
+            throw new RuntimeException("Not associated with system class loader");
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/src/test/module-info.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+module test {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+import java.lang.management.*;
+
+/*
+ * @test
+ * @bug     8205878 8206954
+ * @requires os.family != "windows" & os.family != "solaris"
+ * @summary Basic test of Thread and ThreadMXBean queries on a natively
+ *          attached thread that has failed to detach before terminating.
+ * @comment The native code only supports POSIX so no windows testing; also
+ *          we have to skip solaris as a terminating thread that fails to
+ *          detach will hit an infinite loop due to TLS destructor issues - see
+ *          comments in JDK-8156708
+ * @run main/othervm/native TestTerminatedThread
+ */
+
+public class TestTerminatedThread {
+
+    static native Thread createTerminatedThread();
+
+    static {
+        System.loadLibrary("terminatedThread");
+    }
+
+    private static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+
+    public static void main(String[] args) throws Throwable {
+
+        Thread t = createTerminatedThread();
+
+        if (!t.isAlive())
+            throw new Error("Thread is only supposed to terminate at native layer!");
+
+        // Now invoke the various functions on this thread to
+        // make sure the VM handles it okay. The focus is on
+        // functions with an underlying native OS implementation.
+        // Generally as long as we don't crash or throw unexpected
+        // exceptions then the test passes. In some cases we know exactly
+        // what a function should return and so can check that.
+
+        System.out.println("Working with thread: " + t +
+                           ",  in state: " + t.getState());
+
+        System.out.println("Calling suspend ...");
+        t.suspend();
+        System.out.println("Calling resume ...");
+        t.resume();
+        System.out.println("Calling getStackTrace ...");
+        StackTraceElement[] stack = t.getStackTrace();
+        System.out.println(java.util.Arrays.toString(stack));
+        if (stack.length != 0)
+            throw new Error("Terminated thread should have empty java stack trace");
+        System.out.println("Calling setName(\"NewName\") ...");
+        t.setName("NewName");
+        System.out.println("Calling interrupt ...");
+        t.interrupt();
+        System.out.println("Calling stop ...");
+        t.stop();
+
+        // Now the ThreadMXBean functions
+
+        if (mbean.isThreadCpuTimeSupported() &&
+            mbean.isThreadCpuTimeEnabled() ) {
+            System.out.println("Calling getThreadCpuTime ...");
+            long t1 = mbean.getThreadCpuTime(t.getId());
+            if (t1 != -1) {
+                throw new RuntimeException("Invalid ThreadCpuTime returned = " +
+                                           t1 + " expected = -1");
+            }
+            System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
+        } else {
+            System.out.println("Skipping Thread CPU time test as it's not supported");
+        }
+
+        System.out.println("Calling getThreadUserTime ...");
+        long t1 = mbean.getThreadUserTime(t.getId());
+        if (t1 != -1) {
+            throw new RuntimeException("Invalid ThreadUserTime returned = " +
+                                       t1 + " expected = -1");
+        }
+        System.out.println("Okay: getThreadUserTime() reported -1 as expected");
+
+        System.out.println("Calling getThreadInfo ...");
+        ThreadInfo info = mbean.getThreadInfo(t.getId());
+        System.out.println(info);
+
+        System.out.println("Calling getThreadInfo with stack ...");
+        info = mbean.getThreadInfo(t.getId(), Integer.MAX_VALUE);
+        System.out.println(info);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/terminatedThread/libterminatedThread.c	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <pthread.h>
+#include <string.h>
+
+#include "jni.h"
+#include "jni_util.h"
+
+
+JavaVM* jvm;
+jobject nativeThread;
+
+static void * thread_start(void* unused) {
+  JNIEnv *env;
+  jclass class_id;
+  jmethodID method_id;
+  int res;
+
+  printf("Native thread is running and attaching as daemon ...\n");
+
+  res = (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, NULL);
+  if (res != JNI_OK) {
+    fprintf(stderr, "Test ERROR. Can't attach current thread: %d\n", res);
+    exit(1);
+  }
+
+  class_id = (*env)->FindClass (env, "java/lang/Thread");
+  if (class_id == NULL) {
+    fprintf(stderr, "Test ERROR. Can't load class Thread\n");
+    exit(1);
+  }
+
+  method_id = (*env)->GetStaticMethodID(env, class_id, "currentThread",
+                                        "()Ljava/lang/Thread;");
+  if (method_id == NULL) {
+    fprintf(stderr, "Test ERROR. Can't find method currentThread\n");
+    exit(1);
+  }
+
+  nativeThread = (*env)->CallStaticObjectMethod(env, class_id, method_id, NULL);
+
+  if ((*env)->ExceptionOccurred(env) != NULL) {
+    (*env)->ExceptionDescribe(env);
+    exit(1);
+  }
+  printf("Native thread terminating\n");
+
+  return NULL;
+}
+
+JNIEXPORT jobject JNICALL
+Java_TestTerminatedThread_createTerminatedThread
+(JNIEnv *env, jclass cls) {
+  pthread_t thread;
+  int res = (*env)->GetJavaVM(env, &jvm);
+  if (res != JNI_OK) {
+    fprintf(stderr, "Test ERROR. Can't extract JavaVM: %d\n", res);
+    exit(1);
+  }
+
+  if ((res = pthread_create(&thread, NULL, thread_start, NULL)) != 0) {
+    fprintf(stderr, "TEST ERROR: pthread_create failed: %s (%d)\n", strerror(res), res);
+    exit(1);
+  }
+
+  if ((res = pthread_join(thread, NULL)) != 0) {
+    fprintf(stderr, "TEST ERROR: pthread_join failed: %s (%d)\n", strerror(res), res);
+    exit(1);
+  }
+
+  return nativeThread;
+}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.c	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.c	Thu Jul 12 13:04:33 2018 -0700
@@ -333,8 +333,11 @@
     checkIntercept(1, 0, 1); /* expected interceptions: 1 */
     NSK_DISPLAY0("\n<<< TEST CASE #4) done\n");
 
-    NSK_DISPLAY1("\nagent A: returning exit code %d\n",
+    NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n",
         exitCode);
+    if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) {
+        NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res);
+    }
     return exitCode;
 }
 
@@ -393,8 +396,11 @@
 
     redir[1] = 1;
 
-    NSK_DISPLAY1("\nagent B: returning exit code %d\n",
+    NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n",
         exitCode);
+    if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) {
+        NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res);
+    }
     return exitCode;
 }
 /*********************/
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.c	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.c	Thu Jul 12 13:04:33 2018 -0700
@@ -62,6 +62,18 @@
 #define TRIES 30
 #define MAX_THREADS 5
 
+// Helper for thread detach and terminate
+#define THREAD_return(status) \
+  do { \
+      int res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm)); \
+      if (res != 0) \
+          NSK_COMPLAIN1("TEST WARNING: DetachCurrentThread() returns: %d\n", res); \
+      else \
+          NSK_DISPLAY0("Detaching thread ...\n"); \
+      return status; \
+  } while (0)
+
+
 static const char *javaField = "_ji06t001a";
 static const char *classSig =
     "Lnsk/jvmti/scenarios/jni_interception/JI06/ji06t001a;";
@@ -225,16 +237,16 @@
     thrStarted[indx-1] = 1; /* the thread is started */
 
     if (enterMonitor(env, "waitingThread") == STATUS_FAILED)
-        return STATUS_FAILED;
+        THREAD_return(STATUS_FAILED);
     if (verbose)
         printf("waitingThread: thread #%d entered the monitor\n",
             indx);
     if (exitMonitor(env, "waitingThread") == STATUS_FAILED)
-        return STATUS_FAILED;
+        THREAD_return(STATUS_FAILED);
 
     NSK_DISPLAY2("waitingThread: thread #%d exits the monitor\n\treturning %d\n",
         indx, exitCode);
-    return exitCode;
+    THREAD_return(exitCode);
 }
 
 static int ownerThread(void *context) {
@@ -254,7 +266,7 @@
 
     NSK_DISPLAY0("ownerThread: trying to enter the monitor ...\n");
     if (enterMonitor(env, "ownerThread") == STATUS_FAILED)
-        return STATUS_FAILED;
+        THREAD_return(STATUS_FAILED);
 
     monEntered = 1; /* the monitor has been entered */
     NSK_DISPLAY1("ownerThread: entered the monitor: monEntered=%d\n\
@@ -272,12 +284,12 @@
     } while(releaseMon != 1);
 
     if (exitMonitor(env, "ownerThread") == STATUS_FAILED)
-        return STATUS_FAILED;
+        THREAD_return(STATUS_FAILED);
 
     NSK_DISPLAY1("ownerThread: exits the monitor\n\treturning %d\n",
         exitCode);
 
-    return exitCode;
+    THREAD_return(exitCode);
 }
 
 static int redirectorThread(void *context) {
@@ -301,7 +313,7 @@
     NSK_DISPLAY1("redirectorThread: the MonitorEnter() redirected\n\treturning %d\n",
         exitCode);
 
-    return exitCode;
+    THREAD_return(exitCode);
 }
 /*********************/
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/transform/SAXTFactoryTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+package transform;
+
+import java.util.Properties;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.XMLFilter;
+
+/*
+ * @test
+ * @bug 8206164
+ * @modules java.xml
+ * @run testng transform.SAXTFactoryTest
+ * @summary Tests SAXTransformerFactory.
+ */
+public class SAXTFactoryTest {
+
+    /*
+     * Verifies that the default ErrorListener throws a TransformerException
+     * when a fatal error is encountered. It is then wrapped and thrown again in
+     * a TransformerConfigurationException.
+    */
+    @Test
+    public void testErrorListener() throws Exception {
+        try {
+            SAXTransformerFactory saxTFactory =
+                    (SAXTransformerFactory)TransformerFactory.newInstance();
+            XMLFilter filter = saxTFactory.newXMLFilter(new ATemplatesImpl());
+        } catch (TransformerConfigurationException tce) {
+            Throwable cause = tce.getCause();
+            Assert.assertTrue((cause != null && cause instanceof TransformerException),
+                    "The TransformerFactoryImpl terminates upon a fatal error "
+                            + "by throwing a TransformerException.");
+        }
+
+    }
+
+    class ATemplatesImpl implements Templates {
+
+        @Override
+        public Transformer newTransformer() throws TransformerConfigurationException {
+            throw new TransformerConfigurationException("TCE from ATemplatesImpl");
+        }
+
+        @Override
+        public Properties getOutputProperties() {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineNestmateAttr/TestNestmateAttr.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/com/sun/jdi/RedefineNestmateAttr/TestNestmateAttr.java	Thu Jul 12 13:04:33 2018 -0700
@@ -189,12 +189,14 @@
 
         }
 
+        breakpoint();    // debugger runs to here before enabling events
         allowRedefine(); // debugger stops us here to attempt redefinitions
 
         System.out.println("Target executed okay");
     }
 
-    public static void allowRedefine() { }
+    static void allowRedefine() { }
+    static void breakpoint() { }
 }
 
 public class TestNestmateAttr extends TestScaffold {
@@ -226,7 +228,7 @@
 
     public void runTests() throws Exception {
         // Get Target into debuggable state
-        BreakpointEvent bpe = startToMain("Target");
+        BreakpointEvent bpe = startTo("Target", "breakpoint", "()V");
         EventRequestManager erm = vm().eventRequestManager();
         MethodEntryRequest mee = erm.createMethodEntryRequest();
         mee.addClassFilter("Target");
--- a/test/jdk/java/lang/System/SetProperties.java	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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.
- */
-
-/*
- * @test
- * @bug 4244670
- * @summary test System.setProperties(null)
- */
-
-import java.util.Properties;
-
-public class SetProperties {
-    public static void main(String [] argv) {
-        System.setProperties((Properties)null);
-        System.getProperties().containsKey("java.version");
-    }
-}
--- a/test/jdk/java/lang/System/SetPropertiesNull.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/java/lang/System/SetPropertiesNull.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,7 +26,7 @@
  * reinitialized after setting System.setProperties(null).
  *
  * @test
- * @bug 8030781
+ * @bug 4244670 8030781
  * @summary Test for System.setProperties(null).
  */
 
--- a/test/jdk/java/lang/reflect/OldenCompilingWithDefaults.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/java/lang/reflect/OldenCompilingWithDefaults.java	Thu Jul 12 13:04:33 2018 -0700
@@ -25,7 +25,6 @@
  * @test
  * @bug 8009267
  * @summary Verify uses of isAnnotationPresent compile under older source versions
- * @compile -source 1.6 -target 1.6 OldenCompilingWithDefaults.java
  * @compile -source 1.7 -target 1.7 OldenCompilingWithDefaults.java
  * @compile                         OldenCompilingWithDefaults.java
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ArrayDeque/WhiteBox.java	Thu Jul 12 13:04:33 2018 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Martin Buchholz with assistance from members of JCP
+ * JSR-166 Expert Group and released to the public domain, as
+ * explained at http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/*
+ * @test
+ * @modules java.base/java.util:open
+ * @run testng WhiteBox
+ * @summary White box tests of implementation details
+ */
+
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
+import java.util.ArrayDeque;
+import java.util.concurrent.ThreadLocalRandom;
+
+@Test
+public class WhiteBox {
+    final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+    final VarHandle ELEMENTS, HEAD, TAIL;
+
+    WhiteBox() throws ReflectiveOperationException {
+        Class<?> klazz = ArrayDeque.class;
+        MethodHandles.Lookup lookup
+            = MethodHandles.privateLookupIn(klazz, MethodHandles.lookup());
+        ELEMENTS = lookup.findVarHandle(klazz, "elements", Object[].class);
+        HEAD = lookup.findVarHandle(klazz, "head", int.class);
+        TAIL = lookup.findVarHandle(klazz, "tail", int.class);
+    }
+
+    Object[] elements(ArrayDeque d) { return (Object[]) ELEMENTS.get(d); }
+    int head(ArrayDeque d) { return (int) HEAD.get(d); }
+    int tail(ArrayDeque d) { return (int) TAIL.get(d); }
+
+    void checkCapacity(ArrayDeque d, int capacity) {
+        assertTrue(d.isEmpty());
+        assertEquals(0, head(d));
+        assertEquals(0, tail(d));
+        Object[] initialElements = elements(d);
+
+        assertInvariants(d);
+        for (int i = capacity; i--> 0; ) {
+            d.add(rnd.nextInt(42));
+            assertSame(elements(d), initialElements);
+            assertInvariants(d);
+        }
+
+        d.add(rnd.nextInt(42));
+        assertNotSame(elements(d), initialElements);
+        assertInvariants(d);
+    }
+
+    @Test
+    public void defaultConstructor() {
+        checkCapacity(new ArrayDeque(), 16);
+    }
+
+    @Test
+    public void shouldNotResizeWhenInitialCapacityProvided() {
+        int initialCapacity = rnd.nextInt(20);
+        checkCapacity(new ArrayDeque(initialCapacity), initialCapacity);
+    }
+
+    byte[] serialBytes(Object o) {
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(bos);
+            oos.writeObject(o);
+            oos.flush();
+            oos.close();
+            return bos.toByteArray();
+        } catch (Exception fail) {
+            throw new AssertionError(fail);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    <T> T serialClone(T o) {
+        try {
+            ObjectInputStream ois = new ObjectInputStream
+                (new ByteArrayInputStream(serialBytes(o)));
+            T clone = (T) ois.readObject();
+            assertNotSame(o, clone);
+            assertSame(o.getClass(), clone.getClass());
+            return clone;
+        } catch (Exception fail) {
+            throw new AssertionError(fail);
+        }
+    }
+
+    @Test
+    public void testSerialization() {
+        ArrayDeque[] ds = { new ArrayDeque(), new ArrayDeque(rnd.nextInt(20)) };
+        for (ArrayDeque d : ds) {
+            if (rnd.nextBoolean()) d.add(99);
+            ArrayDeque clone = serialClone(d);
+            assertInvariants(clone);
+            assertNotSame(elements(d), elements(clone));
+            assertEquals(d, clone);
+        }
+    }
+
+    /** Checks conditions which should always be true. */
+    void assertInvariants(ArrayDeque d) {
+        final Object[] elements = elements(d);
+        final int head = head(d);
+        final int tail = tail(d);
+        final int capacity = elements.length;
+        assertTrue(0 <= head && head < capacity);
+        assertTrue(0 <= tail && tail < capacity);
+        assertTrue(capacity > 0);
+        assertTrue(d.size() < capacity);
+        assertTrue((head == tail) ^ (elements[head] != null));
+        assertNull(elements[tail]);
+        assertTrue((head == tail) ^ (elements[Math.floorMod(tail - 1, capacity)] != null));
+    }
+}
--- a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -47,6 +47,7 @@
 public class SystemPropertyTests {
 
     private static String LANGPROP = "-Duser.language=en";
+    private static String SCPTPROP = "-Duser.script=";
     private static String CTRYPROP = "-Duser.country=US";
 
     @DataProvider(name="data")
@@ -88,7 +89,7 @@
     @Test(dataProvider="data")
     public void runTest(String extprop, String defLoc,
                         String defFmtLoc, String defDspLoc) throws Exception {
-        int exitValue = executeTestJava(LANGPROP, CTRYPROP,
+        int exitValue = executeTestJava(LANGPROP, SCPTPROP, CTRYPROP,
                                     extprop, "DefaultLocaleTest", defLoc, defFmtLoc, defDspLoc)
                             .outputTo(System.out)
                             .errorTo(System.out)
--- a/test/jdk/java/util/concurrent/forkjoin/FJExceptionTableLeak.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/java/util/concurrent/forkjoin/FJExceptionTableLeak.java	Thu Jul 12 13:04:33 2018 -0700
@@ -34,77 +34,102 @@
 
 /*
  * @test
- * @bug 8004138
+ * @bug 8004138 8205576
  * @modules java.base/java.util.concurrent:open
+ * @run testng FJExceptionTableLeak
  * @summary Checks that ForkJoinTask thrown exceptions are not leaked.
  * This whitebox test is sensitive to forkjoin implementation details.
  */
 
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.ForkJoinTask;
 import java.util.concurrent.RecursiveAction;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.BooleanSupplier;
 
+@Test
 public class FJExceptionTableLeak {
+    final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+    final VarHandle NEXT, EX;
+    final Object[] exceptionTable;
+    final ReentrantLock exceptionTableLock;
+
+    FJExceptionTableLeak() throws ReflectiveOperationException {
+        MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(
+            ForkJoinTask.class, MethodHandles.lookup());
+        Class<?> nodeClass = Class.forName(
+            ForkJoinTask.class.getName() + "$ExceptionNode");
+        VarHandle exceptionTableHandle = lookup.findStaticVarHandle(
+            ForkJoinTask.class, "exceptionTable", arrayClass(nodeClass));
+        VarHandle exceptionTableLockHandle = lookup.findStaticVarHandle(
+            ForkJoinTask.class, "exceptionTableLock", ReentrantLock.class);
+        exceptionTable = (Object[]) exceptionTableHandle.get();
+        exceptionTableLock = (ReentrantLock) exceptionTableLockHandle.get();
+
+        NEXT = lookup.findVarHandle(nodeClass, "next", nodeClass);
+        EX = lookup.findVarHandle(nodeClass, "ex", Throwable.class);
+    }
+
+    static <T> Class<T[]> arrayClass(Class<T> klazz) {
+        try {
+            return (Class<T[]>) Class.forName("[L" + klazz.getName() + ";");
+        } catch (ReflectiveOperationException ex) {
+            throw new Error(ex);
+        }
+    }
+
+    Object next(Object node) { return NEXT.get(node); }
+    Throwable ex(Object node) { return (Throwable) EX.get(node); }
+
     static class FailingTaskException extends RuntimeException {}
     static class FailingTask extends RecursiveAction {
         public void compute() { throw new FailingTaskException(); }
     }
 
-    static int bucketsInuse(Object[] exceptionTable) {
-        int count = 0;
-        for (Object x : exceptionTable)
-            if (x != null) count++;
-        return count;
+    /** Counts all FailingTaskExceptions still recorded in exceptionTable. */
+    int retainedExceptions() {
+        exceptionTableLock.lock();
+        try {
+            int count = 0;
+            for (Object node : exceptionTable)
+                for (; node != null; node = next(node))
+                    if (ex(node) instanceof FailingTaskException)
+                        count++;
+            return count;
+        } finally {
+            exceptionTableLock.unlock();
+        }
     }
 
-    public static void main(String[] args) throws Exception {
-        final ForkJoinPool pool = new ForkJoinPool(4);
-        final Field exceptionTableField =
-            ForkJoinTask.class.getDeclaredField("exceptionTable");
-        exceptionTableField.setAccessible(true);
-        final Object[] exceptionTable = (Object[]) exceptionTableField.get(null);
+    @Test
+    public void exceptionTableCleanup() throws Exception {
+        ArrayList<FailingTask> failedTasks = failedTasks();
 
-        if (bucketsInuse(exceptionTable) != 0) throw new AssertionError();
-
-        final ArrayList<FailingTask> tasks = new ArrayList<>();
-
-        // Keep submitting failing tasks until most of the exception
-        // table buckets are in use
-        do {
-            for (int i = 0; i < exceptionTable.length; i++) {
-                FailingTask task = new FailingTask();
-                pool.execute(task);
-                tasks.add(task); // retain strong refs to all tasks, for now
-            }
-            for (FailingTask task : tasks) {
-                try {
-                    task.join();
-                    throw new AssertionError("should throw");
-                } catch (FailingTaskException success) {}
-            }
-        } while (bucketsInuse(exceptionTable) < exceptionTable.length * 3 / 4);
-
-        // Retain a strong ref to one last failing task;
-        // task.join() will trigger exception table expunging.
-        FailingTask lastTask = tasks.get(0);
+        // Retain a strong ref to one last failing task
+        FailingTask lastTask = failedTasks.get(rnd.nextInt(failedTasks.size()));
 
         // Clear all other strong refs, making exception table cleanable
-        tasks.clear();
+        failedTasks.clear();
 
         BooleanSupplier exceptionTableIsClean = () -> {
             try {
+                // Trigger exception table expunging as side effect
                 lastTask.join();
                 throw new AssertionError("should throw");
             } catch (FailingTaskException expected) {}
-            int count = bucketsInuse(exceptionTable);
+            int count = retainedExceptions();
             if (count == 0)
                 throw new AssertionError("expected to find last task");
             return count == 1;
@@ -112,6 +137,35 @@
         gcAwait(exceptionTableIsClean);
     }
 
+    /** Sequestered into a separate method to inhibit GC retention. */
+    ArrayList<FailingTask> failedTasks()
+        throws Exception {
+        final ForkJoinPool pool = new ForkJoinPool(rnd.nextInt(1, 4));
+
+        assertEquals(0, retainedExceptions());
+
+        final ArrayList<FailingTask> tasks = new ArrayList<>();
+
+        for (int i = exceptionTable.length; i--> 0; ) {
+            FailingTask task = new FailingTask();
+            pool.execute(task);
+            tasks.add(task); // retain strong refs to all tasks, for now
+            task = null;     // excessive GC retention paranoia
+        }
+        for (FailingTask task : tasks) {
+            try {
+                task.join();
+                throw new AssertionError("should throw");
+            } catch (FailingTaskException success) {}
+            task = null;     // excessive GC retention paranoia
+        }
+
+        if (rnd.nextBoolean())
+            gcAwait(() -> retainedExceptions() == tasks.size());
+
+        return tasks;
+    }
+
     // --------------- GC finalization infrastructure ---------------
 
     /** No guarantees, but effective in practice. */
--- a/test/jdk/java/util/zip/TestExtraTime.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/jdk/java/util/zip/TestExtraTime.java	Thu Jul 12 13:04:33 2018 -0700
@@ -23,7 +23,8 @@
 
 /**
  * @test
- * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526 8130914 8161942
+ * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526 8130914
+ *      8161942 8206389
  * @summary Test ZOS and ZIS timestamp in extra field correctly
  */
 
@@ -96,6 +97,7 @@
         testNullHandling();
         testTagOnlyHandling();
         testTimeConversions();
+        testNullMtime();
     }
 
     static void test(FileTime mtime, FileTime atime, FileTime ctime,
@@ -192,9 +194,11 @@
                           ze.getTime(),
                           ze.getLastModifiedTime().to(TimeUnit.MILLISECONDS));
          */
-        if (mtime.to(TimeUnit.SECONDS) !=
-            ze.getLastModifiedTime().to(TimeUnit.SECONDS))
+        if (mtime != null &&
+            mtime.to(TimeUnit.SECONDS) !=
+            ze.getLastModifiedTime().to(TimeUnit.SECONDS)) {
             throw new RuntimeException("Timestamp: storing mtime failed!");
+        }
         if (atime != null &&
             atime.to(TimeUnit.SECONDS) !=
             ze.getLastAccessTime().to(TimeUnit.SECONDS))
@@ -305,4 +309,52 @@
             Files.delete(zpath);
         }
     }
+
+    static void checkLastModifiedTimeDOS(FileTime mtime, ZipEntry ze) {
+        FileTime lmt = ze.getLastModifiedTime();
+        if ((lmt.to(TimeUnit.SECONDS) >>> 1) != (mtime.to(TimeUnit.SECONDS) >>> 1) ||
+            lmt.to(TimeUnit.MILLISECONDS) != ze.getTime() ||
+            lmt.to(TimeUnit.MILLISECONDS) % 1000 != 0) {
+            throw new RuntimeException("Timestamp: storing mtime in dos format failed!");
+        }
+    }
+
+    static void testNullMtime() throws Throwable {
+        Instant now = Instant.now();
+        FileTime ctime = FileTime.from(now);
+        FileTime atime = FileTime.from(now.plusSeconds(7));
+        FileTime mtime = FileTime.from(now.plusSeconds(13));
+        System.out.printf("--------------------%nTesting: [%s]/[%s]/[%s]%n",
+                          mtime, atime, ctime);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+            ZipEntry ze = new ZipEntry("TestExtraTime.java");
+            ze.setCreationTime(ctime);
+            ze.setLastAccessTime(atime);
+            // ze.setLastModifiedTime(now);
+            ze.setTime(mtime.toMillis());
+            zos.putNextEntry(ze);
+            zos.write(new byte[] { 1,2 ,3, 4});
+        }
+
+        try (ZipInputStream zis = new ZipInputStream(
+                 new ByteArrayInputStream(baos.toByteArray()))) {
+            ZipEntry ze = zis.getNextEntry();
+            // check LOC
+            check(null, atime, ctime, ze, null);
+            checkLastModifiedTimeDOS(mtime, ze);
+        }
+
+        Path zpath = Paths.get(System.getProperty("test.dir", "."),
+                               "TestExtraTime.zip");
+        Files.copy(new ByteArrayInputStream(baos.toByteArray()), zpath);
+        try (ZipFile zf = new ZipFile(zpath.toFile())) {
+            ZipEntry ze = zf.getEntry("TestExtraTime.java");
+            // check CEN
+            checkLastModifiedTimeDOS(mtime, ze);
+        } finally {
+            Files.delete(zpath);
+        }
+    }
 }
--- a/test/langtools/tools/javac/6558548/T6558548.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/6558548/T6558548.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug     6558548 7039937
  * @summary The compiler needs to be aligned with clarified specification of throws
  * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java
- * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java
  */
 
 class T6558548 {
--- a/test/langtools/tools/javac/6558548/T6558548_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-6 errors
--- a/test/langtools/tools/javac/6558548/T6558548_latest.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/6558548/T6558548_latest.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,9 +1,9 @@
-T6558548.java:20:9: compiler.warn.unreachable.catch: java.io.FileNotFoundException
-T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:19:9: compiler.warn.unreachable.catch: java.io.FileNotFoundException
+T6558548.java:167:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:176:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:247:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:257:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:299:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:306:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
 6 errors
 1 warning
--- a/test/langtools/tools/javac/8013179/T8013179.java	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 8013179
- * @summary assertion failure in javac when compiling with -source 1.6 -target 1.6
- * @compile/fail/ref=T8013179.out -source 6 -target 6 -Xlint:-options -XDrawDiagnostics T8013179.java
- */
-
-import java.lang.invoke.MethodHandle;
-
-class T8013179 {
-    static MethodHandle getNamedMember;
-    public static Object getMember(String name, Object rec) throws Throwable {
-        return getNamedMember.invoke(rec, name);
-    }
-}
--- a/test/langtools/tools/javac/8013179/T8013179.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-T8013179.java:13:37: compiler.err.bad.target.sigpoly.call: 1.6, 1.7
-1 error
--- a/test/langtools/tools/javac/8074306/TestSyntheticNullChecks.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/8074306/TestSyntheticNullChecks.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -25,9 +25,6 @@
  * @test
  * @bug 8074306 8073432 8074501
  * @summary NULLCHK is emitted as Object.getClass
- * @compile -source 6 -target 6 TestSyntheticNullChecks.java
- * @run main TestSyntheticNullChecks 6
- * @clean TestSyntheticNullChecks*
  * @compile -source 7 -target 7 TestSyntheticNullChecks.java
  * @run main TestSyntheticNullChecks 7
  * @clean TestSyntheticNullChecks*
--- a/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -35,10 +35,6 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *
  * @clean TestIndyStringConcat*
- * @compile -source 6 -target 6 TestIndyStringConcat.java
- * @run main TestIndyStringConcat false
- *
- * @clean TestIndyStringConcat*
  * @compile -source 7 -target 7 TestIndyStringConcat.java
  * @run main TestIndyStringConcat false
  *
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test  /nodynamiccopyright/
  * @bug 6827009
  * @summary Check for case labels of different types.
- * @compile/fail/ref=BadlyTypedLabel1_6.out -XDrawDiagnostics -source 6 BadlyTypedLabel1.java
  * @compile/fail/ref=BadlyTypedLabel1.out -XDrawDiagnostics BadlyTypedLabel1.java
  */
 class BadlyTypedLabel1 {
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
+BadlyTypedLabel1.java:12:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
 1 error
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel1_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-BadlyTypedLabel1.java:10:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test  /nodynamiccopyright/
  * @bug 6827009
  * @summary Check for case lables of different types.
- * @compile/fail/ref=BadlyTypedLabel2_6.out -XDrawDiagnostics -source 6 BadlyTypedLabel2.java
  * @compile/fail/ref=BadlyTypedLabel2.out -XDrawDiagnostics BadlyTypedLabel2.java
  */
 import static java.math.RoundingMode.*;
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.math.RoundingMode, java.lang.String)
+BadlyTypedLabel2.java:14:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.math.RoundingMode, java.lang.String)
 1 error
--- a/test/langtools/tools/javac/StringsInSwitch/BadlyTypedLabel2_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-BadlyTypedLabel2.java:12:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.math.RoundingMode, java.lang.String)
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/NonConstantLabel.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/NonConstantLabel.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test  /nodynamiccopyright/
  * @bug 6827009
  * @summary Check for non-constant case labels.
- * @compile/fail/ref=NonConstantLabel6.out -XDrawDiagnostics -source 6 NonConstantLabel.java
  * @compile/fail/ref=NonConstantLabel.out -XDrawDiagnostics NonConstantLabel.java
  */
 class NonConstantLabel {
--- a/test/langtools/tools/javac/StringsInSwitch/NonConstantLabel.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/NonConstantLabel.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-NonConstantLabel.java:14:14: compiler.err.string.const.req
+NonConstantLabel.java:13:14: compiler.err.string.const.req
 1 error
--- a/test/langtools/tools/javac/StringsInSwitch/NonConstantLabel6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-NonConstantLabel.java:11:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-NonConstantLabel.java:14:14: compiler.err.string.const.req
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test /nodynamiccopyright/
  * @bug 6827009 8078561
  * @summary Positive tests for strings in switch with few alternatives.
- * @compile/fail/ref=OneCaseSwitches.out -XDrawDiagnostics -source 6 OneCaseSwitches.java
  * @compile          OneCaseSwitches.java
  * @run main OneCaseSwitches
  * @author  Joseph D. Darcy
--- a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-OneCaseSwitches.java:23:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-1 error
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/RSCL1.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/RSCL1.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-RepeatedStringCaseLabels1.java:13:9: compiler.err.duplicate.case.label
+RepeatedStringCaseLabels1.java:12:9: compiler.err.duplicate.case.label
 1 error
--- a/test/langtools/tools/javac/StringsInSwitch/RSCL1_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-RepeatedStringCaseLabels1.java:10:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-RepeatedStringCaseLabels1.java:13:9: compiler.err.duplicate.case.label
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/RSCL2.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/RSCL2.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-RepeatedStringCaseLabels2.java:14:9: compiler.err.duplicate.case.label
+RepeatedStringCaseLabels2.java:13:9: compiler.err.duplicate.case.label
 1 error
--- a/test/langtools/tools/javac/StringsInSwitch/RSCL2_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-RepeatedStringCaseLabels2.java:11:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.string.switch), 6, 7
-RepeatedStringCaseLabels2.java:14:9: compiler.err.duplicate.case.label
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/StringsInSwitch/RepeatedStringCaseLabels1.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/RepeatedStringCaseLabels1.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test  /nodynamiccopyright/
  * @bug 6827009
  * @summary Check for repeated string case labels.
- * @compile/fail/ref=RSCL1_6.out -XDrawDiagnostics -source 6 RepeatedStringCaseLabels1.java
  * @compile/fail/ref=RSCL1.out -XDrawDiagnostics RepeatedStringCaseLabels1.java
  */
 class RepeatedStringCaseLabels1 {
--- a/test/langtools/tools/javac/StringsInSwitch/RepeatedStringCaseLabels2.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/StringsInSwitch/RepeatedStringCaseLabels2.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test  /nodynamiccopyright/
  * @bug 6827009
  * @summary Check for repeated string case labels.
- * @compile/fail/ref=RSCL2_6.out -XDrawDiagnostics -source 6 RepeatedStringCaseLabels2.java
  * @compile/fail/ref=RSCL2.out -XDrawDiagnostics RepeatedStringCaseLabels2.java
  */
 class RepeatedStringCaseLabels2 {
--- a/test/langtools/tools/javac/TryWithResources/BadTwr.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/BadTwr.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug 6911256 6964740
  * @author Joseph D. Darcy
  * @summary Verify bad TWRs don't compile
- * @compile/fail/ref=BadTwr6.out -XDrawDiagnostics -source 6 BadTwr.java
  * @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java
  */
 
--- a/test/langtools/tools/javac/TryWithResources/BadTwr.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/BadTwr.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
-BadTwr.java:13:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...)
-BadTwr.java:18:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...)
-BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
-BadTwr.java:26:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...)
+BadTwr.java:12:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...)
+BadTwr.java:17:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...)
+BadTwr.java:20:13: compiler.err.cant.assign.val.to.final.var: thatsIt
+BadTwr.java:25:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...)
 4 errors
--- a/test/langtools/tools/javac/TryWithResources/BadTwr6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-BadTwr.java:13:12: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.try.with.resources), 6, 7
-1 error
-3 warnings
--- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug 6911256 6964740
  * @author Joseph D. Darcy
  * @summary Verify bad TWRs don't compile
- * @compile/fail/ref=BadTwrSyntax6.out -XDrawDiagnostics -source 6 BadTwrSyntax.java
  * @compile/fail/ref=BadTwrSyntax.out -XDrawDiagnostics BadTwrSyntax.java
  */
 
--- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.expr
+BadTwrSyntax.java:13:43: compiler.err.illegal.start.of.expr
 1 error
--- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-BadTwrSyntax.java:14:12: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.try.with.resources), 6, 7
-BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.expr
-2 errors
-3 warnings
--- a/test/langtools/tools/javac/TryWithResources/PlainTry.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/PlainTry.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug 6911256 6964740
  * @author Joseph D. Darcy
  * @summary Test error messages for an unadorned try
- * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 -Xlint:-options PlainTry.java
  * @compile/fail/ref=PlainTry.out  -XDrawDiagnostics                           PlainTry.java
  */
 public class PlainTry {
--- a/test/langtools/tools/javac/TryWithResources/PlainTry.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/PlainTry.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-PlainTry.java:11:9: compiler.err.try.without.catch.finally.or.resource.decls
+PlainTry.java:10:9: compiler.err.try.without.catch.finally.or.resource.decls
 1 error
--- a/test/langtools/tools/javac/TryWithResources/PlainTry6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-PlainTry.java:11:9: compiler.err.try.without.catch.or.finally
-1 error
--- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug 6911256 6964740 7013420
  * @author Joseph D. Darcy
  * @summary Verify invalid TWR block is not accepted.
- * @compile/fail/ref=TwrOnNonResource6.out -XDrawDiagnostics -source 6 TwrOnNonResource.java
  * @compile/fail/ref=TwrOnNonResource.out -XDrawDiagnostics TwrOnNonResource.java
  */
 
--- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,4 +1,4 @@
-TwrOnNonResource.java:12:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
-TwrOnNonResource.java:15:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
-TwrOnNonResource.java:18:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
+TwrOnNonResource.java:11:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
+TwrOnNonResource.java:14:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
+TwrOnNonResource.java:17:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable))
 3 errors
--- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 6
-- compiler.warn.option.obsolete.source: 6
-- compiler.warn.option.obsolete.suppression
-TwrOnNonResource.java:12:12: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.try.with.resources), 6, 7
-1 error
-3 warnings
--- a/test/langtools/tools/javac/TryWithResources/WeirdTwr.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/TryWithResources/WeirdTwr.java	Thu Jul 12 13:04:33 2018 -0700
@@ -3,7 +3,6 @@
  * @bug 6911256 6964740
  * @author Joseph D. Darcy
  * @summary Strange TWRs
- * @compile/fail/ref=WeirdTwr.out -XDrawDiagnostics -source 6 WeirdTwr.java
  * @compile WeirdTwr.java
  * @run main WeirdTwr
  */
--- a/test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion.java	Thu Jul 12 13:04:33 2018 -0700
@@ -5,7 +5,6 @@
  * @compile WrongVersion.java
  * @compile -Xlint:-options -source 8 WrongVersion.java
  * @compile/fail/ref=WrongVersion7.out -XDrawDiagnostics -Xlint:-options -source 7 WrongVersion.java
- * @compile/fail/ref=WrongVersion6.out -XDrawDiagnostics -Xlint:-options -source 6 WrongVersion.java
  */
 import java.lang.annotation.Repeatable;
 
--- a/test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-WrongVersion.java:12:9: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.repeatable.annotations), 6, 8
-1 error
--- a/test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/annotations/repeatingAnnotations/WrongVersion7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-WrongVersion.java:12:9: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.repeatable.annotations), 7, 8
+WrongVersion.java:11:9: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.repeatable.annotations), 7, 8
 1 error
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java	Thu Jul 12 13:04:33 2018 -0700
@@ -4,7 +4,6 @@
  * @summary test that only Java 8 allows type annotations
  * @author Mahmood Ali
  * @compile AnnotationVersion.java
- * @compile/fail/ref=AnnotationVersion.out -XDrawDiagnostics -Xlint:-options -source 1.6 AnnotationVersion.java
  * @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options -source 1.7 AnnotationVersion.java
  */
 import java.lang.annotation.*;
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-AnnotationVersion.java:12:27: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.type.annotations), 6, 8
-1 error
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-AnnotationVersion.java:12:27: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.type.annotations), 7, 8
+AnnotationVersion.java:11:27: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.type.annotations), 7, 8
 1 error
--- a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java	Thu Jul 12 13:04:33 2018 -0700
@@ -42,7 +42,6 @@
  */
 public class ClassVersionChecker {
     private static enum Version {
-        SIX("6", 50),
         SEVEN("7", 51),
         EIGHT("8", 52),
         NINE("9", 53),
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,9 +1,8 @@
 /* @test /nodynamiccopyright/
  * @bug 8037385
  * @summary Must not allow static interface method invocation in legacy code
- * @compile -source 8 -Xlint:-options StaticInvokeQualified.java
+ * @compile -Xlint:-options StaticInvokeQualified.java
  * @compile/fail/ref=StaticInvokeQualified7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvokeQualified.java
- * @compile/fail/ref=StaticInvokeQualified6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvokeQualified.java
  */
 
 class StaticInvokeQualified {
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-StaticInvokeQualified.java:11:32: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 6, 8
-1 error
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/defaultMethods/static/StaticInvokeQualified7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-StaticInvokeQualified.java:11:32: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 7, 8
+StaticInvokeQualified.java:10:32: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 7, 8
 1 error
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,9 +1,8 @@
 /* @test /nodynamiccopyright/
  * @bug 8037385
  * @summary Must not allow static interface method invocation in legacy code
- * @compile -source 8 -Xlint:-options StaticInvokeSimple.java
+ * @compile -Xlint:-options StaticInvokeSimple.java
  * @compile/fail/ref=StaticInvokeSimple7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvokeSimple.java
- * @compile/fail/ref=StaticInvokeSimple6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvokeSimple.java
  */
 import java.util.stream.Stream;
 
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-StaticInvokeSimple.java:12:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 6, 8
-1 error
--- a/test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/defaultMethods/static/StaticInvokeSimple7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-StaticInvokeSimple.java:12:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 7, 8
+StaticInvokeSimple.java:11:15: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.static.intf.method.invoke), 7, 8
 1 error
--- a/test/langtools/tools/javac/literals/BadBinaryLiterals.6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-BadBinaryLiterals.java:10:17: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.binary.lit), 6, 7
-BadBinaryLiterals.java:11:24: compiler.err.expected: ';'
-BadBinaryLiterals.java:16:27: compiler.err.expected: ';'
-BadBinaryLiterals.java:17:27: compiler.err.expected: ';'
-BadBinaryLiterals.java:17:30: compiler.err.expected: token.identifier
-5 errors
--- a/test/langtools/tools/javac/literals/BadBinaryLiterals.7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/literals/BadBinaryLiterals.7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,7 +1,7 @@
-BadBinaryLiterals.java:11:24: compiler.err.expected: ';'
-BadBinaryLiterals.java:13:21: compiler.err.int.number.too.large: 111111111111111111111111111111111
-BadBinaryLiterals.java:15:21: compiler.err.int.number.too.large: 11111111111111111111111111111111111111111111111111111111111111111
+BadBinaryLiterals.java:10:24: compiler.err.expected: ';'
+BadBinaryLiterals.java:12:21: compiler.err.int.number.too.large: 111111111111111111111111111111111
+BadBinaryLiterals.java:14:21: compiler.err.int.number.too.large: 11111111111111111111111111111111111111111111111111111111111111111
+BadBinaryLiterals.java:15:27: compiler.err.expected: ';'
 BadBinaryLiterals.java:16:27: compiler.err.expected: ';'
-BadBinaryLiterals.java:17:27: compiler.err.expected: ';'
-BadBinaryLiterals.java:17:30: compiler.err.expected: token.identifier
+BadBinaryLiterals.java:16:30: compiler.err.expected: token.identifier
 6 errors
--- a/test/langtools/tools/javac/literals/BadBinaryLiterals.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/literals/BadBinaryLiterals.java	Thu Jul 12 13:04:33 2018 -0700
@@ -2,7 +2,6 @@
  * @test /nodynamiccopyright/
  * @bug 6860965
  * @summary Project Coin: binary literals
- * @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadBinaryLiterals.java
  * @compile/fail/ref=BadBinaryLiterals.7.out -XDrawDiagnostics BadBinaryLiterals.java
  */
 
--- a/test/langtools/tools/javac/literals/BadUnderscoreLiterals.6.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-BadUnderscoreLiterals.java:11:17: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.underscore.lit), 6, 7
-BadUnderscoreLiterals.java:15:15: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:19:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:22:14: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.binary.lit), 6, 7
-BadUnderscoreLiterals.java:22:16: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:23:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:26:16: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:27:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:30:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:31:18: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:32:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:33:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:34:18: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:35:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:38:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:39:20: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:40:21: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:41:22: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:42:21: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:43:22: compiler.err.illegal.underscore
-20 errors
--- a/test/langtools/tools/javac/literals/BadUnderscoreLiterals.7.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/literals/BadUnderscoreLiterals.7.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,19 +1,19 @@
-BadUnderscoreLiterals.java:15:15: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:19:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:22:16: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:23:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:26:16: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:27:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:30:17: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:31:18: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:14:15: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:18:19: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:21:16: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:22:17: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:25:16: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:26:17: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:29:17: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:30:18: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:31:19: compiler.err.illegal.underscore
 BadUnderscoreLiterals.java:32:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:33:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:34:18: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:35:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:38:19: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:39:20: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:40:21: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:41:22: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:42:21: compiler.err.illegal.underscore
-BadUnderscoreLiterals.java:43:22: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:33:18: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:34:19: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:37:19: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:38:20: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:39:21: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:40:22: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:41:21: compiler.err.illegal.underscore
+BadUnderscoreLiterals.java:42:22: compiler.err.illegal.underscore
 18 errors
--- a/test/langtools/tools/javac/literals/BadUnderscoreLiterals.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/literals/BadUnderscoreLiterals.java	Thu Jul 12 13:04:33 2018 -0700
@@ -4,11 +4,10 @@
  * @summary Project Coin: underscores in literals
  *
  * @compile/fail/ref=BadUnderscoreLiterals.7.out -XDrawDiagnostics BadUnderscoreLiterals.java
- * @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadUnderscoreLiterals.java
  */
 
 public class BadUnderscoreLiterals {
-    int valid = 1_1;            // valid literal; illegal in -source 6
+    int valid = 1_1;            // valid literal
 
     // test zero
     int z1 = _0;                // valid (but undefined) variable
--- a/test/langtools/tools/javac/mixedTarget/ExtendCovariant2.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/mixedTarget/ExtendCovariant2.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -27,7 +27,6 @@
  * @summary Ensure Covariant Return Type allowed in minimum supported version
  * @author gafter
  *
- * @compile -source 1.6 ExtendCovariant2.java
  * @compile                  ExtendCovariant2.java
  */
 
@@ -40,7 +39,7 @@
  *
  * With JDK 1.5, a Covariant Return is allowed so check that is the case.
  *
- **/
+ */
 public class ExtendCovariant2 extends java.io.PrintStream {
     ExtendCovariant2() throws java.io.IOException {
         super("");
--- a/test/langtools/tools/javac/multicatch/Neg01.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/multicatch/Neg01.java	Thu Jul 12 13:04:33 2018 -0700
@@ -5,8 +5,6 @@
  * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
  * @author darcy
  * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java
- * @compile -source 6 -XDrawDiagnostics Neg01.java
- *
  */
 
 class Neg01 {
--- a/test/langtools/tools/javac/multicatch/Neg01.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/multicatch/Neg01.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-Neg01.java:24:19: compiler.err.except.never.thrown.in.try: Neg01.B2
+Neg01.java:22:19: compiler.err.except.never.thrown.in.try: Neg01.B2
 1 error
--- a/test/langtools/tools/javac/multicatch/Neg01eff_final.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.java	Thu Jul 12 13:04:33 2018 -0700
@@ -5,8 +5,6 @@
  * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
  * @author darcy
  * @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java
- * @compile -source 6 -XDrawDiagnostics Neg01eff_final.java
- *
  */
 
 class Neg01eff_final {
--- a/test/langtools/tools/javac/multicatch/Neg01eff_final.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-Neg01eff_final.java:24:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2
+Neg01eff_final.java:22:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2
 1 error
--- a/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Thu Jul 12 13:04:33 2018 -0700
@@ -29,13 +29,12 @@
  * @modules java.compiler
  *          jdk.compiler
  * @compile TestSourceVersionWarnings.java
- * @compile/ref=gold_0.out             -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only                           -source 1.6 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_9 -source 1.9 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_0.out             -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only                            -source  8 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5  -source  8 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8  -source  8 -Xlint:-options -Aunsupported HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_10 -source 10 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_11 -source 11 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_12 -source 12 -Xlint:-options HelloWorld.java
  */
 
 import java.util.Set;
@@ -64,7 +63,7 @@
         if (sourceVersion == null) {
             processingEnv.getMessager().printMessage(WARNING,
                                                      "No SourceVersion option given");
-            return SourceVersion.RELEASE_6;
+            return SourceVersion.RELEASE_8;
         } else {
             return SourceVersion.valueOf(sourceVersion);
         }
--- a/test/langtools/tools/javac/processing/warnings/gold_sv_warn_5_6.out	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/processing/warnings/gold_sv_warn_5_6.out	Thu Jul 12 13:04:33 2018 -0700
@@ -1,2 +1,2 @@
-- compiler.warn.proc.processor.incompatible.source.version: RELEASE_5, TestSourceVersionWarnings, 6
+- compiler.warn.proc.processor.incompatible.source.version: RELEASE_5, TestSourceVersionWarnings, 8
 1 warning
--- a/test/langtools/tools/javac/types/CastObjectToPrimitiveTest.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/types/CastObjectToPrimitiveTest.java	Thu Jul 12 13:04:33 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -25,7 +25,6 @@
  * @test
  * @bug 7038363
  * @summary cast from object to primitive should be for source >= 1.7
- * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java
  * @compile CastObjectToPrimitiveTest.java
  */
 
--- a/test/langtools/tools/javac/types/CastObjectToPrimitiveTest.out	Thu Jul 05 14:47:50 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-CastObjectToPrimitiveTest.java:35:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int)
-1 error
--- a/test/langtools/tools/javac/versions/Versions.java	Thu Jul 05 14:47:50 2018 -0700
+++ b/test/langtools/tools/javac/versions/Versions.java	Thu Jul 12 13:04:33 2018 -0700
@@ -66,15 +66,14 @@
     }
 
     public static final Set<String> RETIRED_SOURCES =
-        Set.of("1.2", "1.3", "1.4", "1.5");
+        Set.of("1.2", "1.3", "1.4", "1.5" /*, 1.6 */);
 
     public static final Set<String> VALID_SOURCES =
-        Set.of("1.6", "1.7", "1.8", "1.9", "1.10", "11", "12");
+        Set.of("1.7", "1.8", "1.9", "1.10", "11", "12");
 
     public static final String LATEST_MAJOR_VERSION = "56.0";
 
     static enum SourceTarget {
-        SIX(true,     "50.0",  "6", Versions::checksrc16),
         SEVEN(true,   "51.0",  "7", Versions::checksrc17),
         EIGHT(true,   "52.0",  "8", Versions::checksrc18),
         NINE(true,    "53.0",  "9", Versions::checksrc19),
@@ -232,17 +231,6 @@
         }
     }
 
-    protected void checksrc16(String... args) {
-        printargs("checksrc16", args);
-        int asize = args.length;
-        String[] newargs = new String[asize + 1];
-        System.arraycopy(args, 0, newargs, 0, asize);
-        newargs[asize] = "Base.java";
-        pass(newargs);
-        newargs[asize] = "New17.java";
-        fail(newargs);
-    }
-
     protected void checksrc17(String... args) {
         printargs("checksrc17", args);
         int asize = args.length;