< prev index next >
src/hotspot/share/memory/heapShared.cpp
Print this page
*** 48,57 ****
--- 48,58 ----
// Get the subgraph_info for Klass k. A new subgraph_info is created if
// there is no existing one for k. The subgraph_info records the relocated
// Klass* of the original k.
KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
+ assert(DumpSharedSpaces, "dump time only");
Klass* relocated_k = MetaspaceShared::get_relocated_klass(k);
KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(relocated_k);
if (info == NULL) {
_dump_time_subgraph_info_table->put(relocated_k, KlassSubGraphInfo(relocated_k));
info = _dump_time_subgraph_info_table->get(relocated_k);
*** 169,179 ****
struct CopyKlassSubGraphInfoToArchive : StackObj {
CompactHashtableWriter* _writer;
CopyKlassSubGraphInfoToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
bool do_entry(Klass* klass, KlassSubGraphInfo& info) {
-
if (info.subgraph_object_klasses() != NULL || info.subgraph_entry_fields() != NULL) {
ArchivedKlassSubGraphInfoRecord* record =
(ArchivedKlassSubGraphInfoRecord*)MetaspaceShared::read_only_space_alloc(sizeof(ArchivedKlassSubGraphInfoRecord));
record->init(&info);
--- 170,179 ----
*** 192,202 ****
// points are static fields in the mirror. For each entry point, the field
// offset and value are recorded in the sub-graph info. The value are stored
// back to the corresponding field at runtime.
// - A list of klasses that need to be loaded/initialized before archived
// java object sub-graph can be accessed at runtime.
! void HeapShared::create_hashtables() {
// Allocate the contents of the hashtable(s) inside the RO region of the CDS archive.
DumpTimeKlassSubGraphInfoTable* d_table = _dump_time_subgraph_info_table;
CompactHashtableStats stats;
_run_time_subgraph_info_table.reset();
--- 192,202 ----
// points are static fields in the mirror. For each entry point, the field
// offset and value are recorded in the sub-graph info. The value are stored
// back to the corresponding field at runtime.
// - A list of klasses that need to be loaded/initialized before archived
// java object sub-graph can be accessed at runtime.
! void HeapShared::write_subgraph_info_table() {
// Allocate the contents of the hashtable(s) inside the RO region of the CDS archive.
DumpTimeKlassSubGraphInfoTable* d_table = _dump_time_subgraph_info_table;
CompactHashtableStats stats;
_run_time_subgraph_info_table.reset();
*** 207,236 ****
_dump_time_subgraph_info_table->iterate(©);
writer.dump(&_run_time_subgraph_info_table, "subgraphs");
}
! // Read/write the headers of the hashtable(s) so they can be accessed quickly at runtime.
! void HeapShared::serialize_hashtables(SerializeClosure* soc) {
! _run_time_subgraph_info_table.serialize(soc);
}
void HeapShared::initialize_from_archived_subgraph(Klass* k) {
if (!MetaspaceShared::open_archive_heap_region_mapped()) {
return; // nothing to do
}
unsigned int hash = primitive_hash<Klass*>(k);
ArchivedKlassSubGraphInfoRecord* record = _run_time_subgraph_info_table.lookup(k, hash, 0);
// Initialize from archived data. Currently this is done only
// during VM initialization time. No lock is needed.
if (record != NULL) {
Thread* THREAD = Thread::current();
if (log_is_enabled(Info, cds, heap)) {
ResourceMark rm;
! log_info(cds, heap)("initialize_from_archived_subgraph %p %s", k,
k->external_name());
}
int i;
// Load/link/initialize the klasses of the objects in the subgraph.
--- 207,236 ----
_dump_time_subgraph_info_table->iterate(©);
writer.dump(&_run_time_subgraph_info_table, "subgraphs");
}
! void HeapShared::serialize_subgraph_info_table_header(SerializeClosure* soc) {
! _run_time_subgraph_info_table.serialize_header(soc);
}
void HeapShared::initialize_from_archived_subgraph(Klass* k) {
if (!MetaspaceShared::open_archive_heap_region_mapped()) {
return; // nothing to do
}
+ assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
unsigned int hash = primitive_hash<Klass*>(k);
ArchivedKlassSubGraphInfoRecord* record = _run_time_subgraph_info_table.lookup(k, hash, 0);
// Initialize from archived data. Currently this is done only
// during VM initialization time. No lock is needed.
if (record != NULL) {
Thread* THREAD = Thread::current();
if (log_is_enabled(Info, cds, heap)) {
ResourceMark rm;
! log_info(cds, heap)("initialize_from_archived_subgraph " PTR_FORMAT " %s", p2i(k),
k->external_name());
}
int i;
// Load/link/initialize the klasses of the objects in the subgraph.
*** 277,287 ****
oop v = MetaspaceShared::materialize_archived_object(
entry_field_records->at(i+1));
m->obj_field_put(field_offset, v);
i += 2;
! log_debug(cds, heap)(" %p init field @ %2d = %p", k, field_offset, (address)v);
}
// Done. Java code can see the archived sub-graphs referenced from k's
// mirror after this point.
}
--- 277,287 ----
oop v = MetaspaceShared::materialize_archived_object(
entry_field_records->at(i+1));
m->obj_field_put(field_offset, v);
i += 2;
! log_debug(cds, heap)(" " PTR_FORMAT " init field @ %2d = " PTR_FORMAT, p2i(k), field_offset, p2i(v));
}
// Done. Java code can see the archived sub-graphs referenced from k's
// mirror after this point.
}
< prev index next >