--- old/src/hotspot/share/memory/heapShared.cpp 2018-10-02 09:20:26.201946314 -0700 +++ new/src/hotspot/share/memory/heapShared.cpp 2018-10-02 09:20:25.889934359 -0700 @@ -50,6 +50,7 @@ // 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) { @@ -171,7 +172,6 @@ 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)); @@ -194,7 +194,7 @@ // 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() { +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; @@ -209,15 +209,15 @@ 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::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(k); ArchivedKlassSubGraphInfoRecord* record = _run_time_subgraph_info_table.lookup(k, hash, 0); @@ -228,7 +228,7 @@ Thread* THREAD = Thread::current(); if (log_is_enabled(Info, cds, heap)) { ResourceMark rm; - log_info(cds, heap)("initialize_from_archived_subgraph %p %s", k, + log_info(cds, heap)("initialize_from_archived_subgraph " PTR_FORMAT " %s", p2i(k), k->external_name()); } @@ -279,7 +279,7 @@ m->obj_field_put(field_offset, v); i += 2; - log_debug(cds, heap)(" %p init field @ %2d = %p", k, field_offset, (address)v); + 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