< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page

*** 1487,1498 **** // of the boot loader's module path assert(Universe::is_module_initialized() || !search_only_bootloader_append, "Attempt to load a class outside of boot loader's module path"); ! // Search the shared system dictionary for classes preloaded into the ! // shared spaces. InstanceKlass* k = NULL; { #if INCLUDE_CDS PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time()); k = load_shared_class(class_name, class_loader, THREAD); --- 1487,1497 ---- // of the boot loader's module path assert(Universe::is_module_initialized() || !search_only_bootloader_append, "Attempt to load a class outside of boot loader's module path"); ! // Search for classes in the CDS archive. InstanceKlass* k = NULL; { #if INCLUDE_CDS PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time()); k = load_shared_class(class_name, class_loader, THREAD);
*** 1956,1966 **** _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize); // Allocate private object used as system class loader lock _system_loader_lock_obj = oopFactory::new_intArray(0, CHECK); // Initialize basic classes ! resolve_preloaded_classes(CHECK); } // Compact table of directions on the initialization of klasses: static const short wk_init_info[] = { #define WK_KLASS_INIT_INFO(name, symbol) \ --- 1955,1965 ---- _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize); // Allocate private object used as system class loader lock _system_loader_lock_obj = oopFactory::new_intArray(0, CHECK); // Initialize basic classes ! resolve_well_known_classes(CHECK); } // Compact table of directions on the initialization of klasses: static const short wk_init_info[] = { #define WK_KLASS_INIT_INFO(name, symbol) \
*** 1969,1978 **** --- 1968,1993 ---- WK_KLASSES_DO(WK_KLASS_INIT_INFO) #undef WK_KLASS_INIT_INFO 0 }; + #ifdef ASSERT + bool SystemDictionary::is_well_known_klass(Symbol* class_name) { + for (int i = 0; ; i++) { + int sid = wk_init_info[i]; + if (sid == 0) { + break; + } + Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); + if (class_name == symbol) { + return true; + } + } + return false; + } + #endif + bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) { assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob"); int sid = wk_init_info[id - FIRST_WKID]; Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); InstanceKlass** klassp = &_well_known_klasses[id];
*** 2000,2011 **** // move the starting value forward to the limit: start_id = limit_id; } ! void SystemDictionary::resolve_preloaded_classes(TRAPS) { ! assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once"); // Create the ModuleEntry for java.base. This call needs to be done here, // after vmSymbols::initialize() is called but before any classes are pre-loaded. ClassLoader::classLoader_init2(CHECK); --- 2015,2026 ---- // move the starting value forward to the limit: start_id = limit_id; } ! void SystemDictionary::resolve_well_known_classes(TRAPS) { ! assert(WK_KLASS(Object_klass) == NULL, "well-known classes should only be initialized once"); // Create the ModuleEntry for java.base. This call needs to be done here, // after vmSymbols::initialize() is called but before any classes are pre-loaded. ClassLoader::classLoader_init2(CHECK);
*** 2069,2079 **** // JSR 292 classes WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); WKID jsr292_group_end = WK_KLASS_ENUM_NAME(VolatileCallSite_klass); resolve_wk_klasses_until(jsr292_group_start, scan, CHECK); resolve_wk_klasses_through(jsr292_group_end, scan, CHECK); ! resolve_wk_klasses_until(NOT_JVMCI(WKID_LIMIT) JVMCI_ONLY(FIRST_JVMCI_WKID), scan, CHECK); _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass); _box_klasses[T_CHAR] = WK_KLASS(Character_klass); _box_klasses[T_FLOAT] = WK_KLASS(Float_klass); _box_klasses[T_DOUBLE] = WK_KLASS(Double_klass); --- 2084,2095 ---- // JSR 292 classes WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); WKID jsr292_group_end = WK_KLASS_ENUM_NAME(VolatileCallSite_klass); resolve_wk_klasses_until(jsr292_group_start, scan, CHECK); resolve_wk_klasses_through(jsr292_group_end, scan, CHECK); ! WKID last = NOT_JVMCI(WKID_LIMIT) JVMCI_ONLY(FIRST_JVMCI_WKID); ! resolve_wk_klasses_until(last, scan, CHECK); _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass); _box_klasses[T_CHAR] = WK_KLASS(Character_klass); _box_klasses[T_FLOAT] = WK_KLASS(Float_klass); _box_klasses[T_DOUBLE] = WK_KLASS(Double_klass);
*** 2086,2095 **** --- 2102,2120 ---- { // Compute whether we should use checkPackageAccess or NOT Method* method = InstanceKlass::cast(ClassLoader_klass())->find_method(vmSymbols::checkPackageAccess_name(), vmSymbols::class_protectiondomain_signature()); _has_checkPackageAccess = (method != NULL); } + + if (UseSharedSpaces) { + assert(JvmtiEnvBase::get_phase() <= JVMTI_PHASE_PRIMORDIAL, + "All well known classes must be resolved in JVMTI_PHASE_PRIMORDIAL or before"); + for (int i = FIRST_WKID; i < last; i++) { + InstanceKlass* k = _well_known_klasses[i]; + assert(k->is_shared(), "must not be replaced by JVMTI class file load hook"); + } + } } // Tells if a given klass is a box (wrapper class, such as java.lang.Integer). // If so, returns the basic type it holds. If not, returns T_OBJECT. BasicType SystemDictionary::box_klass_type(Klass* k) {
< prev index next >