< prev index next >

src/hotspot/share/memory/metaspaceShared.cpp

Print this page


 405   soc->do_tag(sizeof(Method));
 406   soc->do_tag(sizeof(ConstMethod));
 407   soc->do_tag(arrayOopDesc::base_offset_in_bytes(T_BYTE));
 408   soc->do_tag(sizeof(ConstantPool));
 409   soc->do_tag(sizeof(ConstantPoolCache));
 410   soc->do_tag(objArrayOopDesc::base_offset_in_bytes());
 411   soc->do_tag(typeArrayOopDesc::base_offset_in_bytes(T_BYTE));
 412   soc->do_tag(sizeof(Symbol));
 413 
 414   // Dump/restore miscellaneous metadata.
 415   Universe::serialize(soc);
 416   soc->do_tag(--tag);
 417 
 418   // Dump/restore references to commonly used names and signatures.
 419   vmSymbols::serialize(soc);
 420   soc->do_tag(--tag);
 421 
 422   // Dump/restore the symbol and string tables
 423   SymbolTable::serialize(soc);
 424   StringTable::serialize(soc);



 425   soc->do_tag(--tag);
 426 
 427   JavaClasses::serialize_offsets(soc);
 428   InstanceMirrorKlass::serialize_offsets(soc);
 429   soc->do_tag(--tag);
 430 
 431   soc->do_tag(666);
 432 }
 433 
 434 address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {
 435   if (DumpSharedSpaces) {
 436     if (_cds_i2i_entry_code_buffers == NULL) {
 437       _cds_i2i_entry_code_buffers = (address)misc_code_space_alloc(total_size);
 438       _cds_i2i_entry_code_buffers_size = total_size;
 439     }
 440   } else if (UseSharedSpaces) {
 441     assert(_cds_i2i_entry_code_buffers != NULL, "must already been initialized");
 442   } else {
 443     return NULL;
 444   }


1080   }
1081   static bool my_equals(const address& a0, const address& a1) {
1082     return primitive_equals<address>(a0, a1);
1083   }
1084   typedef ResourceHashtable<
1085       address, address,
1086       ArchiveCompactor::my_hash,   // solaris compiler doesn't like: primitive_hash<address>
1087       ArchiveCompactor::my_equals, // solaris compiler doesn't like: primitive_equals<address>
1088       16384, ResourceObj::C_HEAP> RelocationTable;
1089   static RelocationTable* _new_loc_table;
1090 
1091 public:
1092   static void initialize() {
1093     _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats;
1094     _new_loc_table = new(ResourceObj::C_HEAP, mtInternal)RelocationTable;
1095   }
1096   static DumpAllocStats* alloc_stats() {
1097     return _alloc_stats;
1098   }
1099 















1100   static void allocate(MetaspaceClosure::Ref* ref, bool read_only) {
1101     address obj = ref->obj();
1102     int bytes = ref->size() * BytesPerWord;
1103     char* p;
1104     size_t alignment = BytesPerWord;
1105     char* oldtop;
1106     char* newtop;
1107 
1108     if (read_only) {
1109       oldtop = _ro_region.top();
1110       p = _ro_region.allocate(bytes, alignment);
1111       newtop = _ro_region.top();
1112     } else {
1113       oldtop = _rw_region.top();
1114       p = _rw_region.allocate(bytes, alignment);
1115       newtop = _rw_region.top();
1116     }
1117     memcpy(p, obj, bytes);
1118     bool isnew = _new_loc_table->put(obj, (address)p);
1119     log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes);


