diff -r 124af9276e44 -r 625f6c742392 src/hotspot/share/classfile/systemDictionary.hpp --- a/src/hotspot/share/classfile/systemDictionary.hpp Mon Oct 29 12:33:41 2018 -0700 +++ b/src/hotspot/share/classfile/systemDictionary.hpp Wed Oct 17 15:57:10 2018 -0700 @@ -85,19 +85,20 @@ class GCTimer; class OopStorage; -// Certain classes are preloaded, such as java.lang.Object and java.lang.String. -// They are all "well-known", in the sense that no class loader is allowed +#define WK_KLASS_ENUM_NAME(kname) kname##_knum + +// Certain classes, such as java.lang.Object and java.lang.String, +// are "well-known", in the sense that no class loader is allowed // to provide a different definition. // -// These klasses must all have names defined in vmSymbols. - -#define WK_KLASS_ENUM_NAME(kname) kname##_knum - // Each well-known class has a short klass name (like object_klass), // 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. - +// +// The order of these definitions is significant: the classes are +// resolved during early VM start-up by resolve_well_known_classes +// in this order. Changing the order may require careful restructuring +// of the VM start-up sequence. +// #define WK_KLASSES_DO(do_klass) \ /* well-known classes */ \ do_klass(Object_klass, java_lang_Object ) \ @@ -127,7 +128,7 @@ do_klass(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException ) \ do_klass(Reference_klass, java_lang_ref_Reference ) \ \ - /* Preload ref klasses and set reference types */ \ + /* 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 ) \ @@ -200,7 +201,7 @@ /* support for stack dump lock analysis */ \ do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \ \ - /* Preload boxing klasses */ \ + /* boxing klasses */ \ do_klass(Boolean_klass, java_lang_Boolean ) \ do_klass(Character_klass, java_lang_Character ) \ do_klass(Float_klass, java_lang_Float ) \ @@ -391,7 +392,8 @@ // Initialization static void initialize(TRAPS); - // Checked fast access to commonly used classes - mostly preloaded + // Checked fast access to the well-known classes -- so that you don't try to use them + // before they are resolved. static InstanceKlass* check_klass(InstanceKlass* k) { assert(k != NULL, "klass not loaded"); return k; @@ -435,6 +437,12 @@ return check_klass(_box_klasses[t]); } static BasicType box_klass_type(Klass* k); // inverse of box_klass +#ifdef ASSERT + static bool is_well_known_klass(Klass* k) { + return is_well_known_klass(k->name()); + } + static bool is_well_known_klass(Symbol* class_name); +#endif protected: // Returns the class loader data to be used when looking up/updating the @@ -695,8 +703,8 @@ ClassLoaderData* loader_data, TRAPS); - // Resolve preloaded classes so they can be used like SystemDictionary::String_klass() - static void resolve_preloaded_classes(TRAPS); + // Resolve well-known classes so they can be used like SystemDictionary::String_klass() + static void resolve_well_known_classes(TRAPS); // Class loader constraints static void check_constraints(unsigned int hash, @@ -707,7 +715,6 @@ InstanceKlass* k, Handle loader, TRAPS); - // Variables holding commonly used klasses (preloaded) static InstanceKlass* _well_known_klasses[]; // table of box klasses (int_klass, etc.)