< prev index next >

src/hotspot/share/memory/heapShared.cpp

Print this page

        

*** 79,102 **** } return num; } // Add an entry field to the current KlassSubGraphInfo. ! void KlassSubGraphInfo::add_subgraph_entry_field(int field_offset, oop v) { assert(DumpSharedSpaces, "dump time only"); if (_subgraph_entry_fields == NULL) { _subgraph_entry_fields = new(ResourceObj::C_HEAP, mtClass) GrowableArray<juint>(10, true); } ! _subgraph_entry_fields->append((juint)field_offset); _subgraph_entry_fields->append(CompressedOops::encode(v)); } // Add the Klass* for an object in the current KlassSubGraphInfo's subgraphs. // Only objects of boot classes can be included in sub-graph. void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k, Klass *relocated_k) { assert(DumpSharedSpaces, "dump time only"); if (_subgraph_object_klasses == NULL) { _subgraph_object_klasses = new(ResourceObj::C_HEAP, mtClass) GrowableArray<Klass*>(50, true); } --- 79,104 ---- } return num; } // Add an entry field to the current KlassSubGraphInfo. ! void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) { assert(DumpSharedSpaces, "dump time only"); if (_subgraph_entry_fields == NULL) { _subgraph_entry_fields = new(ResourceObj::C_HEAP, mtClass) GrowableArray<juint>(10, true); } ! _subgraph_entry_fields->append((juint)static_field_offset); _subgraph_entry_fields->append(CompressedOops::encode(v)); } // Add the Klass* for an object in the current KlassSubGraphInfo's subgraphs. // Only objects of boot classes can be included in sub-graph. void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k, Klass *relocated_k) { assert(DumpSharedSpaces, "dump time only"); + assert(relocated_k == MetaspaceShared::get_relocated_klass(orig_k), + "must be the relocated Klass in the shared space"); if (_subgraph_object_klasses == NULL) { _subgraph_object_klasses = new(ResourceObj::C_HEAP, mtClass) GrowableArray<Klass*>(50, true); }
*** 363,381 **** // The current oop is an archived oop, nothing needs to be done log.print("--- object is already archived ---"); return; } ! size_t delta = pointer_delta((HeapWord*)_archived_referencing_obj, ! (HeapWord*)_orig_referencing_obj); ! T* new_p = (T*)((HeapWord*)p + delta); oop archived = MetaspaceShared::find_archived_heap_object(obj); if (archived != NULL) { // There is an archived copy existing, update reference to point // to the archived copy RawAccess<IS_NOT_NULL>::oop_store(new_p, archived); ! log.print("--- archived copy existing, store archived " PTR_FORMAT " in " PTR_FORMAT, p2i(archived), p2i(new_p)); return; } int l = _level + 1; --- 365,384 ---- // The current oop is an archived oop, nothing needs to be done log.print("--- object is already archived ---"); return; } ! size_t field_delta = pointer_delta( ! p, _orig_referencing_obj, sizeof(char)); ! T* new_p = (T*)(address(_archived_referencing_obj) + field_delta); oop archived = MetaspaceShared::find_archived_heap_object(obj); if (archived != NULL) { // There is an archived copy existing, update reference to point // to the archived copy RawAccess<IS_NOT_NULL>::oop_store(new_p, archived); ! log.print( ! "--- found existing archived copy, store archived " PTR_FORMAT " in " PTR_FORMAT, p2i(archived), p2i(new_p)); return; } int l = _level + 1;
*** 398,409 **** // Add the klass to the list of classes that need to be loaded before // module system initialization Klass *orig_k = obj->klass(); Klass *relocated_k = archived->klass(); - assert(relocated_k == MetaspaceShared::get_relocated_klass(orig_k), - "must be the relocated Klass in the shared space"); _subgraph_info->add_subgraph_object_klass(orig_k, relocated_k); } } }; --- 401,410 ----
*** 440,450 **** // // 5) The Klass of the current java object is added to the list of Klasses // for loading and initialzing before any object in the archived graph can // be accessed at runtime. // ! void HeapShared::walk_from_field_and_archiving(Klass *k, int field_offset, BasicType field_type, TRAPS) { assert(DumpSharedSpaces, "dump time only"); assert(k->is_instance_klass(), "sanity"); --- 441,451 ---- // // 5) The Klass of the current java object is added to the list of Klasses // for loading and initialzing before any object in the archived graph can // be accessed at runtime. // ! void HeapShared::archive_reachable_objects_from_static_field(Klass *k, int field_offset, BasicType field_type, TRAPS) { assert(DumpSharedSpaces, "dump time only"); assert(k->is_instance_klass(), "sanity");
*** 470,490 **** log.print("Start from: "); f->print_on(out); // get the archived copy of the field referenced object oop af = MetaspaceShared::archive_heap_object(f, THREAD); WalkOopAndArchiveClosure walker(1, subgraph_info, f, af); f->oop_iterate(&walker); // The field value is not preserved in the archived mirror. // Record the field as a new subGraph entry point. The recorded // information is restored from the archive at runtime. subgraph_info->add_subgraph_entry_field(field_offset, af); Klass *relocated_k = af->klass(); Klass *orig_k = f->klass(); - assert(relocated_k == MetaspaceShared::get_relocated_klass(orig_k), - "must be the relocated Klass in the shared space"); subgraph_info->add_subgraph_object_klass(orig_k, relocated_k); } else { // The field contains null, we still need to record the entry point, // so it can be restored at runtime. subgraph_info->add_subgraph_entry_field(field_offset, NULL); --- 471,491 ---- log.print("Start from: "); f->print_on(out); // get the archived copy of the field referenced object oop af = MetaspaceShared::archive_heap_object(f, THREAD); + if (!MetaspaceShared::is_archive_object(f)) { WalkOopAndArchiveClosure walker(1, subgraph_info, f, af); f->oop_iterate(&walker); + } // The field value is not preserved in the archived mirror. // Record the field as a new subGraph entry point. The recorded // information is restored from the archive at runtime. subgraph_info->add_subgraph_entry_field(field_offset, af); Klass *relocated_k = af->klass(); Klass *orig_k = f->klass(); subgraph_info->add_subgraph_object_klass(orig_k, relocated_k); } else { // The field contains null, we still need to record the entry point, // so it can be restored at runtime. subgraph_info->add_subgraph_entry_field(field_offset, NULL);
*** 498,505 **** archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedSystemModules_offset(), T_OBJECT, CHECK); \ archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedModuleFinder_offset(), T_OBJECT, CHECK); \ archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedMainModule_offset(), T_OBJECT, CHECK) void HeapShared::archive_module_graph_objects(Thread* THREAD) { ! do_module_object_graph(walk_from_field_and_archiving); } #endif // INCLUDE_CDS_JAVA_HEAP --- 499,506 ---- archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedSystemModules_offset(), T_OBJECT, CHECK); \ archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedModuleFinder_offset(), T_OBJECT, CHECK); \ archive_object_graph_do(SystemDictionary::ArchivedModuleGraph_klass(), jdk_internal_module_ArchivedModuleGraph::archivedMainModule_offset(), T_OBJECT, CHECK) void HeapShared::archive_module_graph_objects(Thread* THREAD) { ! do_module_object_graph(archive_reachable_objects_from_static_field); } #endif // INCLUDE_CDS_JAVA_HEAP
< prev index next >