Merge JDK-8200758-branch
authorherrick
Fri, 19 Oct 2018 21:30:11 -0400
branchJDK-8200758-branch
changeset 56996 d5aa88e62100
parent 56995 3d5b13207b70 (current diff)
parent 52201 7c6dfd16373f (diff)
child 56999 b50d414a755c
Merge
--- a/src/hotspot/share/ci/ciEnv.cpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/ci/ciEnv.cpp	Fri Oct 19 21:30:11 2018 -0400
@@ -77,7 +77,7 @@
 
 ciObject*              ciEnv::_null_object_instance;
 
-#define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL;
+#define WK_KLASS_DEFN(name, ignore_s) ciInstanceKlass* ciEnv::_##name = NULL;
 WK_KLASSES_DO(WK_KLASS_DEFN)
 #undef WK_KLASS_DEFN
 
--- a/src/hotspot/share/ci/ciEnv.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/ci/ciEnv.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -82,7 +82,7 @@
   // Distinguished instances of certain ciObjects..
   static ciObject*              _null_object_instance;
 
-#define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name;
+#define WK_KLASS_DECL(name, ignore_s) static ciInstanceKlass* _##name;
   WK_KLASSES_DO(WK_KLASS_DECL)
 #undef WK_KLASS_DECL
 
@@ -374,7 +374,7 @@
 
 
   // Access to certain well known ciObjects.
-#define WK_KLASS_FUNC(name, ignore_s, ignore_o) \
+#define WK_KLASS_FUNC(name, ignore_s) \
   ciInstanceKlass* name() { \
     return _##name;\
   }
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Fri Oct 19 21:30:11 2018 -0400
@@ -157,8 +157,8 @@
   ciEnv::_null_object_instance = new (_arena) ciNullObject();
   init_ident_of(ciEnv::_null_object_instance);
 
-#define WK_KLASS_DEFN(name, ignore_s, opt)                              \
-  if (SystemDictionary::name() != NULL) \
+#define WK_KLASS_DEFN(name, ignore_s)                              \
+  if (SystemDictionary::name##_is_loaded()) \
     ciEnv::_##name = get_metadata(SystemDictionary::name())->as_instance_klass();
 
   WK_KLASSES_DO(WK_KLASS_DEFN)
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Fri Oct 19 21:30:11 2018 -0400
@@ -1963,41 +1963,30 @@
 
 // Compact table of directions on the initialization of klasses:
 static const short wk_init_info[] = {
-  #define WK_KLASS_INIT_INFO(name, symbol, option) \
-    ( ((int)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol) \
-          << SystemDictionary::CEIL_LG_OPTION_LIMIT) \
-      | (int)SystemDictionary::option ),
+  #define WK_KLASS_INIT_INFO(name, symbol) \
+    ((short)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol)),
+
   WK_KLASSES_DO(WK_KLASS_INIT_INFO)
   #undef WK_KLASS_INIT_INFO
   0
 };
 
