src/hotspot/share/classfile/systemDictionaryShared.cpp
changeset 59070 22ee476cc664
parent 58542 94fe833a244b
equal deleted inserted replaced
59069:e0d59f0c2b7d 59070:22ee476cc664
    36 #include "classfile/systemDictionaryShared.hpp"
    36 #include "classfile/systemDictionaryShared.hpp"
    37 #include "classfile/verificationType.hpp"
    37 #include "classfile/verificationType.hpp"
    38 #include "classfile/vmSymbols.hpp"
    38 #include "classfile/vmSymbols.hpp"
    39 #include "logging/log.hpp"
    39 #include "logging/log.hpp"
    40 #include "memory/allocation.hpp"
    40 #include "memory/allocation.hpp"
       
    41 #include "memory/archiveUtils.hpp"
    41 #include "memory/filemap.hpp"
    42 #include "memory/filemap.hpp"
    42 #include "memory/metadataFactory.hpp"
    43 #include "memory/metadataFactory.hpp"
    43 #include "memory/metaspaceClosure.hpp"
    44 #include "memory/metaspaceClosure.hpp"
    44 #include "memory/oopFactory.hpp"
    45 #include "memory/oopFactory.hpp"
    45 #include "memory/resourceArea.hpp"
    46 #include "memory/resourceArea.hpp"
   292       }
   293       }
   293     }
   294     }
   294     if (DynamicDumpSharedSpaces) {
   295     if (DynamicDumpSharedSpaces) {
   295       _klass = DynamicArchive::original_to_target(info._klass);
   296       _klass = DynamicArchive::original_to_target(info._klass);
   296     }
   297     }
       
   298     ArchivePtrMarker::mark_pointer(&_klass);
   297   }
   299   }
   298 
   300 
   299   bool matches(int clsfile_size, int clsfile_crc32) const {
   301   bool matches(int clsfile_size, int clsfile_crc32) const {
   300     return crc()->_clsfile_size  == clsfile_size &&
   302     return crc()->_clsfile_size  == clsfile_size &&
   301            crc()->_clsfile_crc32 == clsfile_crc32;
   303            crc()->_clsfile_crc32 == clsfile_crc32;
   335       klass = DynamicArchive::original_to_buffer(klass);
   337       klass = DynamicArchive::original_to_buffer(klass);
   336       *info_pointer_addr(klass) = DynamicArchive::buffer_to_target(record);
   338       *info_pointer_addr(klass) = DynamicArchive::buffer_to_target(record);
   337     } else {
   339     } else {
   338       *info_pointer_addr(klass) = record;
   340       *info_pointer_addr(klass) = record;
   339     }
   341     }
       
   342 
       
   343     ArchivePtrMarker::mark_pointer(info_pointer_addr(klass));
   340   }
   344   }
   341 
   345 
   342   // Used by RunTimeSharedDictionary to implement OffsetCompactHashtable::EQUALS
   346   // Used by RunTimeSharedDictionary to implement OffsetCompactHashtable::EQUALS
   343   static inline bool EQUALS(
   347   static inline bool EQUALS(
   344        const RunTimeSharedClassInfo* value, Symbol* key, int len_unused) {
   348        const RunTimeSharedClassInfo* value, Symbol* key, int len_unused) {
  1352       unsigned int hash;
  1356       unsigned int hash;
  1353       Symbol* name = info._klass->name();
  1357       Symbol* name = info._klass->name();
  1354       if (DynamicDumpSharedSpaces) {
  1358       if (DynamicDumpSharedSpaces) {
  1355         name = DynamicArchive::original_to_target(name);
  1359         name = DynamicArchive::original_to_target(name);
  1356       }
  1360       }
  1357       hash = primitive_hash<Symbol*>(name);
  1361       hash = SystemDictionaryShared::hash_for_shared_dictionary(name);
  1358       u4 delta;
  1362       u4 delta;
  1359       if (DynamicDumpSharedSpaces) {
  1363       if (DynamicDumpSharedSpaces) {
  1360         delta = MetaspaceShared::object_delta_u4(DynamicArchive::buffer_to_target(record));
  1364         delta = MetaspaceShared::object_delta_u4(DynamicArchive::buffer_to_target(record));
  1361       } else {
  1365       } else {
  1362         delta = MetaspaceShared::object_delta_u4(record);
  1366         delta = MetaspaceShared::object_delta_u4(record);
  1411   if (!UseSharedSpaces || !name->is_shared()) {
  1415   if (!UseSharedSpaces || !name->is_shared()) {
  1412     // The names of all shared classes must also be a shared Symbol.
  1416     // The names of all shared classes must also be a shared Symbol.
  1413     return NULL;
  1417     return NULL;
  1414   }
  1418   }
  1415 
  1419 
  1416   unsigned int hash = primitive_hash<Symbol*>(name);
  1420   unsigned int hash = SystemDictionaryShared::hash_for_shared_dictionary(name);
  1417   const RunTimeSharedClassInfo* record = NULL;
  1421   const RunTimeSharedClassInfo* record = NULL;
  1418   if (!MetaspaceShared::is_shared_dynamic(name)) {
  1422   if (!MetaspaceShared::is_shared_dynamic(name)) {
  1419     // The names of all shared classes in the static dict must also be in the
  1423     // The names of all shared classes in the static dict must also be in the
  1420     // static archive
  1424     // static archive
  1421     record = static_dict->lookup(name, hash, 0);
  1425     record = static_dict->lookup(name, hash, 0);