1125 static ResourceHashtable< 1126 Symbol*, bool, 1127 primitive_hash<Symbol*>, 1128 primitive_equals<Symbol*>, 1129 6661, // prime number 1130 ResourceObj::C_HEAP> _loaded_unregistered_classes; 1131 1132 bool SystemDictionaryShared::add_unregistered_class(InstanceKlass* k, TRAPS) { 1133 // We don't allow duplicated unregistered classes of the same name. 1134 assert(DumpSharedSpaces, "only when dumping"); 1135 Symbol* name = k->name(); 1136 bool created = false; 1137 _loaded_unregistered_classes.put_if_absent(name, true, &created); 1138 if (created) { 1139 MutexLocker mu_r(THREAD, Compile_lock); // add_to_hierarchy asserts this. 1140 SystemDictionary::add_to_hierarchy(k, CHECK_false); 1141 } 1142 return created; 1143 } 1144 1145 // This function is called to resolve the super/interfaces of shared classes for 1146 // non-built-in loaders. E.g., ChildClass in the below example 1147 // where "super:" (and optionally "interface:") have been specified. 1148 // 1149 // java/lang/Object id: 0 1150 // Interface id: 2 super: 0 source: cust.jar 1151 // ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar 1152 InstanceKlass* SystemDictionaryShared::dump_time_resolve_super_or_fail( 1153 Symbol* child_name, Symbol* class_name, Handle class_loader, 1154 Handle protection_domain, bool is_superclass, TRAPS) { 1155 1156 assert(DumpSharedSpaces, "only when dumping"); 1157 1158 ClassListParser* parser = ClassListParser::instance(); 1159 if (parser == NULL) { 1160 // We're still loading the well-known classes, before the ClassListParser is created. 1161 return NULL; 1162 } 1163 if (child_name->equals(parser->current_class_name())) { 1164 // When this function is called, all the numbered super and interface types 1363 } else { 1364 guarantee(k->is_shared_unregistered_class(), 1365 "Class loader type must not be set for UNREGISTERED class %s", name); 1366 } 1367 } 1368 1369 class ExcludeDumpTimeSharedClasses : StackObj { 1370 public: 1371 bool do_entry(InstanceKlass* k, DumpTimeSharedClassInfo& info) { 1372 if (SystemDictionaryShared::should_be_excluded(k)) { 1373 info.set_excluded(); 1374 } 1375 return true; // keep on iterating 1376 } 1377 }; 1378 1379 void SystemDictionaryShared::check_excluded_classes() { 1380 ExcludeDumpTimeSharedClasses excl; 1381 _dumptime_table->iterate(&excl); 1382 _dumptime_table->update_counts(); 1383 } 1384 1385 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) { 1386 assert(_no_class_loading_should_happen, "sanity"); 1387 Arguments::assert_is_dumping_archive(); 1388 return find_or_allocate_info_for(k)->is_excluded(); 1389 } 1390 1391 void SystemDictionaryShared::set_class_has_failed_verification(InstanceKlass* ik) { 1392 Arguments::assert_is_dumping_archive(); 1393 find_or_allocate_info_for(ik)->set_failed_verification(); 1394 } 1395 1396 bool SystemDictionaryShared::has_class_failed_verification(InstanceKlass* ik) { 1397 Arguments::assert_is_dumping_archive(); 1398 if (_dumptime_table == NULL) { 1399 assert(DynamicDumpSharedSpaces, "sanity"); 1400 assert(ik->is_shared(), "must be a shared class in the static archive"); 1401 return false; 1402 } | 1125 static ResourceHashtable< 1126 Symbol*, bool, 1127 primitive_hash<Symbol*>, 1128 primitive_equals<Symbol*>, 1129 6661, // prime number 1130 ResourceObj::C_HEAP> _loaded_unregistered_classes; 1131 1132 bool SystemDictionaryShared::add_unregistered_class(InstanceKlass* k, TRAPS) { 1133 // We don't allow duplicated unregistered classes of the same name. 1134 assert(DumpSharedSpaces, "only when dumping"); 1135 Symbol* name = k->name(); 1136 bool created = false; 1137 _loaded_unregistered_classes.put_if_absent(name, true, &created); 1138 if (created) { 1139 MutexLocker mu_r(THREAD, Compile_lock); // add_to_hierarchy asserts this. 1140 SystemDictionary::add_to_hierarchy(k, CHECK_false); 1141 } 1142 return created; 1143 } 1144 1145 void SystemDictionaryShared::add_shared_to_hierarchy(InstanceKlass* k, TRAPS) { 1146 Arguments::assert_is_dumping_archive(); 1147 assert(!k->is_loaded(), "Invariant"); 1148 assert_locked_or_safepoint(Compile_lock); // add_to_hierarchy assert on it. 1149 SystemDictionary::add_to_hierarchy(k, CHECK); 1150 } 1151 1152 // This function is called to resolve the super/interfaces of shared classes for 1153 // non-built-in loaders. E.g., ChildClass in the below example 1154 // where "super:" (and optionally "interface:") have been specified. 1155 // 1156 // java/lang/Object id: 0 1157 // Interface id: 2 super: 0 source: cust.jar 1158 // ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar 1159 InstanceKlass* SystemDictionaryShared::dump_time_resolve_super_or_fail( 1160 Symbol* child_name, Symbol* class_name, Handle class_loader, 1161 Handle protection_domain, bool is_superclass, TRAPS) { 1162 1163 assert(DumpSharedSpaces, "only when dumping"); 1164 1165 ClassListParser* parser = ClassListParser::instance(); 1166 if (parser == NULL) { 1167 // We're still loading the well-known classes, before the ClassListParser is created. 1168 return NULL; 1169 } 1170 if (child_name->equals(parser->current_class_name())) { 1171 // When this function is called, all the numbered super and interface types 1370 } else { 1371 guarantee(k->is_shared_unregistered_class(), 1372 "Class loader type must not be set for UNREGISTERED class %s", name); 1373 } 1374 } 1375 1376 class ExcludeDumpTimeSharedClasses : StackObj { 1377 public: 1378 bool do_entry(InstanceKlass* k, DumpTimeSharedClassInfo& info) { 1379 if (SystemDictionaryShared::should_be_excluded(k)) { 1380 info.set_excluded(); 1381 } 1382 return true; // keep on iterating 1383 } 1384 }; 1385 1386 void SystemDictionaryShared::check_excluded_classes() { 1387 ExcludeDumpTimeSharedClasses excl; 1388 _dumptime_table->iterate(&excl); 1389 _dumptime_table->update_counts(); 1390 } 1391 1392 void SystemDictionaryShared::set_excluded(InstanceKlass* k) { 1393 Arguments::assert_is_dumping_archive(); 1394 find_or_allocate_info_for(k)->set_excluded(); 1395 } 1396 1397 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) { 1398 assert(_no_class_loading_should_happen, "sanity"); 1399 Arguments::assert_is_dumping_archive(); 1400 return find_or_allocate_info_for(k)->is_excluded(); 1401 } 1402 1403 void SystemDictionaryShared::set_class_has_failed_verification(InstanceKlass* ik) { 1404 Arguments::assert_is_dumping_archive(); 1405 find_or_allocate_info_for(ik)->set_failed_verification(); 1406 } 1407 1408 bool SystemDictionaryShared::has_class_failed_verification(InstanceKlass* ik) { 1409 Arguments::assert_is_dumping_archive(); 1410 if (_dumptime_table == NULL) { 1411 assert(DynamicDumpSharedSpaces, "sanity"); 1412 assert(ik->is_shared(), "must be a shared class in the static archive"); 1413 return false; 1414 } |