< prev index next >

src/hotspot/share/memory/heapShared.hpp

Print this page

*** 23,32 **** --- 23,33 ---- */ #ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP #define SHARE_VM_MEMORY_HEAPSHARED_HPP + #include "classfile/compactHashtable.hpp" #include "classfile/systemDictionary.hpp" #include "memory/allocation.hpp" #include "memory/universe.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.hpp"
*** 40,50 **** // (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: - KlassSubGraphInfo* _next; // 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. --- 41,50 ----
*** 52,74 **** // A list of _k's static fields as the entry points of archived sub-graphs. // For each entry field, it is a pair of field_offset and field_value. GrowableArray<juint>* _subgraph_entry_fields; public: ! KlassSubGraphInfo(Klass* k, KlassSubGraphInfo* next) : ! _next(next), _k(k), _subgraph_object_klasses(NULL), _subgraph_entry_fields(NULL) {} ~KlassSubGraphInfo() { if (_subgraph_object_klasses != NULL) { delete _subgraph_object_klasses; } if (_subgraph_entry_fields != NULL) { delete _subgraph_entry_fields; } }; - KlassSubGraphInfo* next() { return _next; } Klass* klass() { return _k; } GrowableArray<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; } GrowableArray<juint>* subgraph_entry_fields() { --- 52,73 ---- // A list of _k's static fields as the entry points of archived sub-graphs. // For each entry field, it is a pair of field_offset and field_value. GrowableArray<juint>* _subgraph_entry_fields; public: ! KlassSubGraphInfo(Klass* k) : ! _k(k), _subgraph_object_klasses(NULL), _subgraph_entry_fields(NULL) {} ~KlassSubGraphInfo() { if (_subgraph_object_klasses != NULL) { delete _subgraph_object_klasses; } if (_subgraph_entry_fields != NULL) { delete _subgraph_entry_fields; } }; Klass* klass() { return _k; } GrowableArray<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; } GrowableArray<juint>* subgraph_entry_fields() {
*** 85,127 **** // 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: - ArchivedKlassSubGraphInfoRecord* _next; Klass* _k; // contains pairs of field offset and value for each subgraph entry field Array<juint>* _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() : ! _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {} void init(KlassSubGraphInfo* info); Klass* klass() { return _k; } - ArchivedKlassSubGraphInfoRecord* next() { return _next; } - void set_next(ArchivedKlassSubGraphInfoRecord* next) { _next = next; } Array<juint>* entry_field_records() { return _entry_field_records; } Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; } }; #endif // INCLUDE_CDS_JAVA_HEAP class HeapShared: AllStatic { friend class VerifySharedOopClosure; private: #if INCLUDE_CDS_JAVA_HEAP ! // This is a list of subgraph infos built at dump time while ! // archiving object subgraphs. ! static KlassSubGraphInfo* _subgraph_info_list; ! ! // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored ! // in the archive file and reloaded at runtime. ! static int _num_archived_subgraph_info_records; ! static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records; // Archive object sub-graph starting from the given static field // in Klass k's mirror. static void archive_reachable_objects_from_static_field( InstanceKlass* k, const char* klass_name, --- 84,151 ---- // 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; // contains pairs of field offset and value for each subgraph entry field Array<juint>* _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() { return _k; } Array<juint>* entry_field_records() { return _entry_field_records; } Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; } }; #endif // INCLUDE_CDS_JAVA_HEAP class HeapShared: AllStatic { friend class VerifySharedOopClosure; private: #if INCLUDE_CDS_JAVA_HEAP ! ! static bool klass_equals(Klass* const& p1, Klass* const& p2) { ! return primitive_equals<Klass*>(p1, p2); ! } ! ! static unsigned klass_hash(Klass* const& klass) { ! return primitive_hash<address>((address)klass); ! } ! ! class DumpTimeKlassSubGraphInfoTable ! : public ResourceHashtable<Klass*, KlassSubGraphInfo, ! HeapShared::klass_hash, ! HeapShared::klass_equals, ! 15889, // prime number ! ResourceObj::C_HEAP> { ! public: ! int _count; ! }; ! ! inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) { ! return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset); ! } ! ! inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) { ! return (value->klass() == key); ! } ! ! typedef CompactHashtable< ! const Klass*, ! ArchivedKlassSubGraphInfoRecord*, ! read_record_from_compact_hashtable, ! record_equals_compact_hashtable_entry ! > RunTimeKlassSubGraphInfoTable; ! ! static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table; ! static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table; // Archive object sub-graph starting from the given static field // in Klass k's mirror. static void archive_reachable_objects_from_static_field( InstanceKlass* k, const char* klass_name,
*** 129,143 **** static void verify_subgraph_from_static_field( InstanceKlass* k, int field_offset) PRODUCT_RETURN; static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN; - static KlassSubGraphInfo* find_subgraph_info(Klass *k); static KlassSubGraphInfo* get_subgraph_info(Klass *k); static int num_of_subgraph_infos(); ! static size_t build_archived_subgraph_info_records(int num_records); // Used by decode_from_archive static address _narrow_oop_base; static int _narrow_oop_shift; --- 153,166 ---- static void verify_subgraph_from_static_field( InstanceKlass* k, int field_offset) PRODUCT_RETURN; static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN; static KlassSubGraphInfo* get_subgraph_info(Klass *k); static int num_of_subgraph_infos(); ! static void build_archived_subgraph_info_records(int num_records); // Used by decode_from_archive static address _narrow_oop_base; static int _narrow_oop_shift;
*** 201,210 **** --- 224,235 ---- static void patch_archived_heap_embedded_pointers(MemRegion mem, address oopmap, size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN; static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN; static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN; + static void create_hashtables() NOT_CDS_JAVA_HEAP_RETURN; + static void serialize_hashtables(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN; #if INCLUDE_CDS_JAVA_HEAP static ResourceBitMap calculate_oopmap(MemRegion region); static oop archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS); static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
< prev index next >