1290   }
1291 };
1292 
1293 DumpAllocStats* ArchiveCompactor::_alloc_stats;
1294 SortedSymbolClosure* ArchiveCompactor::_ssc;
1295 ArchiveCompactor::RelocationTable* ArchiveCompactor::_new_loc_table;
1296 
1297 void VM_PopulateDumpSharedSpace::write_region(FileMapInfo* mapinfo, int region_idx,
1298                                               DumpRegion* dump_region, bool read_only,  bool allow_exec) {
1299   mapinfo->write_region(region_idx, dump_region->base(), dump_region->used(), read_only, allow_exec);
1300 }
1301 
1302 void VM_PopulateDumpSharedSpace::dump_symbols() {
1303   tty->print_cr("Dumping symbol table ...");
1304 
1305   NOT_PRODUCT(SymbolTable::verify());
1306   SymbolTable::write_to_archive();
1307 }
1308 
1309 char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
1310   char* oldtop = _ro_region.top();
1311   // Reorder the system dictionary. Moving the symbols affects
1312   // how the hash table indices are calculated.
1313   SystemDictionary::reorder_dictionary_for_sharing();
1314 
1315   tty->print("Removing java_mirror ... ");
1316   if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
1317     clear_basic_type_mirrors();
1318   }
1319   remove_java_mirror_in_classes();
1320   tty->print_cr("done. ");
1321   NOT_PRODUCT(SystemDictionary::verify();)
1322 
1323   size_t buckets_bytes = SystemDictionary::count_bytes_for_buckets();
1324   char* buckets_top = _ro_region.allocate(buckets_bytes, sizeof(intptr_t));
1325   SystemDictionary::copy_buckets(buckets_top, _ro_region.top());
1326 
1327   size_t table_bytes = SystemDictionary::count_bytes_for_table();
1328   char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
1329   SystemDictionary::copy_table(table_top, _ro_region.top());
1330 
1331   // Write the archived object sub-graph infos. For each klass with sub-graphs,
1332   // the info includes the static fields (sub-graph entry points) and Klasses
1333   // of objects included in the sub-graph.
1334   HeapShared::write_archived_subgraph_infos();
1335 
1336   // Write the other data to the output array.
1337   WriteClosure wc(&_ro_region);
1338   MetaspaceShared::serialize(&wc);
1339 
1340   // Write the bitmaps for patching the archive heap regions
1341   dump_archive_heap_oopmaps();
1342 
1343   char* newtop = _ro_region.top();
1344   ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - oldtop), true);
1345   return buckets_top;
1346 }
1347 
1348 void VM_PopulateDumpSharedSpace::doit() {
1349   Thread* THREAD = VMThread::vm_thread();
1350 
1351   FileMapInfo::check_nonempty_dir_in_shared_path_table();
1352 
1353   NOT_PRODUCT(SystemDictionary::verify();)
1354   // The following guarantee is meant to ensure that no loader constraints
1355   // exist yet, since the constraints table is not shared.  This becomes
1356   // more important now that we don't re-initialize vtables/itables for
1357   // shared classes at runtime, where constraints were previously created.
1358   guarantee(SystemDictionary::constraints()->number_of_entries() == 0,
1359             "loader constraints are not saved");
1360   guarantee(SystemDictionary::placeholders()->number_of_entries() == 0,
1361           "placeholders are not saved");
1362   // Revisit and implement this if we prelink method handle call sites:
1363   guarantee(SystemDictionary::invoke_method_table() == NULL ||
1364             SystemDictionary::invoke_method_table()->number_of_entries() == 0,


1804   {
1805     NoSafepointVerifier nsv;
1806 
1807     // Cache for recording where the archived objects are copied to
1808     MetaspaceShared::create_archive_object_cache();
1809 
1810     tty->print_cr("Dumping objects to closed archive heap region ...");
1811     NOT_PRODUCT(StringTable::verify());
1812     // The closed space has maximum two regions. See FileMapInfo::write_archive_heap_regions() for details.
1813     _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
1814     MetaspaceShared::dump_closed_archive_heap_objects(_closed_archive_heap_regions);
1815 
1816     tty->print_cr("Dumping objects to open archive heap region ...");
1817     _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
1818     MetaspaceShared::dump_open_archive_heap_objects(_open_archive_heap_regions);
1819 
1820     MetaspaceShared::destroy_archive_object_cache();
1821   }
1822 
1823   G1HeapVerifier::verify_archive_regions();





1824 }
1825 
1826 void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
1827   if (MetaspaceShared::is_heap_object_archiving_allowed()) {
1828     _closed_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
1829     dump_archive_heap_oopmaps(_closed_archive_heap_regions, _closed_archive_heap_oopmaps);
1830 
1831     _open_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
1832     dump_archive_heap_oopmaps(_open_archive_heap_regions, _open_archive_heap_oopmaps);
1833   }
1834 }
1835 
1836 void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps(GrowableArray<MemRegion>* regions,
1837                                                            GrowableArray<ArchiveHeapOopmapInfo>* oopmaps) {
1838   for (int i=0; i<regions->length(); i++) {
1839     ResourceBitMap oopmap = HeapShared::calculate_oopmap(regions->at(i));
1840     size_t size_in_bits = oopmap.size();
1841     size_t size_in_bytes = oopmap.size_in_bytes();
1842     uintptr_t* buffer = (uintptr_t*)_ro_region.allocate(size_in_bytes, sizeof(intptr_t));
1843     oopmap.write_to(buffer, size_in_bytes);


1871                                     GrowableArray<MemRegion> * open_archive) {
1872   assert(UseG1GC, "Only support G1 GC");
1873   assert(UseCompressedOops && UseCompressedClassPointers,
1874          "Only support UseCompressedOops and UseCompressedClassPointers enabled");
1875 
1876   Thread* THREAD = Thread::current();
1877   G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
1878 
1879   java_lang_Class::archive_basic_type_mirrors(THREAD);
1880 
1881   MetaspaceShared::archive_klass_objects(THREAD);
1882 
1883   HeapShared::archive_static_fields(THREAD);
1884 
1885   G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
1886                                                    os::vm_allocation_granularity());
1887 }
1888 
1889 unsigned MetaspaceShared::obj_hash(oop const& p) {
1890   assert(!p->mark()->has_bias_pattern(),
1891          "this object should never have been locked");  // so identity_hash won't safepoin
1892   unsigned hash = (unsigned)p->identity_hash();
1893   return hash;
1894 }
1895 
1896 MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
1897 oop MetaspaceShared::find_archived_heap_object(oop obj) {
1898   assert(DumpSharedSpaces, "dump-time only");
1899   ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
1900   oop* p = cache->get(obj);
1901   if (p != NULL) {
1902     return *p;
1903   } else {
1904     return NULL;
1905   }
1906 }
1907 
1908 oop MetaspaceShared::archive_heap_object(oop obj, Thread* THREAD) {
1909   assert(DumpSharedSpaces, "dump-time only");
1910 
1911   oop ao = find_archived_heap_object(obj);


2126   char* buffer = mapinfo->misc_data_patching_start();
2127   clone_cpp_vtables((intptr_t*)buffer);
2128 
2129   // The rest of the data is now stored in the RW region
2130   buffer = mapinfo->read_only_tables_start();
2131   int sharedDictionaryLen = *(intptr_t*)buffer;
2132   buffer += sizeof(intptr_t);
2133   int number_of_entries = *(intptr_t*)buffer;
2134   buffer += sizeof(intptr_t);
2135   SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer,
2136                                           sharedDictionaryLen,
2137                                           number_of_entries);
2138   buffer += sharedDictionaryLen;
2139 
2140   // The following data are the linked list elements
2141   // (HashtableEntry objects) for the shared dictionary table.
2142 
2143   int len = *(intptr_t*)buffer;     // skip over shared dictionary entries
2144   buffer += sizeof(intptr_t);
2145   buffer += len;
2146 
2147   // The table of archived java heap object sub-graph infos
2148   buffer = HeapShared::read_archived_subgraph_infos(buffer);
2149 
2150   // Verify various attributes of the archive, plus initialize the
2151   // shared string/symbol tables
2152   intptr_t* array = (intptr_t*)buffer;
2153   ReadClosure rc(&array);
2154   serialize(&rc);
2155 
2156   // Initialize the run-time symbol table.
2157   SymbolTable::create_table();
2158 
2159   mapinfo->patch_archived_heap_embedded_pointers();
2160 
2161   // Close the mapinfo file
2162   mapinfo->close();
2163 
2164   if (PrintSharedArchiveAndExit) {
2165     if (PrintSharedDictionary) {
2166       tty->print_cr("\nShared classes:\n");
2167       SystemDictionary::print_shared(tty);
2168     }




 405   soc->do_tag(sizeof(Method));
 406   soc->do_tag(sizeof(ConstMethod));
 407   soc->do_tag(arrayOopDesc::base_offset_in_bytes(T_BYTE));
 408   soc->do_tag(sizeof(ConstantPool));
 409   soc->do_tag(sizeof(ConstantPoolCache));
 410   soc->do_tag(objArrayOopDesc::base_offset_in_bytes());
 411   soc->do_tag(typeArrayOopDesc::base_offset_in_bytes(T_BYTE));
 412   soc->do_tag(sizeof(Symbol));
 413 
 414   // Dump/restore miscellaneous metadata.
 415   Universe::serialize(soc);
 416   soc->do_tag(--tag);
 417 
 418   // Dump/restore references to commonly used names and signatures.
 419   vmSymbols::serialize(soc);
 420   soc->do_tag(--tag);
 421 
 422   // Dump/restore the symbol and string tables
 423   SymbolTable::serialize(soc);
 424   StringTable::serialize(soc);
 425 
 426   // Dump/restore the tables related to shared heap objects
 427   HeapShared::serialize_hashtables(soc);
 428   soc->do_tag(--tag);
 429 
 430   JavaClasses::serialize_offsets(soc);
 431   InstanceMirrorKlass::serialize_offsets(soc);
 432   soc->do_tag(--tag);
 433 
 434   soc->do_tag(666);
 435 }
 436 
 437 address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {
 438   if (DumpSharedSpaces) {
 439     if (_cds_i2i_entry_code_buffers == NULL) {
 440       _cds_i2i_entry_code_buffers = (address)misc_code_space_alloc(total_size);
 441       _cds_i2i_entry_code_buffers_size = total_size;
 442     }
 443   } else if (UseSharedSpaces) {
 444     assert(_cds_i2i_entry_code_buffers != NULL, "must already been initialized");
 445   } else {
 446     return NULL;
 447   }


1083   }
1084   static bool my_equals(const address& a0, const address& a1) {
1085     return primitive_equals<address>(a0, a1);
1086   }
1087   typedef ResourceHashtable<
1088       address, address,
1089       ArchiveCompactor::my_hash,   // solaris compiler doesn't like: primitive_hash<address>
1090       ArchiveCompactor::my_equals, // solaris compiler doesn't like: primitive_equals<address>
1091       16384, ResourceObj::C_HEAP> RelocationTable;
1092   static RelocationTable* _new_loc_table;
1093 
1094 public:
1095   static void initialize() {
1096     _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats;
1097     _new_loc_table = new(ResourceObj::C_HEAP, mtInternal)RelocationTable;
1098   }
1099   static DumpAllocStats* alloc_stats() {
1100     return _alloc_stats;
1101   }
1102 
1103   // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
1104   // outside of ArchiveCompactor::allocate(). These are usually for misc tables
1105   // that are allocated in the RO space.
1106   class OtherROAllocMark {
1107     char* _oldtop;
1108   public:
1109     OtherROAllocMark() {
1110       _oldtop = _ro_region.top();
1111     }
1112     ~OtherROAllocMark() {
1113       char* newtop = _ro_region.top();
1114       ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - _oldtop), true);
1115     }
1116   };
1117 
1118   static void allocate(MetaspaceClosure::Ref* ref, bool read_only) {
1119     address obj = ref->obj();
1120     int bytes = ref->size() * BytesPerWord;
1121     char* p;
1122     size_t alignment = BytesPerWord;
1123     char* oldtop;
1124     char* newtop;
1125 
1126     if (read_only) {
1127       oldtop = _ro_region.top();
1128       p = _ro_region.allocate(bytes, alignment);
1129       newtop = _ro_region.top();
1130     } else {
1131       oldtop = _rw_region.top();
1132       p = _rw_region.allocate(bytes, alignment);
1133       newtop = _rw_region.top();
1134     }
1135     memcpy(p, obj, bytes);
1136     bool isnew = _new_loc_table->put(obj, (address)p);
1137     log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes);


