< prev index next >

src/hotspot/share/memory/metaspaceShared.cpp

Print this page
rev 50951 : 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
Summary: Support system module archiving with unnamed initial module at dump time.
Reviewed-by: erikj, coleenp, mchung, iklam, ccheung
Contributed-by: alan.bateman@oracle.com, jiangli.zhou@oracle.com

*** 37,46 **** --- 37,47 ---- #include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodes.hpp" #include "logging/log.hpp" #include "logging/logMessage.hpp" #include "memory/filemap.hpp" + #include "memory/heapShared.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" #include "oops/compressedOops.inline.hpp"
*** 205,214 **** --- 206,219 ---- char* MetaspaceShared::read_only_space_alloc(size_t num_bytes) { return _ro_region.allocate(num_bytes); } + char* MetaspaceShared::read_only_space_top() { + return _ro_region.top(); + } + void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() { assert(UseSharedSpaces, "Must be called when UseSharedSpaces is enabled"); // If using shared space, open the file that contains the shared space // and map in the memory before initializing the rest of metaspace (so
*** 454,463 **** --- 459,469 ---- java_lang_Module::serialize(soc); java_lang_StackTraceElement::serialize(soc); java_lang_StackFrameInfo::serialize(soc); java_lang_LiveStackFrameInfo::serialize(soc); java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(soc); + jdk_internal_module_ArchivedModuleGraph::serialize(soc); } address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) { if (DumpSharedSpaces) { if (_cds_i2i_entry_code_buffers == NULL) {
*** 1348,1357 **** --- 1354,1368 ---- 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); char* newtop = _ro_region.top();
*** 1859,1868 **** --- 1870,1881 ---- java_lang_Class::archive_basic_type_mirrors(THREAD); MetaspaceShared::archive_klass_objects(THREAD); + HeapShared::archive_module_graph_objects(THREAD); + G1CollectedHeap::heap()->end_archive_alloc_range(open_archive, os::vm_allocation_granularity()); } unsigned MetaspaceShared::obj_hash(oop const& p) {
*** 1904,1921 **** Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len); relocate_klass_ptr(archived_oop); ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache(); cache->put(obj, archived_oop); } ! log_debug(cds)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT, p2i(obj), p2i(archived_oop)); return archived_oop; } oop MetaspaceShared::materialize_archived_object(oop obj) { ! assert(obj != NULL, "sanity"); return G1CollectedHeap::heap()->materialize_archived_object(obj); } void MetaspaceShared::archive_klass_objects(Thread* THREAD) { int i; for (i = 0; i < _global_klass_objects->length(); i++) { --- 1917,1936 ---- Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len); relocate_klass_ptr(archived_oop); ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache(); cache->put(obj, archived_oop); } ! log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT, p2i(obj), p2i(archived_oop)); return archived_oop; } oop MetaspaceShared::materialize_archived_object(oop obj) { ! if (obj != NULL) { return G1CollectedHeap::heap()->materialize_archived_object(obj); + } + return NULL; } void MetaspaceShared::archive_klass_objects(Thread* THREAD) { int i; for (i = 0; i < _global_klass_objects->length(); i++) {
*** 2119,2128 **** --- 2134,2146 ---- 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 >