src/hotspot/share/classfile/systemDictionaryShared.cpp
changeset 58542 94fe833a244b
parent 58499 d62c7224d5b7
child 58679 9c3209ff7550
child 59070 22ee476cc664
equal deleted inserted replaced
58541:8bc609fcd691 58542:94fe833a244b
   903       SystemDictionary::is_platform_class_loader(class_loader())) {
   903       SystemDictionary::is_platform_class_loader(class_loader())) {
   904     // Do nothing for the BUILTIN loaders.
   904     // Do nothing for the BUILTIN loaders.
   905     return NULL;
   905     return NULL;
   906   }
   906   }
   907 
   907 
   908   const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, class_name);
   908   const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, &_dynamic_unregistered_dictionary, class_name);
   909   if (record == NULL) {
   909   if (record == NULL) {
   910     if (DynamicArchive::is_mapped()) {
   910     return NULL;
   911       record = find_record(&_dynamic_unregistered_dictionary, class_name);
       
   912     }
       
   913     if (record == NULL) {
       
   914       return NULL;
       
   915     }
       
   916   }
   911   }
   917 
   912 
   918   int clsfile_size  = cfs->length();
   913   int clsfile_size  = cfs->length();
   919   int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
   914   int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
   920 
   915 
  1410     _dynamic_unregistered_dictionary.serialize_header(soc);
  1405     _dynamic_unregistered_dictionary.serialize_header(soc);
  1411   }
  1406   }
  1412 }
  1407 }
  1413 
  1408 
  1414 const RunTimeSharedClassInfo*
  1409 const RunTimeSharedClassInfo*
  1415 SystemDictionaryShared::find_record(RunTimeSharedDictionary* dict, Symbol* name) {
  1410 SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTimeSharedDictionary* dynamic_dict, Symbol* name) {
  1416   if (UseSharedSpaces) {
  1411   if (!UseSharedSpaces || !name->is_shared()) {
  1417     unsigned int hash = primitive_hash<Symbol*>(name);
  1412     // The names of all shared classes must also be a shared Symbol.
  1418     return dict->lookup(name, hash, 0);
  1413     return NULL;
       
  1414   }
       
  1415 
       
  1416   unsigned int hash = primitive_hash<Symbol*>(name);
       
  1417   const RunTimeSharedClassInfo* record = NULL;
       
  1418   if (!MetaspaceShared::is_shared_dynamic(name)) {
       
  1419     // The names of all shared classes in the static dict must also be in the
       
  1420     // static archive
       
  1421     record = static_dict->lookup(name, hash, 0);
       
  1422   }
       
  1423 
       
  1424   if (record == NULL && DynamicArchive::is_mapped()) {
       
  1425     record = dynamic_dict->lookup(name, hash, 0);
       
  1426   }
       
  1427 
       
  1428   return record;
       
  1429 }
       
  1430 
       
  1431 InstanceKlass* SystemDictionaryShared::find_builtin_class(Symbol* name) {
       
  1432   const RunTimeSharedClassInfo* record = find_record(&_builtin_dictionary, &_dynamic_builtin_dictionary, name);
       
  1433   if (record != NULL) {
       
  1434     return record->_klass;
  1419   } else {
  1435   } else {
  1420     return NULL;
  1436     return NULL;
  1421   }
  1437   }
  1422 }
       
  1423 
       
  1424 InstanceKlass* SystemDictionaryShared::find_builtin_class(Symbol* name) {
       
  1425   const RunTimeSharedClassInfo* record = find_record(&_builtin_dictionary, name);
       
  1426   if (record) {
       
  1427     return record->_klass;
       
  1428   }
       
  1429 
       
  1430   if (DynamicArchive::is_mapped()) {
       
  1431     record = find_record(&_dynamic_builtin_dictionary, name);
       
  1432     if (record) {
       
  1433       return record->_klass;
       
  1434     }
       
  1435   }
       
  1436 
       
  1437   return NULL;
       
  1438 }
  1438 }
  1439 
  1439 
  1440 void SystemDictionaryShared::update_shared_entry(InstanceKlass* k, int id) {
  1440 void SystemDictionaryShared::update_shared_entry(InstanceKlass* k, int id) {
  1441   assert(DumpSharedSpaces, "supported only when dumping");
  1441   assert(DumpSharedSpaces, "supported only when dumping");
  1442   DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k);
  1442   DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k);