1308   }
1309 };
1310 
1311 DumpAllocStats* ArchiveCompactor::_alloc_stats;
1312 SortedSymbolClosure* ArchiveCompactor::_ssc;
1313 ArchiveCompactor::RelocationTable* ArchiveCompactor::_new_loc_table;
1314 
1315 void VM_PopulateDumpSharedSpace::write_region(FileMapInfo* mapinfo, int region_idx,
1316                                               DumpRegion* dump_region, bool read_only,  bool allow_exec) {
1317   mapinfo->write_region(region_idx, dump_region->base(), dump_region->used(), read_only, allow_exec);
1318 }
1319 
1320 void VM_PopulateDumpSharedSpace::dump_symbols() {
1321   tty->print_cr("Dumping symbol table ...");
1322 
1323   NOT_PRODUCT(SymbolTable::verify());
1324   SymbolTable::write_to_archive();
1325 }
1326 
1327 char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
1328   ArchiveCompactor::OtherROAllocMark mark;
1329   // Reorder the system dictionary. Moving the symbols affects
1330   // how the hash table indices are calculated.
1331   SystemDictionary::reorder_dictionary_for_sharing();
1332 
1333   tty->print("Removing java_mirror ... ");
1334   if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
1335     clear_basic_type_mirrors();
1336   }
1337   remove_java_mirror_in_classes();
1338   tty->print_cr("done. ");
1339   NOT_PRODUCT(SystemDictionary::verify();)
1340 
1341   size_t buckets_bytes = SystemDictionary::count_bytes_for_buckets();
1342   char* buckets_top = _ro_region.allocate(buckets_bytes, sizeof(intptr_t));
1343   SystemDictionary::copy_buckets(buckets_top, _ro_region.top());
1344 
1345   size_t table_bytes = SystemDictionary::count_bytes_for_table();
1346   char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
1347   SystemDictionary::copy_table(table_top, _ro_region.top());
1348 