-bool SystemDictionary::resolve_wk_klass(WKID id, int init_opt, TRAPS) {
+bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
   assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
-  int  info = wk_init_info[id - FIRST_WKID];
-  int  sid  = (info >> CEIL_LG_OPTION_LIMIT);
+  int sid = wk_init_info[id - FIRST_WKID];
   Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
   InstanceKlass** klassp = &_well_known_klasses[id];
 
-  bool must_load;
+
 #if INCLUDE_JVMCI
-  if (EnableJVMCI) {
-    // If JVMCI is enabled we require its classes to be found.
-    must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
-  } else
+  if (id >= FIRST_JVMCI_WKID) {
+    assert(EnableJVMCI, "resolve JVMCI classes only when EnableJVMCI is true");
+  }
 #endif
-  {
-    must_load = (init_opt < SystemDictionary::Opt);
-  }
 
   if ((*klassp) == NULL) {
-    Klass* k;
-    if (must_load) {
-      k = resolve_or_fail(symbol, true, CHECK_0); // load required class
-    } else {
-      k = resolve_or_null(symbol,       CHECK_0); // load optional klass
-    }
-    (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
+    Klass* k = resolve_or_fail(symbol, true, CHECK_0);
+    (*klassp) = InstanceKlass::cast(k);
   }
   return ((*klassp) != NULL);
 }
@@ -2006,11 +1995,7 @@
   assert((int)start_id <= (int)limit_id, "IDs are out of order!");
   for (int id = (int)start_id; id < (int)limit_id; id++) {
     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
-    int info = wk_init_info[id - FIRST_WKID];
-    int sid  = (info >> CEIL_LG_OPTION_LIMIT);
-    int opt  = (info & right_n_bits(CEIL_LG_OPTION_LIMIT));
-
-    resolve_wk_klass((WKID)id, opt, CHECK);
+    resolve_wk_klass((WKID)id, CHECK);
   }
 
   // move the starting value forward to the limit:
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -94,127 +94,125 @@
 #define WK_KLASS_ENUM_NAME(kname)    kname##_knum
 
 // Each well-known class has a short klass name (like object_klass),
-// a vmSymbol name (like java_lang_Object), and a flag word
-// that makes some minor distinctions, like whether the klass
-// is preloaded, optional, release-specific, etc.
+// and a vmSymbol name (like java_lang_Object).
 // The order of these definitions is significant; it is the order in which
 // preloading is actually performed by resolve_preloaded_classes.
 
-#define WK_KLASSES_DO(do_klass)                                                                                          \
-  /* well-known classes */                                                                                               \
-  do_klass(Object_klass,                                java_lang_Object,                          Pre                 ) \
-  do_klass(String_klass,                                java_lang_String,                          Pre                 ) \
-  do_klass(Class_klass,                                 java_lang_Class,                           Pre                 ) \
-  do_klass(Cloneable_klass,                             java_lang_Cloneable,                       Pre                 ) \
-  do_klass(ClassLoader_klass,                           java_lang_ClassLoader,                     Pre                 ) \
-  do_klass(Serializable_klass,                          java_io_Serializable,                      Pre                 ) \
-  do_klass(System_klass,                                java_lang_System,                          Pre                 ) \
-  do_klass(Throwable_klass,                             java_lang_Throwable,                       Pre                 ) \
-  do_klass(Error_klass,                                 java_lang_Error,                           Pre                 ) \
-  do_klass(ThreadDeath_klass,                           java_lang_ThreadDeath,                     Pre                 ) \
-  do_klass(Exception_klass,                             java_lang_Exception,                       Pre                 ) \
-  do_klass(RuntimeException_klass,                      java_lang_RuntimeException,                Pre                 ) \
-  do_klass(SecurityManager_klass,                       java_lang_SecurityManager,                 Pre                 ) \
-  do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain,            Pre                 ) \
-  do_klass(AccessControlContext_klass,                  java_security_AccessControlContext,        Pre                 ) \
-  do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader,           Pre                 ) \
-  do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException,          Pre                 ) \
-  do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError,            Pre                 ) \
-  do_klass(LinkageError_klass,                          java_lang_LinkageError,                    Pre                 ) \
-  do_klass(ClassCastException_klass,                    java_lang_ClassCastException,              Pre                 ) \
-  do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException,             Pre                 ) \
-  do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError,             Pre                 ) \
-  do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError,                Pre                 ) \
-  do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError,              Pre                 ) \
-  do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException,    Pre                 ) \
-  do_klass(Reference_klass,                             java_lang_ref_Reference,                   Pre                 ) \
-                                                                                                                         \
-  /* Preload ref klasses and set reference types */                                                                      \
-  do_klass(SoftReference_klass,                         java_lang_ref_SoftReference,               Pre                 ) \
-  do_klass(WeakReference_klass,                         java_lang_ref_WeakReference,               Pre                 ) \
-  do_klass(FinalReference_klass,                        java_lang_ref_FinalReference,              Pre                 ) \
-  do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference,            Pre                 ) \
-  do_klass(Finalizer_klass,                             java_lang_ref_Finalizer,                   Pre                 ) \
-                                                                                                                         \
-  do_klass(Thread_klass,                                java_lang_Thread,                          Pre                 ) \
-  do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup,                     Pre                 ) \
-  do_klass(Properties_klass,                            java_util_Properties,                      Pre                 ) \
-  do_klass(Module_klass,                                java_lang_Module,                          Pre                 ) \
-  do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject,        Pre                 ) \
-  do_klass(reflect_Field_klass,                         java_lang_reflect_Field,                   Pre                 ) \
-  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter,               Opt                 ) \
-  do_klass(reflect_Method_klass,                        java_lang_reflect_Method,                  Pre                 ) \
-  do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
-                                                                                                                         \
-  /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
-  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
-  do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl,                 Opt                 ) \
-  do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl,                Pre                 ) \
-  do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl,           Pre                 ) \
-  do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader,             Opt                 ) \
-  do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool,                      Opt                 ) \
-  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl,     Opt                 ) \
-  do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive,                   Opt                 ) \
-                                                                                                                         \
-  /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                            \
-  do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle,       Opt                 ) \
-  do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle,             Pre                 ) \
-  do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle,                Pre                 ) \
-  do_klass(MemberName_klass,                            java_lang_invoke_MemberName,               Pre                 ) \
-  do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName,       Pre                 ) \
-  do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives,      Pre                 ) \
-  do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm,               Opt                 ) \
-  do_klass(MethodType_klass,                            java_lang_invoke_MethodType,               Pre                 ) \
-  do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError,            Pre                 ) \
-  do_klass(CallSite_klass,                              java_lang_invoke_CallSite,                 Pre                 ) \
-  do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre      ) \
-  do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite,         Pre                 ) \
-  do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite,          Pre                 ) \
-  do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite,         Pre                 ) \
-  /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                             \
-                                                                                                                         \
-  do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives,       Pre                 ) \
-  do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
-  do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
-  do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe,                  Pre                 ) \
-  do_klass(module_Modules_klass,                        jdk_internal_module_Modules,               Pre                 ) \
-                                                                                                                         \
-  /* support for CDS */                                                                                                  \
-  do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream,              Pre                 ) \
-  do_klass(URL_klass,                                   java_net_URL,                              Pre                 ) \
-  do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest,                    Pre                 ) \
-  do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders,          Pre                 ) \
-  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(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
-                                                                                                                         \
-  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
-  do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
-                                                                                                                         \
-  /* Stack Walking */                                                                                                    \
-  do_klass(StackWalker_klass,                           java_lang_StackWalker,                     Opt                 ) \
-  do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker, Opt          ) \
-  do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
-  do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
-                                                                                                                         \
-  /* support for stack dump lock analysis */                                                                             \
-  do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer, Pre ) \
-                                                                                                                         \
-  /* Preload boxing klasses */                                                                                           \
-  do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
-  do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
-  do_klass(Float_klass,                                 java_lang_Float,                           Pre                 ) \
-  do_klass(Double_klass,                                java_lang_Double,                          Pre                 ) \
-  do_klass(Byte_klass,                                  java_lang_Byte,                            Pre                 ) \
-  do_klass(Short_klass,                                 java_lang_Short,                           Pre                 ) \
-  do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
-  do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
-                                                                                                                         \
-  /* JVMCI classes. These are loaded on-demand. */                                                                       \
-  JVMCI_WK_KLASSES_DO(do_klass)                                                                                          \
-                                                                                                                         \
+#define WK_KLASSES_DO(do_klass)                                                                                 \
+  /* well-known classes */                                                                                      \
+  do_klass(Object_klass,                                java_lang_Object                                      ) \
+  do_klass(String_klass,                                java_lang_String                                      ) \
+  do_klass(Class_klass,                                 java_lang_Class                                       ) \
+  do_klass(Cloneable_klass,                             java_lang_Cloneable                                   ) \
+  do_klass(ClassLoader_klass,                           java_lang_ClassLoader                                 ) \
+  do_klass(Serializable_klass,                          java_io_Serializable                                  ) \
+  do_klass(System_klass,                                java_lang_System                                      ) \
+  do_klass(Throwable_klass,                             java_lang_Throwable                                   ) \
+  do_klass(Error_klass,                                 java_lang_Error                                       ) \
+  do_klass(ThreadDeath_klass,                           java_lang_ThreadDeath                                 ) \
+  do_klass(Exception_klass,                             java_lang_Exception                                   ) \
+  do_klass(RuntimeException_klass,                      java_lang_RuntimeException                            ) \
+  do_klass(SecurityManager_klass,                       java_lang_SecurityManager                             ) \
+  do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain                        ) \
+  do_klass(AccessControlContext_klass,                  java_security_AccessControlContext                    ) \
+  do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader                       ) \
+  do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException                      ) \
+  do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError                        ) \
+  do_klass(LinkageError_klass,                          java_lang_LinkageError                                ) \
+  do_klass(ClassCastException_klass,                    java_lang_ClassCastException                          ) \
+  do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException                         ) \
+  do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError                         ) \
+  do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError                            ) \
+  do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError                          ) \
+  do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException                ) \
+  do_klass(Reference_klass,                             java_lang_ref_Reference                               ) \
+                                                                                                                \
+  /* Preload ref klasses and set reference types */                                                             \
+  do_klass(SoftReference_klass,                         java_lang_ref_SoftReference                           ) \
+  do_klass(WeakReference_klass,                         java_lang_ref_WeakReference                           ) \
+  do_klass(FinalReference_klass,                        java_lang_ref_FinalReference                          ) \
+  do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference                        ) \
+  do_klass(Finalizer_klass,                             java_lang_ref_Finalizer                               ) \
+                                                                                                                \
+  do_klass(Thread_klass,                                java_lang_Thread                                      ) \
+  do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup                                 ) \
+  do_klass(Properties_klass,                            java_util_Properties                                  ) \
+  do_klass(Module_klass,                                java_lang_Module                                      ) \
+  do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject                    ) \
+  do_klass(reflect_Field_klass,                         java_lang_reflect_Field                               ) \
+  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter                           ) \
+  do_klass(reflect_Method_klass,                        java_lang_reflect_Method                              ) \
+  do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor                         ) \
+                                                                                                                \
+  /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                     \
+  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
+  do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl                             ) \
+  do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl                            ) \
+  do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl                       ) \
+  do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader                         ) \
+  do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool                                  ) \
+  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl                 ) \
+  do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive                               ) \
+                                                                                                                \
+  /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                   \
+  do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle                   ) \
+  do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle                         ) \
+  do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle                            ) \
+  do_klass(MemberName_klass,                            java_lang_invoke_MemberName                           ) \
+  do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName                   ) \
+  do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives                  ) \
+  do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm                           ) \
+  do_klass(MethodType_klass,                            java_lang_invoke_MethodType                           ) \
+  do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError                        ) \
+  do_klass(CallSite_klass,                              java_lang_invoke_CallSite                             ) \
+  do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext  ) \
+  do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite                     ) \
+  do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite                      ) \
+  do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite                     ) \
+  /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                    \
+                                                                                                                \
+  do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives                   ) \
+  do_klass(StringBuffer_klass,                          java_lang_StringBuffer                                ) \
+  do_klass(StringBuilder_klass,                         java_lang_StringBuilder                               ) \
+  do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe                              ) \
+  do_klass(module_Modules_klass,                        jdk_internal_module_Modules                           ) \
+                                                                                                                \
+  /* support for CDS */                                                                                         \
+  do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream                          ) \
+  do_klass(URL_klass,                                   java_net_URL                                          ) \
+  do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest                                ) \
+  do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders                      ) \
+  do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader) \
+  do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \
+  do_klass(CodeSource_klass,                            java_security_CodeSource                              ) \
+                                                                                                                \
+  do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement                           ) \
+                                                                                                                \
+  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
+  do_klass(nio_Buffer_klass,                            java_nio_Buffer                                       ) \
+                                                                                                                \
+  /* Stack Walking */                                                                                           \
+  do_klass(StackWalker_klass,                           java_lang_StackWalker                                 ) \
+  do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker      ) \
+  do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo                              ) \
+  do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
+                                                                                                                \
+  /* support for stack dump lock analysis */                                                                    \
+  do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
+                                                                                                                \
+  /* Preload boxing klasses */                                                                                  \
+  do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
+  do_klass(Character_klass,                             java_lang_Character                                   ) \
+  do_klass(Float_klass,                                 java_lang_Float                                       ) \
+  do_klass(Double_klass,                                java_lang_Double                                      ) \
+  do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
+  do_klass(Short_klass,                                 java_lang_Short                                       ) \
+  do_klass(Integer_klass,                               java_lang_Integer                                     ) \
+  do_klass(Long_klass,                                  java_lang_Long                                        ) \
+                                                                                                                \
+  /* JVMCI classes. These are loaded on-demand. */                                                              \
+  JVMCI_WK_KLASSES_DO(do_klass)                                                                                 \
+                                                                                                                \
   /*end*/
 
 
@@ -226,7 +224,7 @@
   enum WKID {
     NO_WKID = 0,
 
-    #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
+    #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
     WK_KLASSES_DO(WK_KLASS_ENUM)
     #undef WK_KLASS_ENUM
 
@@ -240,21 +238,6 @@
     FIRST_WKID = NO_WKID + 1
   };
 
-  enum InitOption {
-    Pre,                        // preloaded; error if not present
-
-    // Order is significant.  Options before this point require resolve_or_fail.
-    // Options after this point will use resolve_or_null instead.
-
-    Opt,                        // preload tried; NULL if not present
-#if INCLUDE_JVMCI
-    Jvmci,                      // preload tried; error if not present if JVMCI enabled
-#endif
-    OPTION_LIMIT,
-    CEIL_LG_OPTION_LIMIT = 2    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
-  };
-
-
   // Returns a class with a given class name and class loader.  Loads the
   // class if needed. If not found a NoClassDefFoundError or a
   // ClassNotFoundException is thrown, depending on the value on the
