changeset 52632:f08c1d7a5c53

8212642: Remove SystemDictionary::InitOption enum Reviewed-by: dholmes, kvn, redestad
author iklam
date Thu, 18 Oct 2018 23:05:01 -0700
parents 6eb876ac6827
children 420445d16008 94b85ea16cf9
files src/hotspot/share/ci/ciEnv.cpp src/hotspot/share/ci/ciEnv.hpp src/hotspot/share/ci/ciObjectFactory.cpp src/hotspot/share/classfile/systemDictionary.cpp src/hotspot/share/classfile/systemDictionary.hpp src/hotspot/share/jvmci/jvmciJavaClasses.hpp src/hotspot/share/jvmci/systemDictionary_jvmci.hpp src/hotspot/share/runtime/reflection.cpp
diffstat 8 files changed, 208 insertions(+), 241 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/ci/ciEnv.cpp	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/ci/ciEnv.cpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/ci/ciEnv.hpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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/jvmci/jvmciJavaClasses.hpp	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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	Thu Oct 18 21:14:49 2018 +0200
+++ b/src/hotspot/share/runtime/reflection.cpp	Thu Oct 18 23:05:01 2018 -0700
@@ -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;
   }