/* * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
#if INCLUDE_CDS_JAVA_HEAP class DumpedInternedStrings; class FileMapInfo; class KlassSubGraphInfo; class ResourceBitMap;
struct ArchivableStaticFieldInfo;
// A dump time sub-graph info for Klass _k. It includes the entry points // (static fields in _k's mirror) of the archived sub-graphs reachable // from _k's mirror. It also contains a list of Klasses of the objects // within the sub-graphs. class KlassSubGraphInfo: public CHeapObj<mtClass> { private: // The class that contains the static field(s) as the entry point(s) // of archived object sub-graph(s).
Klass* _k; // A list of classes need to be loaded and initialized before the archived // object sub-graphs can be accessed at runtime.
GrowableArray<Klass*>* _subgraph_object_klasses; // A list of _k's static fields as the entry points of archived sub-graphs. // For each entry field, it is a tuple of field_offset, field_value and // is_closed_archive flag.
GrowableArray<int>* _subgraph_entry_fields;
// Does this KlassSubGraphInfo belong to the archived full module graph bool _is_full_module_graph;
// Does this KlassSubGraphInfo references any classes that were loaded while // JvmtiExport::is_early_phase()!=true. If so, this KlassSubGraphInfo cannot be // used at runtime if JVMTI ClassFileLoadHook is enabled. bool _has_non_early_klasses; staticbool is_non_early_klass(Klass* k); staticvoid check_allowed_klass(InstanceKlass* ik); public:
KlassSubGraphInfo(Klass* k, bool is_full_module_graph) :
_k(k), _subgraph_object_klasses(NULL),
_subgraph_entry_fields(NULL),
_is_full_module_graph(is_full_module_graph),
_has_non_early_klasses(false) {}
~KlassSubGraphInfo() { if (_subgraph_object_klasses != NULL) { delete _subgraph_object_klasses;
} if (_subgraph_entry_fields != NULL) { delete _subgraph_entry_fields;
}
};
// An archived record of object sub-graphs reachable from static // fields within _k's mirror. The record is reloaded from the archive // at runtime. class ArchivedKlassSubGraphInfoRecord { private:
Klass* _k; bool _is_full_module_graph; bool _has_non_early_klasses;
// contains pairs of field offset and value for each subgraph entry field
Array<int>* _entry_field_records;
// klasses of objects in archived sub-graphs referenced from the entry points // (static fields) in the containing class
Array<Klass*>* _subgraph_object_klasses; public:
ArchivedKlassSubGraphInfoRecord() :
_k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {} void init(KlassSubGraphInfo* info);
Klass* klass() const { return _k; }
Array<int>* entry_field_records() const { return _entry_field_records; }
Array<Klass*>* subgraph_object_klasses() const { return _subgraph_object_klasses; } bool is_full_module_graph() const { return _is_full_module_graph; } bool has_non_early_klasses() const { return _has_non_early_klasses; }
}; #endif// INCLUDE_CDS_JAVA_HEAP
struct LoadedArchiveHeapRegion;
class HeapShared: AllStatic { friendclass VerifySharedOopClosure;
public: // Can this VM write heap regions into the CDS archive? Currently only G1+compressed{oops,cp} staticbool can_write() {
CDS_JAVA_HEAP_ONLY( if (_disable_writing) { returnfalse;
} return (UseG1GC && UseCompressedClassPointers);
)
NOT_CDS_JAVA_HEAP(returnfalse;)
}
typedef ResourceHashtable<oop, CachedOopInfo,
36137, // prime number
AnyObj::C_HEAP,
mtClassShared,
HeapShared::oop_hash> ArchivedObjectCache; static ArchivedObjectCache* _archived_object_cache;
typedef ResourceHashtable<oop, oop,
36137, // prime number
AnyObj::C_HEAP,
mtClassShared,
HeapShared::oop_hash> OriginalObjectTable; static OriginalObjectTable* _original_object_table;
class DumpTimeKlassSubGraphInfoTable
: public ResourceHashtable<Klass*, KlassSubGraphInfo,
137, // prime number
AnyObj::C_HEAP,
mtClassShared,
DumpTimeSharedClassTable_hash> { public: int _count;
};
public: // solaris compiler wants this for RunTimeKlassSubGraphInfoTable inlinestaticbool record_equals_compact_hashtable_entry( const ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) { return (value->klass() == key);
}
// Archive object sub-graph starting from the given static field // in Klass k's mirror. staticvoid archive_reachable_objects_from_static_field(
InstanceKlass* k, constchar* klass_name, int field_offset, constchar* field_name, bool is_closed_archive);
static ResourceBitMap calculate_oopmap(MemRegion region); // marks all the oop pointers static ResourceBitMap calculate_ptrmap(MemRegion region); // marks all the native pointers staticvoid add_to_dumped_interned_strings(oop string);
// We use the HeapShared::roots() array to make sure that objects stored in the // archived heap regions are not prematurely collected. These roots include: // // - mirrors of classes that have not yet been loaded. // - ConstantPool::resolved_references() of classes that have not yet been loaded. // - ArchivedKlassSubGraphInfoRecords that have not been initialized // - java.lang.Module objects that have not yet been added to the module graph // // When a mirror M becomes referenced by a newly loaded class K, M will be removed // from HeapShared::roots() via clear_root(), and K will be responsible for // keeping M alive. // // Other types of roots are also cleared similarly when they become referenced.
// Dump-time only. Returns the index of the root, which can be used at run time to read // the root using get_root(index, ...). staticint append_root(oop obj);
// Returns the address of a heap object when it's mapped at the // runtime requested address. See comments in archiveBuilder.hpp. static address to_requested_address(address dumptime_addr) NOT_CDS_JAVA_HEAP_RETURN_(NULL); static oop to_requested_address(oop dumptime_oop) { return cast_to_oop(to_requested_address(cast_from_oop<address>(dumptime_oop)));
} staticbool is_a_test_class_in_unnamed_module(Klass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
};
#if INCLUDE_CDS_JAVA_HEAP class DumpedInternedStrings : public ResourceHashtable<oop, bool,
15889, // prime number
AnyObj::C_HEAP,
mtClassShared,
HeapShared::string_oop_hash>
{}; #endif
#endif// SHARE_CDS_HEAPSHARED_HPP
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.