@@ -414,12 +397,7 @@
     return k;
   }
 
-  static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
-  static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
-
-  JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
-
-  static bool resolve_wk_klass(WKID id, int init_opt, TRAPS);
+  static bool resolve_wk_klass(WKID id, TRAPS);
   static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
   static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
     int limit = (int)end_id + 1;
@@ -427,10 +405,13 @@
   }
 
 public:
-  #define WK_KLASS_DECLARE(name, symbol, option) \
-    static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
-    static InstanceKlass** name##_addr() {                                                                       \
-      return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];           \
+  #define WK_KLASS_DECLARE(name, symbol) \
+    static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
+    static InstanceKlass** name##_addr() {                                                              \
+      return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];                          \
+    }                                                                                                   \
+    static bool name##_is_loaded() {                                                                    \
+      return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL;                   \
     }
   WK_KLASSES_DO(WK_KLASS_DECLARE);
   #undef WK_KLASS_DECLARE
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 #define SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 
-#include "gc/g1/g1Allocator.hpp"
+#include "gc/g1/g1Allocator.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 #include "gc/g1/g1FullGCMarker.inline.hpp"
 #include "gc/g1/g1FullGCOopClosures.hpp"
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Fri Oct 19 21:30:11 2018 -0400
@@ -24,14 +24,12 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/g1Allocator.inline.hpp"
-#include "gc/g1/g1CollectedHeap.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkThread.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RootProcessor.hpp"
-#include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/g1StringDedup.hpp"
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -323,7 +323,7 @@
     static void check(oop obj, const char* field_name, int offset);                                                                                            \
     static void compute_offsets(TRAPS);                                                                                                                        \
   public:                                                                                                                                                      \
