< prev index next >
src/hotspot/share/memory/metaspaceShared.cpp
Print this page
@@ -420,10 +420,13 @@
soc->do_tag(--tag);
// Dump/restore the symbol and string tables
SymbolTable::serialize(soc);
StringTable::serialize(soc);
+
+ // Dump/restore the tables related to shared heap objects
+ HeapShared::serialize_hashtables(soc);
soc->do_tag(--tag);
JavaClasses::serialize_offsets(soc);
InstanceMirrorKlass::serialize_offsets(soc);
soc->do_tag(--tag);
@@ -1095,10 +1098,25 @@
}
static DumpAllocStats* alloc_stats() {
return _alloc_stats;
}
+ // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
+ // outside of ArchiveCompactor::allocate(). These are usually for misc tables
+ // that are allocated in the RO space.
+ class OtherROAllocMark {
+ char* _oldtop;
+ public:
+ OtherROAllocMark() {
+ _oldtop = _ro_region.top();
+ }
+ ~OtherROAllocMark() {
+ char* newtop = _ro_region.top();
+ ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - _oldtop), true);
+ }
+ };
+
static void allocate(MetaspaceClosure::Ref* ref, bool read_only) {
address obj = ref->obj();
int bytes = ref->size() * BytesPerWord;
char* p;
size_t alignment = BytesPerWord;
@@ -1305,11 +1323,11 @@
NOT_PRODUCT(SymbolTable::verify());
SymbolTable::write_to_archive();
}
char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
- char* oldtop = _ro_region.top();
+ ArchiveCompactor::OtherROAllocMark mark;
// Reorder the system dictionary. Moving the symbols affects
// how the hash table indices are calculated.
SystemDictionary::reorder_dictionary_for_sharing();
tty->print("Removing java_mirror ... ");
@@ -1326,24 +1344,17 @@
size_t table_bytes = SystemDictionary::count_bytes_for_table();
char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
SystemDictionary::copy_table(table_top, _ro_region.top());
- // Write the archived object sub-graph infos. For each klass with sub-graphs,
- // the info includes the static fields (sub-graph entry points) and Klasses
- // of objects included in the sub-graph.
- HeapShared::write_archived_subgraph_infos();
-
// Write the other data to the output array.
WriteClosure wc(&_ro_region);
MetaspaceShared::serialize(&wc);
// Write the bitmaps for patching the archive heap regions
dump_archive_heap_oopmaps();
- char* newtop = _ro_region.top();
- ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - oldtop), true);
return buckets_top;
}
void VM_PopulateDumpSharedSpace::doit() {
Thread* THREAD = VMThread::vm_thread();
@@ -1819,10 +1830,15 @@
MetaspaceShared::destroy_archive_object_cache();
}
G1HeapVerifier::verify_archive_regions();
+
+ {
+ ArchiveCompactor::OtherROAllocMark mark;
+ HeapShared::create_hashtables();
+ }
}
void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
if (MetaspaceShared::is_heap_object_archiving_allowed()) {
_closed_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
@@ -1886,11 +1902,11 @@
os::vm_allocation_granularity());
}
unsigned MetaspaceShared::obj_hash(oop const& p) {
assert(!p->mark()->has_bias_pattern(),
- "this object should never have been locked"); // so identity_hash won't safepoin
+ "this object should never have been locked"); // so identity_hash won't safepoint
unsigned hash = (unsigned)p->identity_hash();
return hash;
}
MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
@@ -2142,13 +2158,10 @@
int len = *(intptr_t*)buffer; // skip over shared dictionary entries
buffer += sizeof(intptr_t);
buffer += len;
- // The table of archived java heap object sub-graph infos
- buffer = HeapShared::read_archived_subgraph_infos(buffer);
-
// Verify various attributes of the archive, plus initialize the
// shared string/symbol tables
intptr_t* array = (intptr_t*)buffer;
ReadClosure rc(&array);
serialize(&rc);
< prev index next >