diff -r 39fb2dc78042 -r 10767ca40189 hotspot/src/share/vm/classfile/systemDictionary.hpp --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Tue Apr 29 19:40:51 2008 -0700 +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Tue Apr 29 19:45:22 2008 -0700 @@ -64,12 +64,133 @@ class HashtableBucket; class ResolutionErrorTable; +// 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 +// 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), +// 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. +// The order of these definitions is significant; it is the order in which +// preloading is actually performed by initialize_preloaded_classes. + +#define WK_KLASSES_DO(template) \ + /* well-known classes */ \ + template(object_klass, java_lang_Object, Pre) \ + template(string_klass, java_lang_String, Pre) \ + template(class_klass, java_lang_Class, Pre) \ + template(cloneable_klass, java_lang_Cloneable, Pre) \ + template(classloader_klass, java_lang_ClassLoader, Pre) \ + template(serializable_klass, java_io_Serializable, Pre) \ + template(system_klass, java_lang_System, Pre) \ + template(throwable_klass, java_lang_Throwable, Pre) \ + template(error_klass, java_lang_Error, Pre) \ + template(threaddeath_klass, java_lang_ThreadDeath, Pre) \ + template(exception_klass, java_lang_Exception, Pre) \ + template(runtime_exception_klass, java_lang_RuntimeException, Pre) \ + template(protectionDomain_klass, java_security_ProtectionDomain, Pre) \ + template(AccessControlContext_klass, java_security_AccessControlContext, Pre) \ + template(classNotFoundException_klass, java_lang_ClassNotFoundException, Pre) \ + template(noClassDefFoundError_klass, java_lang_NoClassDefFoundError, Pre) \ + template(linkageError_klass, java_lang_LinkageError, Pre) \ + template(ClassCastException_klass, java_lang_ClassCastException, Pre) \ + template(ArrayStoreException_klass, java_lang_ArrayStoreException, Pre) \ + template(virtualMachineError_klass, java_lang_VirtualMachineError, Pre) \ + template(OutOfMemoryError_klass, java_lang_OutOfMemoryError, Pre) \ + template(StackOverflowError_klass, java_lang_StackOverflowError, Pre) \ + template(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException, Pre) \ + template(reference_klass, java_lang_ref_Reference, Pre) \ + \ + /* Preload ref klasses and set reference types */ \ + template(soft_reference_klass, java_lang_ref_SoftReference, Pre) \ + template(weak_reference_klass, java_lang_ref_WeakReference, Pre) \ + template(final_reference_klass, java_lang_ref_FinalReference, Pre) \ + template(phantom_reference_klass, java_lang_ref_PhantomReference, Pre) \ + template(finalizer_klass, java_lang_ref_Finalizer, Pre) \ + \ + template(thread_klass, java_lang_Thread, Pre) \ + template(threadGroup_klass, java_lang_ThreadGroup, Pre) \ + template(properties_klass, java_util_Properties, Pre) \ + template(reflect_accessible_object_klass, java_lang_reflect_AccessibleObject, Pre) \ + template(reflect_field_klass, java_lang_reflect_Field, Pre) \ + template(reflect_method_klass, java_lang_reflect_Method, Pre) \ + template(reflect_constructor_klass, java_lang_reflect_Constructor, Pre) \ + \ + /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \ + /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \ + /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ + template(reflect_magic_klass, sun_reflect_MagicAccessorImpl, Opt) \ + template(reflect_method_accessor_klass, sun_reflect_MethodAccessorImpl, Opt_Only_JDK14NewRef) \ + template(reflect_constructor_accessor_klass, sun_reflect_ConstructorAccessorImpl, Opt_Only_JDK14NewRef) \ + template(reflect_delegating_classloader_klass, sun_reflect_DelegatingClassLoader, Opt) \ + template(reflect_constant_pool_klass, sun_reflect_ConstantPool, Opt_Only_JDK15) \ + template(reflect_unsafe_static_field_accessor_impl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15) \ + \ + template(vector_klass, java_util_Vector, Pre) \ + template(hashtable_klass, java_util_Hashtable, Pre) \ + template(stringBuffer_klass, java_lang_StringBuffer, Pre) \ + \ + /* It's NULL in non-1.4 JDKs. */ \ + template(stackTraceElement_klass, java_lang_StackTraceElement, Opt) \ + /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \ + /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ + template(java_nio_Buffer_klass, java_nio_Buffer, Opt) \ + \ + /* If this class isn't present, it won't be referenced. */ \ + template(sun_misc_AtomicLongCSImpl_klass, sun_misc_AtomicLongCSImpl, Opt) \ + \ + template(sun_jkernel_DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \ + \ + /* Preload boxing klasses */ \ + template(boolean_klass, java_lang_Boolean, Pre) \ + template(char_klass, java_lang_Character, Pre) \ + template(float_klass, java_lang_Float, Pre) \ + template(double_klass, java_lang_Double, Pre) \ + template(byte_klass, java_lang_Byte, Pre) \ + template(short_klass, java_lang_Short, Pre) \ + template(int_klass, java_lang_Integer, Pre) \ + template(long_klass, java_lang_Long, Pre) \ + /*end*/ + + class SystemDictionary : AllStatic { friend class VMStructs; friend class CompactingPermGenGen; NOT_PRODUCT(friend class instanceKlassKlass;) public: + enum WKID { + NO_WKID = 0, + + #define WK_KLASS_ENUM(name, ignore_s, ignore_o) WK_KLASS_ENUM_NAME(name), + WK_KLASSES_DO(WK_KLASS_ENUM) + #undef WK_KLASS_ENUM + + WKID_LIMIT, + + 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 + Opt_Only_JDK14NewRef, // preload tried; use only with NewReflection + Opt_Only_JDK15, // preload tried; use only with JDK1.5+ + Opt_Kernel, // preload tried only #ifdef KERNEL + OPTION_LIMIT, + CEIL_LG_OPTION_LIMIT = 4 // OPTION_LIMIT <= (1<