-    static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
+  static InstanceKlass* klass() { return SystemDictionary::name##_klass_is_loaded() ? SystemDictionary::name##_klass() : NULL; }
 
 #define END_CLASS };
 
--- a/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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,68 +27,68 @@
 #if !INCLUDE_JVMCI
 #define JVMCI_WK_KLASSES_DO(do_klass)
 #else
-#define JVMCI_WK_KLASSES_DO(do_klass)                                                                                           \
-  /* JVMCI classes. These are loaded on-demand. */                                                                              \
-  do_klass(JVMCI_klass,                                  jdk_vm_ci_runtime_JVMCI,                               Jvmci) \
-  do_klass(HotSpotCompiledCode_klass,                    jdk_vm_ci_hotspot_HotSpotCompiledCode,                 Jvmci) \
-  do_klass(HotSpotCompiledCode_Comment_klass,            jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment,         Jvmci) \
-  do_klass(HotSpotCompiledNmethod_klass,                 jdk_vm_ci_hotspot_HotSpotCompiledNmethod,              Jvmci) \
-  do_klass(HotSpotForeignCallTarget_klass,               jdk_vm_ci_hotspot_HotSpotForeignCallTarget,            Jvmci) \
-  do_klass(HotSpotReferenceMap_klass,                    jdk_vm_ci_hotspot_HotSpotReferenceMap,                 Jvmci) \
-  do_klass(HotSpotInstalledCode_klass,                   jdk_vm_ci_hotspot_HotSpotInstalledCode,                Jvmci) \
-  do_klass(HotSpotNmethod_klass,                         jdk_vm_ci_hotspot_HotSpotNmethod,                      Jvmci) \
-  do_klass(HotSpotResolvedJavaMethodImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl,       Jvmci) \
-  do_klass(HotSpotResolvedObjectTypeImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl,       Jvmci) \
-  do_klass(HotSpotCompressedNullConstant_klass,          jdk_vm_ci_hotspot_HotSpotCompressedNullConstant,       Jvmci) \
-  do_klass(HotSpotObjectConstantImpl_klass,              jdk_vm_ci_hotspot_HotSpotObjectConstantImpl,           Jvmci) \
-  do_klass(HotSpotMetaspaceConstantImpl_klass,           jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl,        Jvmci) \
-  do_klass(HotSpotSentinelConstant_klass,                jdk_vm_ci_hotspot_HotSpotSentinelConstant,             Jvmci) \
-  do_klass(HotSpotStackFrameReference_klass,             jdk_vm_ci_hotspot_HotSpotStackFrameReference,          Jvmci) \
-  do_klass(HotSpotMetaData_klass,                        jdk_vm_ci_hotspot_HotSpotMetaData,                     Jvmci) \
-  do_klass(HotSpotConstantPool_klass,                    jdk_vm_ci_hotspot_HotSpotConstantPool,                 Jvmci) \
-  do_klass(HotSpotJVMCIMetaAccessContext_klass,          jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext,       Jvmci) \
-  do_klass(HotSpotJVMCIRuntime_klass,                    jdk_vm_ci_hotspot_HotSpotJVMCIRuntime,                 Jvmci) \
-  do_klass(HotSpotSpeculationLog_klass,                  jdk_vm_ci_hotspot_HotSpotSpeculationLog,               Jvmci) \
-  do_klass(HotSpotCompilationRequestResult_klass,        jdk_vm_ci_hotspot_HotSpotCompilationRequestResult,     Jvmci) \
-  do_klass(VMField_klass,                                jdk_vm_ci_hotspot_VMField,                             Jvmci) \
-  do_klass(VMFlag_klass,                                 jdk_vm_ci_hotspot_VMFlag,                              Jvmci) \
-  do_klass(VMIntrinsicMethod_klass,                      jdk_vm_ci_hotspot_VMIntrinsicMethod,                   Jvmci) \
-  do_klass(Assumptions_ConcreteMethod_klass,             jdk_vm_ci_meta_Assumptions_ConcreteMethod,             Jvmci) \
-  do_klass(Assumptions_NoFinalizableSubclass_klass,      jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass,      Jvmci) \
-  do_klass(Assumptions_ConcreteSubtype_klass,            jdk_vm_ci_meta_Assumptions_ConcreteSubtype,            Jvmci) \
-  do_klass(Assumptions_LeafType_klass,                   jdk_vm_ci_meta_Assumptions_LeafType,                   Jvmci) \
-  do_klass(Assumptions_CallSiteTargetValue_klass,        jdk_vm_ci_meta_Assumptions_CallSiteTargetValue,        Jvmci) \
-  do_klass(Architecture_klass,                           jdk_vm_ci_code_Architecture,                           Jvmci) \
-  do_klass(TargetDescription_klass,                      jdk_vm_ci_code_TargetDescription,                      Jvmci) \
-  do_klass(BytecodePosition_klass,                       jdk_vm_ci_code_BytecodePosition,                       Jvmci) \
-  do_klass(DebugInfo_klass,                              jdk_vm_ci_code_DebugInfo,                              Jvmci) \
-  do_klass(RegisterSaveLayout_klass,                     jdk_vm_ci_code_RegisterSaveLayout,                     Jvmci) \
-  do_klass(BytecodeFrame_klass,                          jdk_vm_ci_code_BytecodeFrame,                          Jvmci) \
-  do_klass(InstalledCode_klass,                          jdk_vm_ci_code_InstalledCode,                          Jvmci) \
-  do_klass(code_Location_klass,                          jdk_vm_ci_code_Location,                               Jvmci) \
-  do_klass(code_Register_klass,                          jdk_vm_ci_code_Register,                               Jvmci) \
-  do_klass(RegisterValue_klass,                          jdk_vm_ci_code_RegisterValue,                          Jvmci) \
-  do_klass(StackSlot_klass,                              jdk_vm_ci_code_StackSlot,                              Jvmci) \
-  do_klass(StackLockValue_klass,                         jdk_vm_ci_code_StackLockValue,                         Jvmci) \
-  do_klass(VirtualObject_klass,                          jdk_vm_ci_code_VirtualObject,                          Jvmci) \
-  do_klass(site_Call_klass,                              jdk_vm_ci_code_site_Call,                              Jvmci) \
-  do_klass(site_ConstantReference_klass,                 jdk_vm_ci_code_site_ConstantReference,                 Jvmci) \
-  do_klass(site_DataPatch_klass,                         jdk_vm_ci_code_site_DataPatch,                         Jvmci) \
-  do_klass(site_DataSectionReference_klass,              jdk_vm_ci_code_site_DataSectionReference,              Jvmci) \
-  do_klass(site_ExceptionHandler_klass,                  jdk_vm_ci_code_site_ExceptionHandler,                  Jvmci) \
-  do_klass(site_Mark_klass,                              jdk_vm_ci_code_site_Mark,                              Jvmci) \
-  do_klass(site_Infopoint_klass,                         jdk_vm_ci_code_site_Infopoint,                         Jvmci) \
-  do_klass(site_Site_klass,                              jdk_vm_ci_code_site_Site,                              Jvmci) \
-  do_klass(site_InfopointReason_klass,                   jdk_vm_ci_code_site_InfopointReason,                   Jvmci) \
-  do_klass(InspectedFrameVisitor_klass,                  jdk_vm_ci_code_stack_InspectedFrameVisitor,            Jvmci) \
-  do_klass(JavaConstant_klass,                           jdk_vm_ci_meta_JavaConstant,                           Jvmci) \
-  do_klass(PrimitiveConstant_klass,                      jdk_vm_ci_meta_PrimitiveConstant,                      Jvmci) \
-  do_klass(RawConstant_klass,                            jdk_vm_ci_meta_RawConstant,                            Jvmci) \
-  do_klass(NullConstant_klass,                           jdk_vm_ci_meta_NullConstant,                           Jvmci) \
-  do_klass(ExceptionHandler_klass,                       jdk_vm_ci_meta_ExceptionHandler,                       Jvmci) \
-  do_klass(JavaKind_klass,                               jdk_vm_ci_meta_JavaKind,                               Jvmci) \
-  do_klass(ValueKind_klass,                              jdk_vm_ci_meta_ValueKind,                              Jvmci) \
-  do_klass(Value_klass,                                  jdk_vm_ci_meta_Value,                                  Jvmci)
+#define JVMCI_WK_KLASSES_DO(do_klass)                                                                      \
+  /* JVMCI classes. These are loaded on-demand. */                                                         \
+  do_klass(JVMCI_klass,                                  jdk_vm_ci_runtime_JVMCI                          ) \
+  do_klass(HotSpotCompiledCode_klass,                    jdk_vm_ci_hotspot_HotSpotCompiledCode            ) \
+  do_klass(HotSpotCompiledCode_Comment_klass,            jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment    ) \
+  do_klass(HotSpotCompiledNmethod_klass,                 jdk_vm_ci_hotspot_HotSpotCompiledNmethod         ) \
+  do_klass(HotSpotForeignCallTarget_klass,               jdk_vm_ci_hotspot_HotSpotForeignCallTarget       ) \
+  do_klass(HotSpotReferenceMap_klass,                    jdk_vm_ci_hotspot_HotSpotReferenceMap            ) \
+  do_klass(HotSpotInstalledCode_klass,                   jdk_vm_ci_hotspot_HotSpotInstalledCode           ) \
+  do_klass(HotSpotNmethod_klass,                         jdk_vm_ci_hotspot_HotSpotNmethod                 ) \
+  do_klass(HotSpotResolvedJavaMethodImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl  ) \
+  do_klass(HotSpotResolvedObjectTypeImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl  ) \
+  do_klass(HotSpotCompressedNullConstant_klass,          jdk_vm_ci_hotspot_HotSpotCompressedNullConstant  ) \
+  do_klass(HotSpotObjectConstantImpl_klass,              jdk_vm_ci_hotspot_HotSpotObjectConstantImpl      ) \
+  do_klass(HotSpotMetaspaceConstantImpl_klass,           jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl   ) \
+  do_klass(HotSpotSentinelConstant_klass,                jdk_vm_ci_hotspot_HotSpotSentinelConstant        ) \
+  do_klass(HotSpotStackFrameReference_klass,             jdk_vm_ci_hotspot_HotSpotStackFrameReference     ) \
+  do_klass(HotSpotMetaData_klass,                        jdk_vm_ci_hotspot_HotSpotMetaData                ) \
+  do_klass(HotSpotConstantPool_klass,                    jdk_vm_ci_hotspot_HotSpotConstantPool            ) \
+  do_klass(HotSpotJVMCIMetaAccessContext_klass,          jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext  ) \
+  do_klass(HotSpotJVMCIRuntime_klass,                    jdk_vm_ci_hotspot_HotSpotJVMCIRuntime            ) \
+  do_klass(HotSpotSpeculationLog_klass,                  jdk_vm_ci_hotspot_HotSpotSpeculationLog          ) \
+  do_klass(HotSpotCompilationRequestResult_klass,        jdk_vm_ci_hotspot_HotSpotCompilationRequestResult) \
+  do_klass(VMField_klass,                                jdk_vm_ci_hotspot_VMField                        ) \
+  do_klass(VMFlag_klass,                                 jdk_vm_ci_hotspot_VMFlag                         ) \
+  do_klass(VMIntrinsicMethod_klass,                      jdk_vm_ci_hotspot_VMIntrinsicMethod              ) \
+  do_klass(Assumptions_ConcreteMethod_klass,             jdk_vm_ci_meta_Assumptions_ConcreteMethod        ) \
+  do_klass(Assumptions_NoFinalizableSubclass_klass,      jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass ) \
+  do_klass(Assumptions_ConcreteSubtype_klass,            jdk_vm_ci_meta_Assumptions_ConcreteSubtype       ) \
+  do_klass(Assumptions_LeafType_klass,                   jdk_vm_ci_meta_Assumptions_LeafType              ) \
+  do_klass(Assumptions_CallSiteTargetValue_klass,        jdk_vm_ci_meta_Assumptions_CallSiteTargetValue   ) \
+  do_klass(Architecture_klass,                           jdk_vm_ci_code_Architecture                      ) \
+  do_klass(TargetDescription_klass,                      jdk_vm_ci_code_TargetDescription                 ) \
+  do_klass(BytecodePosition_klass,                       jdk_vm_ci_code_BytecodePosition                  ) \
+  do_klass(DebugInfo_klass,                              jdk_vm_ci_code_DebugInfo                         ) \
+  do_klass(RegisterSaveLayout_klass,                     jdk_vm_ci_code_RegisterSaveLayout                ) \
+  do_klass(BytecodeFrame_klass,                          jdk_vm_ci_code_BytecodeFrame                     ) \
+  do_klass(InstalledCode_klass,                          jdk_vm_ci_code_InstalledCode                     ) \
+  do_klass(code_Location_klass,                          jdk_vm_ci_code_Location                          ) \
+  do_klass(code_Register_klass,                          jdk_vm_ci_code_Register                          ) \
+  do_klass(RegisterValue_klass,                          jdk_vm_ci_code_RegisterValue                     ) \
+  do_klass(StackSlot_klass,                              jdk_vm_ci_code_StackSlot                         ) \
+  do_klass(StackLockValue_klass,                         jdk_vm_ci_code_StackLockValue                    ) \
+  do_klass(VirtualObject_klass,                          jdk_vm_ci_code_VirtualObject                     ) \
+  do_klass(site_Call_klass,                              jdk_vm_ci_code_site_Call                         ) \
+  do_klass(site_ConstantReference_klass,                 jdk_vm_ci_code_site_ConstantReference            ) \
+  do_klass(site_DataPatch_klass,                         jdk_vm_ci_code_site_DataPatch                    ) \
+  do_klass(site_DataSectionReference_klass,              jdk_vm_ci_code_site_DataSectionReference         ) \
+  do_klass(site_ExceptionHandler_klass,                  jdk_vm_ci_code_site_ExceptionHandler             ) \
+  do_klass(site_Mark_klass,                              jdk_vm_ci_code_site_Mark                         ) \
+  do_klass(site_Infopoint_klass,                         jdk_vm_ci_code_site_Infopoint                    ) \
+  do_klass(site_Site_klass,                              jdk_vm_ci_code_site_Site                         ) \
+  do_klass(site_InfopointReason_klass,                   jdk_vm_ci_code_site_InfopointReason              ) \
+  do_klass(InspectedFrameVisitor_klass,                  jdk_vm_ci_code_stack_InspectedFrameVisitor       ) \
+  do_klass(JavaConstant_klass,                           jdk_vm_ci_meta_JavaConstant                      ) \
+  do_klass(PrimitiveConstant_klass,                      jdk_vm_ci_meta_PrimitiveConstant                 ) \
+  do_klass(RawConstant_klass,                            jdk_vm_ci_meta_RawConstant                       ) \
+  do_klass(NullConstant_klass,                           jdk_vm_ci_meta_NullConstant                      ) \
+  do_klass(ExceptionHandler_klass,                       jdk_vm_ci_meta_ExceptionHandler                  ) \
+  do_klass(JavaKind_klass,                               jdk_vm_ci_meta_JavaKind                          ) \
+  do_klass(ValueKind_klass,                              jdk_vm_ci_meta_ValueKind                         ) \
+  do_klass(Value_klass,                                  jdk_vm_ci_meta_Value                             )
 #endif
 
 #endif // SHARE_VM_JVMCI_SYSTEMDICTIONARY_JVMCI_HPP
--- a/src/hotspot/share/runtime/reflection.cpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/runtime/reflection.cpp	Fri Oct 19 21:30:11 2018 -0400
@@ -503,7 +503,8 @@
   }
   // Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
   // succeed trivially.