1349   // Write the other data to the output array.
1350   WriteClosure wc(&_ro_region);
1351   MetaspaceShared::serialize(&wc);
1352 
1353   // Write the bitmaps for patching the archive heap regions
1354   dump_archive_heap_oopmaps();
1355 


1356   return buckets_top;
1357 }
1358 
1359 void VM_PopulateDumpSharedSpace::doit() {
1360   Thread* THREAD = VMThread::vm_thread();
1361 
1362   FileMapInfo::check_nonempty_dir_in_shared_path_table();
1363 
1364   NOT_PRODUCT(SystemDictionary::verify();)
1365   // The following guarantee is meant to ensure that no loader constraints
1366   // exist yet, since the constraints table is not shared.  This becomes
1367   // more important now that we don't re-initialize vtables/itables for
1368   // shared classes at runtime, where constraints were previously created.
1369   guarantee(SystemDictionary::constraints()->number_of_entries() == 0,
1370             "loader constraints are not saved");
1371   guarantee(SystemDictionary::placeholders()->number_of_entries() == 0,
1372           "placeholders are not saved");
1373   // Revisit and implement this if we prelink method handle call sites:
1374   guarantee(SystemDictionary::invoke_method_table() == NULL ||
1375             SystemDictionary::invoke_method_table()->number_of_entries() == 0,


1815   {
1816     NoSafepointVerifier nsv;
1817 
1818     // Cache for recording where the archived objects are copied to
1819     MetaspaceShared::create_archive_object_cache();
1820 
1821     tty->print_cr("Dumping objects to closed archive heap region ...");
1822     NOT_PRODUCT(StringTable::verify());
1823     // The closed space has maximum two regions. See FileMapInfo::write_archive_heap_regions() for details.
1824     _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
1825     MetaspaceShared::dump_closed_archive_heap_objects(_closed_archive_heap_regions);
1826 
1827     tty->print_cr("Dumping objects to open archive heap region ...");
1828     _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
1829     MetaspaceShared::dump_open_archive_heap_objects(_open_archive_heap_regions);
1830 
1831     MetaspaceShared::destroy_archive_object_cache();
1832   }
1833 
1834   G1HeapVerifier::verify_archive_regions();
1835 
1836   {
1837     ArchiveCompactor::OtherROAllocMark mark;
1838     HeapShared::create_hashtables();
1839   }
1840 }
1841 
1842 void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
1843   if (MetaspaceShared::is_heap_object_archiving_allowed()) {
1844     _closed_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
1845     dump_archive_heap_oopmaps(_closed_archive_heap_regions, _closed_archive_heap_oopmaps);
1846 
1847     _open_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
1848     dump_archive_heap_oopmaps(_open_archive_heap_regions, _open_archive_heap_oopmaps);
1849   }
1850 }
1851 
1852 void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps(GrowableArray<MemRegion>* regions,
1853                                                            GrowableArray<ArchiveHeapOopmapInfo>* oopmaps) {
1854   for (int i=0; i<regions->length(); i++) {
1855     ResourceBitMap oopmap = HeapShared::calculate_oopmap(regions->at(i));
1856     size_t size_in_bits = oopmap.size();
1857     size_t size_in_bytes = oopmap.size_in_bytes();
1858     uintptr_t* buffer = (uintptr_t*)_ro_region.allocate(size_in_bytes, sizeof(intptr_t));
1859     oopmap.write_to(buffer, size_in_bytes);


1887                                     GrowableArray<MemRegion> * open_archive) {
1888   assert(UseG1GC, "Only support G1 GC");
1889   assert(UseCompressedOops && UseCompressedClassPointers,
1890          "Only support UseCompressedOops and UseCompressedClassPointers enabled");
1891 
1892   Thread* THREAD = Thread::current();
1893   G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
1894 
1895   java_lang_Class::archive_basic_type_mirrors(THREAD);
1896 
1897   MetaspaceShared::archive_klass_objects(THREAD);
1898 
1899   HeapShared::archive_static_fields(THREAD);
1900 
1901   G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
1902                                                    os::vm_allocation_granularity());
1903 }
1904 
1905 unsigned MetaspaceShared::obj_hash(oop const& p) {
1906   assert(!p->mark()->has_bias_pattern(),
1907          "this object should never have been locked");  // so identity_hash won't safepoint
1908   unsigned hash = (unsigned)p->identity_hash();
1909   return hash;
1910 }
1911 
1912 MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
1913 oop MetaspaceShared::find_archived_heap_object(oop obj) {
1914   assert(DumpSharedSpaces, "dump-time only");
1915   ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
1916   oop* p = cache->get(obj);
1917   if (p != NULL) {
1918     return *p;
1919   } else {
1920     return NULL;
1921   }
1922 }
1923 
1924 oop MetaspaceShared::archive_heap_object(oop obj, Thread* THREAD) {
1925   assert(DumpSharedSpaces, "dump-time only");
1926 
1927   oop ao = find_archived_heap_object(obj);


2142   char* buffer = mapinfo->misc_data_patching_start();
2143   clone_cpp_vtables((intptr_t*)buffer);
2144 
2145   // The rest of the data is now stored in the RW region
2146   buffer = mapinfo->read_only_tables_start();
2147   int sharedDictionaryLen = *(intptr_t*)buffer;
2148   buffer += sizeof(intptr_t);
2149   int number_of_entries = *(intptr_t*)buffer;
2150   buffer += sizeof(intptr_t);
2151   SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer,
2152                                           sharedDictionaryLen,
2153                                           number_of_entries);
2154   buffer += sharedDictionaryLen;
2155 
2156   // The following data are the linked list elements
2157   // (HashtableEntry objects) for the shared dictionary table.
2158 
2159   int len = *(intptr_t*)buffer;     // skip over shared dictionary entries
2160   buffer += sizeof(intptr_t);
2161   buffer += len;



2162 
2163   // Verify various attributes of the archive, plus initialize the
2164   // shared string/symbol tables
2165   intptr_t* array = (intptr_t*)buffer;
2166   ReadClosure rc(&array);
2167   serialize(&rc);
2168 
2169   // Initialize the run-time symbol table.
2170   SymbolTable::create_table();
2171 
2172   mapinfo->patch_archived_heap_embedded_pointers();
2173 
2174   // Close the mapinfo file
2175   mapinfo->close();
2176 
2177   if (PrintSharedArchiveAndExit) {
2178     if (PrintSharedDictionary) {
2179       tty->print_cr("\nShared classes:\n");
2180       SystemDictionary::print_shared(tty);
2181     }


< prev index next >