-  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  if (SystemDictionary::reflect_MagicAccessorImpl_klass_is_loaded() &&
+      current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return ACCESS_OK;
   }
 
--- a/src/hotspot/share/services/memoryService.hpp	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/hotspot/share/services/memoryService.hpp	Fri Oct 19 21:30:11 2018 -0400
@@ -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
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Fri Oct 19 21:30:11 2018 -0400
@@ -50,6 +50,9 @@
         this.localSupportedSignAlgs = new ArrayList<SignatureScheme>(
             context.conSession.getLocalSupportedSignatureSchemes());
 
+        this.requestedServerNames =
+                context.conSession.getRequestedServerNames();
+
         handshakeConsumers = new LinkedHashMap<>(consumers);
         handshakeFinished = true;
     }
Binary file src/java.base/share/lib/security/cacerts has changed
--- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Fri Oct 19 21:30:11 2018 -0400
@@ -26,21 +26,26 @@
 package jdk.internal.net.http;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.ConnectException;
 import java.net.http.HttpConnectTimeoutException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.security.AccessControlContext;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
 import java.util.concurrent.CompletionException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
+import java.util.concurrent.Flow;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 
 import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
 import java.net.http.HttpRequest;
 import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodySubscriber;
 import java.net.http.HttpResponse.PushPromiseHandler;
 import java.net.http.HttpTimeoutException;
 import jdk.internal.net.http.common.Log;
@@ -200,11 +205,60 @@
         return cf;
     }
 
+    // return true if the response is a type where a response body is never possible
+    // and therefore doesn't have to include header information which indicates no
+    // body is present. This is distinct from responses that also do not contain
+    // response bodies (possibly ever) but which are required to have content length
+    // info in the header (eg 205). Those cases do not have to be handled specially
+
+    private static boolean bodyNotPermitted(Response r) {
+        return r.statusCode == 204;
+    }
+
+    private boolean bodyIsPresent(Response r) {
+        HttpHeaders headers = r.headers();
+        if (headers.firstValue("Content-length").isPresent())
+            return true;
+        if (headers.firstValue("Transfer-encoding").isPresent())
+            return true;
+        return false;
+    }
+
+    // Call the user's body handler to get an empty body object
+
+    private CompletableFuture<HttpResponse<T>> handleNoBody(Response r, Exchange<T> exch) {
+        BodySubscriber<T> bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(),
+                r.headers(), r.version()));
+        CompletionStage<T> cs = bs.getBody();
+        bs.onSubscribe(new NullSubscription());
+        bs.onComplete();
+        MinimalFuture<HttpResponse<T>> result = new MinimalFuture<>();
+        cs.whenComplete((nullBody, exception) -> {
+            if (exception != null)
+                result.completeExceptionally(exception);
+            else {
+                this.response =
+                        new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch);
+                result.complete(this.response);
+            }
+        });
+        return result;
+    }
+
     private CompletableFuture<HttpResponse<T>>
     responseAsync0(CompletableFuture<Void> start) {
         return start.thenCompose( v -> responseAsyncImpl())
                     .thenCompose((Response r) -> {
                         Exchange<T> exch = getExchange();
+                        if (bodyNotPermitted(r)) {
+                            if (bodyIsPresent(r)) {
+                                IOException ioe = new IOException(
+                                    "unexpected content length header with 204 response");
+                                exch.cancel(ioe);
+                                return MinimalFuture.failedFuture(ioe);
+                            } else
+                                return handleNoBody(r, exch);
+                        }
                         return exch.readBodyAsync(responseHandler)
                             .thenApply((T body) -> {
                                 this.response =
@@ -214,6 +268,16 @@
                     });
     }
 
+    static class NullSubscription implements Flow.Subscription {
+        @Override
+        public void request(long n) {
+        }
+
+        @Override
+        public void cancel() {
+        }
+    }
+
     private CompletableFuture<Response> responseAsyncImpl() {
         CompletableFuture<Response> cf;
         if (attempts.incrementAndGet() > max_attempts) {
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Fri Oct 19 21:30:11 2018 -0400
@@ -255,9 +255,7 @@
                     noContentToSend = true;
                     contentLen = 0;
                 }
-                if (noContentLengthHeader) {
-                    rspHdrs.remove("Content-length");
-                } else {
+                if (!noContentLengthHeader) {
                     rspHdrs.set("Content-length", Long.toString(contentLen));
                 }
                 o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
--- a/test/jdk/com/sun/jdi/DeferredStepTest.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/test/jdk/com/sun/jdi/DeferredStepTest.java	Fri Oct 19 21:30:11 2018 -0400
@@ -114,7 +114,7 @@
          * Each "next" produces something like ("Breakpoint hit" line only if the line has BP)
          *   Step completed:
          *     Breakpoint hit: "thread=jj2", DeferredStepTestTarg$jj2.run(), line=74 bci=12
-         *     74                    ++count2;                           // @2 breakpoint
+         *     74                    ++count2;                           // @ 2 breakpoint
          *     <empty line>
          *     jj2[1]
          */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/Response204.java	Fri Oct 19 21:30:11 2018 -0400
@@ -0,0 +1,109 @@
+/*
+ * 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 8211437
+ * @run main/othervm -Djdk.httpclient.HttpClient.log=headers,requests Response204
+ * @summary
+ */
+
+import com.sun.net.httpserver.*;
+
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+
+/**
+ * Verify that a 204 response code with no content-length is handled correctly
+ */
+public class Response204 {
+
+    public static void main (String[] args) throws Exception {
+        Logger logger = Logger.getLogger ("com.sun.net.httpserver");
+        ConsoleHandler c = new ConsoleHandler();
+        c.setLevel (Level.WARNING);
+        logger.addHandler (c);
+        logger.setLevel (Level.WARNING);
+        Handler handler = new Handler();
+        InetSocketAddress addr = new InetSocketAddress (0);
+        HttpServer server = HttpServer.create (addr, 0);
+        HttpContext ctx = server.createContext ("/test", handler);
+        ExecutorService executor = Executors.newCachedThreadPool();
+        server.setExecutor (executor);
+        server.start ();
+
+        URI uri = new URI("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
+
+        try {
+            HttpClient client = HttpClient.newHttpClient();
+            HttpRequest request = HttpRequest.newBuilder(uri)
+                    .GET()
+                    .build();
+            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+            if (response.statusCode() != 204)
+                throw new RuntimeException("wrong response code");
+            if (response.body() != null && !response.body().equals(""))
+                throw new RuntimeException("should have received empty response");
+            System.out.println(response.headers().firstValue("content-length").orElse("nichts"));
+            System.out.println ("OK 1");
+            // Send a second time. This time we should get exception because the server
+            // is going to send an invalid 204 with a Content-length
+            try {
+                response = client.send(request, HttpResponse.BodyHandlers.ofString());
+                throw new RuntimeException("send should have thrown exception");
+            } catch (IOException ioe) {
+                System.out.println("OK 2");
+            }
+        } finally {
+            server.stop(2);
+            executor.shutdown();
+        }
+    }
+
+    public static boolean error = false;
+
+    static class Handler implements HttpHandler {
+        volatile int counter = 0;
+
+        public void handle(HttpExchange t)
+                throws IOException {
+            InputStream is = t.getRequestBody();
+            Headers map = t.getRequestHeaders();
+            Headers rmap = t.getResponseHeaders();
+            while (is.read() != -1) ;
+            is.close();
+            if (counter++ == 1) {
+                // pretend there is a body
+                rmap.set("Content-length", "10");
+            }
+            t.sendResponseHeaders(204, -1);
+            t.close();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/http2/NoBodyTest.java	Fri Oct 19 21:30:11 2018 -0400
@@ -0,0 +1,221 @@
+/*
+ * 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
+ * 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 8087112
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
+ * @modules java.base/sun.net.www.http
+ *          java.net.http/jdk.internal.net.http.common
+ *          java.net.http/jdk.internal.net.http.frame
+ *          java.net.http/jdk.internal.net.http.hpack
+ * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors NoBodyTest
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+import javax.net.ssl.*;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import java.util.concurrent.*;
+import jdk.test.lib.net.SimpleSSLContext;
+import org.testng.annotations.Test;
+import static java.net.http.HttpClient.Version.HTTP_2;
+
+@Test
+public class NoBodyTest {
+    static int httpPort, httpsPort;
+    static Http2TestServer httpServer, httpsServer;
+    static HttpClient client = null;
+    static ExecutorService clientExec;
+    static ExecutorService serverExec;
+    static SSLContext sslContext;
+    static String TEST_STRING = "The quick brown fox jumps over the lazy dog ";
+
+    static String httpURIString, httpsURIString;
+
+    static void initialize() throws Exception {
+        try {
+            SimpleSSLContext sslct = new SimpleSSLContext();
+            sslContext = sslct.get();
+            client = getClient();
+            httpServer = new Http2TestServer(false, 0, serverExec, sslContext);
+            httpServer.addHandler(new Handler(), "/");
+            httpPort = httpServer.getAddress().getPort();
+
+            httpsServer = new Http2TestServer(true, 0, serverExec, sslContext);
+            httpsServer.addHandler(new Handler(), "/");
+
+            httpsPort = httpsServer.getAddress().getPort();
+            httpURIString = "http://localhost:" + httpPort + "/foo/";
+            httpsURIString = "https://localhost:" + httpsPort + "/bar/";
+
+            httpServer.start();
+            httpsServer.start();
+        } catch (Throwable e) {
+            System.err.println("Throwing now");
+            e.printStackTrace(System.err);
+            throw e;
+        }
+    }
+
+    @Test
+    public static void runtest() throws Exception {
+        try {
+            initialize();
+            warmup(false);
+            warmup(true);
+            test(false);
+            test(true);
+        } catch (Throwable tt) {
+            System.err.println("tt caught");
+            tt.printStackTrace(System.err);
+            throw tt;
+        } finally {
+            httpServer.stop();
+            httpsServer.stop();
+        }
+    }
+
+    static HttpClient getClient() {
+        if (client == null) {
+            serverExec = Executors.newCachedThreadPool();
+            clientExec = Executors.newCachedThreadPool();
+            client = HttpClient.newBuilder()
+                               .executor(clientExec)
+                               .sslContext(sslContext)
+                               .version(HTTP_2)
+                               .build();
+        }
+        return client;
+    }
+
+    static URI getURI(boolean secure) {
+        if (secure)
+            return URI.create(httpsURIString);
+        else
+            return URI.create(httpURIString);
+    }
+
+    static void checkStatus(int expected, int found) throws Exception {
+        if (expected != found) {
+            System.err.printf ("Test failed: wrong status code %d/%d\n",
+                expected, found);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    static void checkStrings(String expected, String found) throws Exception {
+        if (!expected.equals(found)) {
+            System.err.printf ("Test failed: wrong string %s/%s\n",
+                expected, found);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    static final int LOOPS = 13;
+
+    static void warmup(boolean secure) throws Exception {
+        URI uri = getURI(secure);
+        String type = secure ? "https" : "http";
+        System.err.println("Request to " + uri);
+
+        // Do a simple warmup request
+
+        HttpClient client = getClient();
+        HttpRequest req = HttpRequest.newBuilder(uri)
+                                     .POST(BodyPublishers.ofString("Random text"))
+                                     .build();
+        HttpResponse<String> response = client.send(req, BodyHandlers.ofString());
+        checkStatus(200, response.statusCode());
+        String responseBody = response.body();
+        HttpHeaders h = response.headers();
+        checkStrings(TEST_STRING + type, responseBody);
+    }
+
+    static void test(boolean secure) throws Exception {
+        URI uri = getURI(secure);
+        String type = secure ? "https" : "http";
+        System.err.println("Request to " + uri);
+
+        HttpRequest request = HttpRequest.newBuilder(uri)
+                .POST(BodyPublishers.ofString(TEST_STRING))
+                .build();
+        for (int i = 0; i < LOOPS; i++) {
+            System.out.println("Loop " + i);
+            HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
+            int expectedResponse = (i % 2) == 0 ? 204 : 200;
+            if (response.statusCode() != expectedResponse)
+                throw new RuntimeException("wrong response code " + Integer.toString(response.statusCode()));
+            if (expectedResponse == 200 && !response.body().equals(TEST_STRING + type)) {
+                System.err.printf("response received/expected %s/%s\n", response.body(), TEST_STRING + type);
+                throw new RuntimeException("wrong response body");
+            }
+        }
+        System.err.println("test: DONE");
+    }
+
+    static class Handler implements Http2Handler {
+
+        public Handler() {}
+
+        volatile int invocation = 0;
+
+        @Override
+        public void handle(Http2TestExchange t)
+                throws IOException {
+            try {
+                URI uri = t.getRequestURI();
+                System.err.printf("Handler received request to %s from %s\n",
+                        uri, t.getRemoteAddress());
+                String type = uri.getScheme().toLowerCase();
+                InputStream is = t.getRequestBody();
+                while (is.read() != -1);
+                is.close();
+
+                // every second response is 204.
+
+                if ((invocation++ % 2) == 1) {
+                    System.err.println("Server sending 204");
+                    t.sendResponseHeaders(204, -1);
+                } else {
+                    String body = TEST_STRING + type;
+                    t.sendResponseHeaders(200, body.length());
+                    OutputStream os = t.getResponseBody();
+                    os.write(body.getBytes());
+                    os.close();
+                }
+            } catch (Throwable e) {
+                e.printStackTrace(System.err);
+                throw new IOException(e);
+            }
+        }
+    }
+}
--- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java	Fri Oct 19 21:30:11 2018 -0400
@@ -129,7 +129,7 @@
     @Override
     public void sendResponseHeaders(int rCode, long responseLength) throws IOException {
         this.responseLength = responseLength;
-        if (responseLength > 0 || responseLength < 0) {
+        if (responseLength !=0 && rCode != 204) {
                 long clen = responseLength > 0 ? responseLength : 0;
             rspheadersBuilder.setHeader("Content-length", Long.toString(clen));
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java	Fri Oct 19 21:30:11 2018 -0400
@@ -0,0 +1,586 @@
+/*
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8211806
+ * @summary TLS 1.3 handshake server name indication is missing on a session resume
+ * @run main/othervm ResumeTLS13withSNI
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.security.*;
+import java.nio.*;
+import java.util.List;
+
+public class ResumeTLS13withSNI {
+
+    /*
+     * Enables logging of the SSLEngine operations.
+     */
+    private static final boolean logging = false;
+
+    /*
+     * Enables the JSSE system debugging system property:
+     *
+     *     -Djavax.net.debug=ssl:handshake
+     *
+     * This gives a lot of low-level information about operations underway,
+     * including specific handshake messages, and might be best examined
+     * after gaining some familiarity with this application.
+     */
+    private static final boolean debug = true;
+
+    private static final ByteBuffer clientOut =
+            ByteBuffer.wrap("Hi Server, I'm Client".getBytes());
+    private static final ByteBuffer serverOut =
+            ByteBuffer.wrap("Hello Client, I'm Server".getBytes());
+
+    /*
+     * The following is to set up the keystores.
+     */
+    private static final String pathToStores = "../etc";
+    private static final String keyStoreFile = "keystore";
+    private static final String trustStoreFile = "truststore";
+    private static final char[] passphrase = "passphrase".toCharArray();
+
+    private static final String keyFilename =
+            System.getProperty("test.src", ".") + "/" + pathToStores +
+                "/" + keyStoreFile;
+    private static final String trustFilename =
+            System.getProperty("test.src", ".") + "/" + pathToStores +
+                "/" + trustStoreFile;
+
+    private static final String HOST_NAME = "arf.yak.foo";
+    private static final SNIHostName SNI_NAME = new SNIHostName(HOST_NAME);
+    private static final SNIMatcher SNI_MATCHER =
+            SNIHostName.createSNIMatcher("arf\\.yak\\.foo");
+
+    /*
+     * Main entry point for this test.
+     */
+    public static void main(String args[]) throws Exception {
+        if (debug) {
+            System.setProperty("javax.net.debug", "ssl:handshake");
+        }
+
+        KeyManagerFactory kmf = makeKeyManagerFactory(keyFilename,
+                passphrase);
+        TrustManagerFactory tmf = makeTrustManagerFactory(trustFilename,
+                passphrase);
+
+        SSLContext sslCtx = SSLContext.getInstance("TLS");
+        sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        // Make client and server engines, then customize as needed
+        SSLEngine clientEngine = makeEngine(sslCtx, kmf, tmf, true);
+        SSLParameters cliSSLParams = clientEngine.getSSLParameters();
+        cliSSLParams.setServerNames(List.of(SNI_NAME));
+        clientEngine.setSSLParameters(cliSSLParams);
+        clientEngine.setEnabledProtocols(new String[] { "TLSv1.3" });
+
+        SSLEngine serverEngine = makeEngine(sslCtx, kmf, tmf, false);
+        SSLParameters servSSLParams = serverEngine.getSSLParameters();
+        servSSLParams.setSNIMatchers(List.of(SNI_MATCHER));
+        serverEngine.setSSLParameters(servSSLParams);
+
+        initialHandshake(clientEngine, serverEngine);
+
+        // Create a new client-side engine which can initiate TLS session
+        // resumption
+        SSLEngine newCliEngine = makeEngine(sslCtx, kmf, tmf, true);
+        newCliEngine.setEnabledProtocols(new String[] { "TLSv1.3" });
+        ByteBuffer resCliHello = getResumptionClientHello(newCliEngine);
+
+        dumpBuffer("Resumed ClientHello Data", resCliHello);
+
+        // Parse the client hello message and make sure it is a resumption
+        // hello and has SNI in it.
+        checkResumedClientHelloSNI(resCliHello);
+    }
+
+    /*
+     * Run the test.
+     *
+     * Sit in a tight loop, both engines calling wrap/unwrap regardless
+     * of whether data is available or not.  We do this until both engines
+     * report back they are closed.
+     *
+     * The main loop handles all of the I/O phases of the SSLEngine's
+     * lifetime:
+     *
+     *     initial handshaking
+     *     application data transfer
+     *     engine closing
+     *
+     * One could easily separate these phases into separate
+     * sections of code.
+     */
+    private static void initialHandshake(SSLEngine clientEngine,
+            SSLEngine serverEngine) throws Exception {
+        boolean dataDone = false;
+
+        // Create all the buffers
+        SSLSession session = clientEngine.getSession();
+        int appBufferMax = session.getApplicationBufferSize();
+        int netBufferMax = session.getPacketBufferSize();
+        ByteBuffer clientIn = ByteBuffer.allocate(appBufferMax + 50);
+        ByteBuffer serverIn = ByteBuffer.allocate(appBufferMax + 50);
+        ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax);
+        ByteBuffer sTOc = ByteBuffer.allocateDirect(netBufferMax);
+
+        // results from client's last operation
+        SSLEngineResult clientResult;
+
+        // results from server's last operation
+        SSLEngineResult serverResult;
+
+        /*
+         * Examining the SSLEngineResults could be much more involved,
+         * and may alter the overall flow of the application.
+         *
+         * For example, if we received a BUFFER_OVERFLOW when trying
+         * to write to the output pipe, we could reallocate a larger
+         * pipe, but instead we wait for the peer to drain it.
+         */
+        Exception clientException = null;
+        Exception serverException = null;
+
+        while (!dataDone) {
+            log("================");
+
+            try {
+                clientResult = clientEngine.wrap(clientOut, cTOs);
+                log("client wrap: ", clientResult);
+            } catch (Exception e) {
+                clientException = e;
+                System.err.println("Client wrap() threw: " + e.getMessage());
+            }
+            logEngineStatus(clientEngine);
+            runDelegatedTasks(clientEngine);
+
+            log("----");
+
+            try {
+                serverResult = serverEngine.wrap(serverOut, sTOc);
+                log("server wrap: ", serverResult);
+            } catch (Exception e) {
+                serverException = e;
+                System.err.println("Server wrap() threw: " + e.getMessage());
+            }
+            logEngineStatus(serverEngine);
+            runDelegatedTasks(serverEngine);
+
+            cTOs.flip();
+            sTOc.flip();
+
+            log("--------");
+
+            try {
+                clientResult = clientEngine.unwrap(sTOc, clientIn);
+                log("client unwrap: ", clientResult);
+            } catch (Exception e) {
+                clientException = e;
+                System.err.println("Client unwrap() threw: " + e.getMessage());
+            }
+            logEngineStatus(clientEngine);
+            runDelegatedTasks(clientEngine);
+
+            log("----");
+
+            try {
+                serverResult = serverEngine.unwrap(cTOs, serverIn);
+                log("server unwrap: ", serverResult);
+            } catch (Exception e) {
+                serverException = e;
+                System.err.println("Server unwrap() threw: " + e.getMessage());
+            }
+            logEngineStatus(serverEngine);
+            runDelegatedTasks(serverEngine);
+
+            cTOs.compact();
+            sTOc.compact();
+
+            /*
+             * After we've transfered all application data between the client
+             * and server, we close the clientEngine's outbound stream.
+             * This generates a close_notify handshake message, which the
+             * server engine receives and responds by closing itself.
+             */
+            if (!dataDone && (clientOut.limit() == serverIn.position()) &&
+                    (serverOut.limit() == clientIn.position())) {
+
+                /*
+                 * A sanity check to ensure we got what was sent.
+                 */
+                checkTransfer(serverOut, clientIn);
+                checkTransfer(clientOut, serverIn);
+
+                dataDone = true;
+            }
+        }
+    }
+
+    /**
+     * The goal of this function is to start a simple TLS session resumption
+     * and get the client hello message data back so it can be inspected.
+     *
+     * @param clientEngine
+     *
+     * @return a ByteBuffer consisting of the ClientHello TLS record.
+     *
+     * @throws Exception if any processing goes wrong.
+     */
+    private static ByteBuffer getResumptionClientHello(SSLEngine clientEngine)
+            throws Exception {
+        // Create all the buffers
+        SSLSession session = clientEngine.getSession();
+        int appBufferMax = session.getApplicationBufferSize();
+        int netBufferMax = session.getPacketBufferSize();
+        ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax);
+        Exception clientException = null;
+
+        // results from client's last operation
+        SSLEngineResult clientResult;
+
+        // results from server's last operation
+        SSLEngineResult serverResult;
+
+        log("================");
+
+        // Start by having the client create a new ClientHello.  It should
+        // contain PSK info that allows it to attempt session resumption.
+        try {
+            clientResult = clientEngine.wrap(clientOut, cTOs);
+            log("client wrap: ", clientResult);
+        } catch (Exception e) {
+            clientException = e;
+            System.err.println("Client wrap() threw: " + e.getMessage());
+        }
+        logEngineStatus(clientEngine);
+        runDelegatedTasks(clientEngine);
+
+        log("----");
+
+        cTOs.flip();
+        return cTOs;
+    }
+
+    /**
+     * This method walks a ClientHello TLS record, looking for a matching
+     * server_name hostname value from the original handshake and a PSK
+     * extension, which indicates (in the context of this test) that this
+     * is a resumed handshake.
+     *
+     * @param resCliHello a ByteBuffer consisting of a complete TLS handshake
+     *      record that is a ClientHello message.  The position of the buffer
+     *      must be at the beginning of the TLS record header.
+     *
+     * @throws Exception if any of the consistency checks for the TLS record,
+     *      or handshake message fails.  It will also throw an exception if
+     *      either the server_name extension doesn't have a matching hostname
+     *      field or the pre_shared_key extension is not present.
+     */
+    private static void checkResumedClientHelloSNI(ByteBuffer resCliHello)
+            throws Exception {
+        boolean foundMatchingSNI = false;
+        boolean foundPSK = false;
+
+        // Advance past the following fields:
+        // TLS Record header (5 bytes)
+        resCliHello.position(resCliHello.position() + 5);
+
+        // Get the next byte and make sure it is a Client Hello
+        byte hsMsgType = resCliHello.get();
+        if (hsMsgType != 0x01) {
+            throw new Exception("Message is not a ClientHello, MsgType = " +
+                    hsMsgType);
+        }
+
+        // Skip past the length (3 bytes)
+        resCliHello.position(resCliHello.position() + 3);
+
+        // Protocol version should be TLSv1.2 (0x03, 0x03)
+        short chProto = resCliHello.getShort();
+        if (chProto != 0x0303) {
+            throw new Exception(
+                    "Client Hello protocol version is not TLSv1.2: Got " +
+                            String.format("0x%04X", chProto));
+        }
+
+        // Skip 32-bytes of random data
+        resCliHello.position(resCliHello.position() + 32);
+
+        // Get the legacy session length and skip that many bytes
+        int sessIdLen = Byte.toUnsignedInt(resCliHello.get());
+        resCliHello.position(resCliHello.position() + sessIdLen);
+
+        // Skip over all the cipher suites
+        int csLen = Short.toUnsignedInt(resCliHello.getShort());
+        resCliHello.position(resCliHello.position() + csLen);
+
+        // Skip compression methods
+        int compLen = Byte.toUnsignedInt(resCliHello.get());
+        resCliHello.position(resCliHello.position() + compLen);
+
+        // Parse the extensions.  Get length first, then walk the extensions
+        // List and look for the presence of the PSK extension and server_name.
+        // For server_name, make sure it is the same as what was provided
+        // in the original handshake.
+        System.err.println("ClientHello Extensions Check");
+        int extListLen = Short.toUnsignedInt(resCliHello.getShort());
+        while (extListLen > 0) {
+            // Get the Extension type and length
+            int extType = Short.toUnsignedInt(resCliHello.getShort());
+            int extLen = Short.toUnsignedInt(resCliHello.getShort());
+            switch (extType) {
+                case 0:                 // server_name
+                    System.err.println("* Found server_name Extension");
+                    int snListLen = Short.toUnsignedInt(resCliHello.getShort());
+                    while (snListLen > 0) {
+                        int nameType = Byte.toUnsignedInt(resCliHello.get());
+                        if (nameType == 0) {            // host_name
+                            int hostNameLen =
+                                    Short.toUnsignedInt(resCliHello.getShort());
+                            byte[] hostNameData = new byte[hostNameLen];
+                            resCliHello.get(hostNameData);
+                            String hostNameStr = new String(hostNameData);
+                            System.err.println("\tHostname: " + hostNameStr);
+                            if (hostNameStr.equals(HOST_NAME)) {
+                                foundMatchingSNI = true;
+                            }
+                            snListLen -= 3 + hostNameLen;   // type, len, data
+                        } else {                        // something else
+                            // We don't support anything else and cannot
+                            // know how to advance.  Throw an exception
+                            throw new Exception("Unknown server name type: " +
+                                    nameType);
+                        }
+                    }
+                    break;
+                case 41:                // pre_shared_key
+                    // We're not going to bother checking the value.  The
+                    // presence of the extension in the context of this test
+                    // is good enough to tell us this is a resumed ClientHello.
+                    foundPSK = true;
+                    System.err.println("* Found pre_shared_key Extension");
+                    resCliHello.position(resCliHello.position() + extLen);
+                    break;
+                default:
+                    System.err.format("* Found extension %d (%d bytes)\n",
+                            extType, extLen);
+                    resCliHello.position(resCliHello.position() + extLen);
+                    break;
+            }
+            extListLen -= extLen + 4;   // Ext type(2), length(2), data(var.)
+        }
+
+        // At the end of all the extension processing, either we've found
+        // both extensions and the server_name matches our expected value
+        // or we throw an exception.
+        if (!foundMatchingSNI) {
+            throw new Exception("Could not find a matching server_name");
+        } else if (!foundPSK) {
+            throw new Exception("Missing PSK extension, not a resumption?");
+        }
+    }
+
+    /**
+     * Create a TrustManagerFactory from a given keystore.
+     *
+     * @param tsPath the path to the trust store file.
+     * @param pass the password for the trust store.
+     *
+     * @return a new TrustManagerFactory built from the trust store provided.
+     *
+     * @throws GeneralSecurityException if any processing errors occur
+     *      with the Keystore instantiation or TrustManagerFactory creation.
+     * @throws IOException if any loading error with the trust store occurs.
+     */
+    private static TrustManagerFactory makeTrustManagerFactory(String tsPath,
+            char[] pass) throws GeneralSecurityException, IOException {
+        TrustManagerFactory tmf;
+        KeyStore ts = KeyStore.getInstance("JKS");
+
+        try (FileInputStream fsIn = new FileInputStream(tsPath)) {
+            ts.load(fsIn, pass);
+            tmf = TrustManagerFactory.getInstance("SunX509");
+            tmf.init(ts);
+        }
+        return tmf;
+    }
+
+    /**
+     * Create a KeyManagerFactory from a given keystore.
+     *
+     * @param ksPath the path to the keystore file.
+     * @param pass the password for the keystore.
+     *
+     * @return a new TrustManagerFactory built from the keystore provided.
+     *
+     * @throws GeneralSecurityException if any processing errors occur
+     *      with the Keystore instantiation or KeyManagerFactory creation.
+     * @throws IOException if any loading error with the keystore occurs
+     */
+    private static KeyManagerFactory makeKeyManagerFactory(String ksPath,
+            char[] pass) throws GeneralSecurityException, IOException {
+        KeyManagerFactory kmf;
+        KeyStore ks = KeyStore.getInstance("JKS");
+
+        try (FileInputStream fsIn = new FileInputStream(ksPath)) {
+            ks.load(fsIn, pass);
+            kmf = KeyManagerFactory.getInstance("SunX509");
+            kmf.init(ks, pass);
+        }
+        return kmf;
+    }
+
+    /**
+     * Create an SSLEngine instance from a given protocol specifier,
+     * KeyManagerFactory and TrustManagerFactory.
+     *
+     * @param ctx the SSLContext used to create the SSLEngine
+     * @param kmf an initialized KeyManagerFactory.  May be null.
+     * @param tmf an initialized TrustManagerFactory.  May be null.
+     * @param isClient true if it intended to create a client engine, false
+     *      for a server engine.
+     *
+     * @return an SSLEngine instance configured as a server and with client
+     *      authentication disabled.
+     *
+     * @throws GeneralSecurityException if any errors occur during the
+     *      creation of the SSLEngine.
+     */
+    private static SSLEngine makeEngine(SSLContext ctx,
+            KeyManagerFactory kmf, TrustManagerFactory tmf, boolean isClient)
+            throws GeneralSecurityException {
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+        SSLEngine ssle = ctx.createSSLEngine("localhost", 8443);
+        ssle.setUseClientMode(isClient);
+        ssle.setNeedClientAuth(false);
+        return ssle;
+    }
+
+    private static void logEngineStatus(SSLEngine engine) {
+        log("\tCurrent HS State  " + engine.getHandshakeStatus().toString());
+        log("\tisInboundDone():  " + engine.isInboundDone());
+        log("\tisOutboundDone(): " + engine.isOutboundDone());
+    }
+
+    /*
+     * If the result indicates that we have outstanding tasks to do,
+     * go ahead and run them in this thread.
+     */
+    private static void runDelegatedTasks(SSLEngine engine) throws Exception {
+
+        if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+            Runnable runnable;
+            while ((runnable = engine.getDelegatedTask()) != null) {
+                log("    running delegated task...");
+                runnable.run();
+            }
+            HandshakeStatus hsStatus = engine.getHandshakeStatus();
+            if (hsStatus == HandshakeStatus.NEED_TASK) {
+                throw new Exception(
+                    "handshake shouldn't need additional tasks");
+            }
+            logEngineStatus(engine);
+        }
+    }
+
+    private static boolean isEngineClosed(SSLEngine engine) {
+        return (engine.isOutboundDone() && engine.isInboundDone());
+    }
+
+    /*
+     * Simple check to make sure everything came across as expected.
+     */
+    private static void checkTransfer(ByteBuffer a, ByteBuffer b)
+            throws Exception {
+        a.flip();
+        b.flip();
+
+        if (!a.equals(b)) {
+            throw new Exception("Data didn't transfer cleanly");
+        } else {
+            log("\tData transferred cleanly");
+        }
+
+        a.position(a.limit());
+        b.position(b.limit());
+        a.limit(a.capacity());
+        b.limit(b.capacity());
+    }
+
+    /*
+     * Logging code
+     */
+    private static boolean resultOnce = true;
+
+    private static void log(String str, SSLEngineResult result) {
+        if (!logging) {
+            return;
+        }
+        if (resultOnce) {
+            resultOnce = false;
+            System.err.println("The format of the SSLEngineResult is: \n" +
+                    "\t\"getStatus() / getHandshakeStatus()\" +\n" +
+                    "\t\"bytesConsumed() / bytesProduced()\"\n");
+        }
+        HandshakeStatus hsStatus = result.getHandshakeStatus();
+        log(str +
+                result.getStatus() + "/" + hsStatus + ", " +
+                result.bytesConsumed() + "/" + result.bytesProduced() +
+                " bytes");
+        if (hsStatus == HandshakeStatus.FINISHED) {
+            log("\t...ready for application data");
+        }
+    }
+
+    private static void log(String str) {
+        if (logging) {
+            System.err.println(str);
+        }
+    }
+
+    private static void dumpBuffer(String header, ByteBuffer data) {
+        data.mark();
+        System.err.format("========== %s ==========\n", header);
+        int i = 0;
+        while (data.remaining() > 0) {
+            if (i != 0 && i % 16 == 0) {
+                System.err.print("\n");
+            }
+            System.err.format("%02X ", data.get());
+            i++;
+        }
+        System.err.println();
+        data.reset();
+    }
+
+}
--- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Fri Oct 19 19:33:35 2018 -0400
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Fri Oct 19 21:30:11 2018 -0400
@@ -24,8 +24,8 @@
 
 /**
  * @test
- * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452
- *      8209506 8210432
+ * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
+ *      8209452 8209506 8210432 8195793
  * @summary Check root CA entries in cacerts file
  */
 import java.io.File;
@@ -42,7 +42,7 @@
             + File.separator + "security" + File.separator + "cacerts";
 
     // The numbers of certs now.
-    private static final int COUNT = 93;
+    private static final int COUNT = 92;
 
     // map of cert alias to SHA-256 fingerprint
     private static final Map<String, String> FINGERPRINT_MAP
@@ -116,8 +116,6 @@
                     "B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4");
             put("geotrustuniversalca [jdk]",
                     "A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12");
-            put("gtecybertrustglobalca [jdk]",
-                    "A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36");
             put("thawteprimaryrootca [jdk]",
                     "8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F");
             put("thawteprimaryrootcag2 [jdk]",
@@ -239,10 +237,7 @@
 
     // Exception list to 90 days expiry policy
     // No error will be reported if certificate in this list expires
-    private static final HashSet<String> EXPIRY_EXC_ENTRIES
-            = new HashSet<String>(Arrays.asList(
-                    "gtecybertrustglobalca [jdk]"
-            ));
+    private static final HashSet<String> EXPIRY_EXC_ENTRIES = new HashSet<>();
 
     // Ninety days in milliseconds
     private static final long NINETY_DAYS = 7776000000L;