104 };
105 #endif // INCLUDE_CDS_JAVA_HEAP
106
107 class HeapShared: AllStatic {
108 friend class VerifySharedOopClosure;
109 private:
110 #if INCLUDE_CDS_JAVA_HEAP
111
112 static bool klass_equals(Klass* const& p1, Klass* const& p2) {
113 return primitive_equals<Klass*>(p1, p2);
114 }
115
116 static unsigned klass_hash(Klass* const& klass) {
117 return primitive_hash<address>((address)klass);
118 }
119
120 class DumpTimeKlassSubGraphInfoTable
121 : public ResourceHashtable<Klass*, KlassSubGraphInfo,
122 HeapShared::klass_hash,
123 HeapShared::klass_equals,
124 15889, // prime number
125 ResourceObj::C_HEAP> {
126 public:
127 int _count;
128 };
129
130 inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) {
131 return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset);
132 }
133
134 inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
135 return (value->klass() == key);
136 }
137
138 typedef CompactHashtable<
139 const Klass*,
140 ArchivedKlassSubGraphInfoRecord*,
141 read_record_from_compact_hashtable,
142 record_equals_compact_hashtable_entry
143 > RunTimeKlassSubGraphInfoTable;
144
209 static void set_has_been_seen_during_subgraph_recording(oop obj);
210 #endif // INCLUDE_CDS_JAVA_HEAP
211 public:
212 static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
213 static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
214 static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
215
216 // NarrowOops stored in the CDS archive may use a different encoding scheme
217 // than Universe::narrow_oop_{base,shift} -- see FileMapInfo::map_heap_regions_impl.
218 // To decode them, do not use CompressedOops::decode_not_null. Use this
219 // function instead.
220 inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
221
222 static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
223
224 static void patch_archived_heap_embedded_pointers(MemRegion mem, address oopmap,
225 size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
226
227 static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
228 static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
229 static void create_hashtables() NOT_CDS_JAVA_HEAP_RETURN;
230 static void serialize_hashtables(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
231
232 #if INCLUDE_CDS_JAVA_HEAP
233 static ResourceBitMap calculate_oopmap(MemRegion region);
234 static oop archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS);
235 static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
236 #endif
237 };
238 #endif // SHARE_VM_MEMORY_HEAPSHARED_HPP
|
104 };
105 #endif // INCLUDE_CDS_JAVA_HEAP
106
107 class HeapShared: AllStatic {
108 friend class VerifySharedOopClosure;
109 private:
110 #if INCLUDE_CDS_JAVA_HEAP
111
112 static bool klass_equals(Klass* const& p1, Klass* const& p2) {
113 return primitive_equals<Klass*>(p1, p2);
114 }
115
116 static unsigned klass_hash(Klass* const& klass) {
117 return primitive_hash<address>((address)klass);
118 }
119
120 class DumpTimeKlassSubGraphInfoTable
121 : public ResourceHashtable<Klass*, KlassSubGraphInfo,
122 HeapShared::klass_hash,
123 HeapShared::klass_equals,
124 137, // prime number
125 ResourceObj::C_HEAP> {
126 public:
127 int _count;
128 };
129
130 inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) {
131 return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset);
132 }
133
134 inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
135 return (value->klass() == key);
136 }
137
138 typedef CompactHashtable<
139 const Klass*,
140 ArchivedKlassSubGraphInfoRecord*,
141 read_record_from_compact_hashtable,
142 record_equals_compact_hashtable_entry
143 > RunTimeKlassSubGraphInfoTable;
144
209 static void set_has_been_seen_during_subgraph_recording(oop obj);
210 #endif // INCLUDE_CDS_JAVA_HEAP
211 public:
212 static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
213 static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
214 static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
215
216 // NarrowOops stored in the CDS archive may use a different encoding scheme
217 // than Universe::narrow_oop_{base,shift} -- see FileMapInfo::map_heap_regions_impl.
218 // To decode them, do not use CompressedOops::decode_not_null. Use this
219 // function instead.
220 inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
221
222 static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
223
224 static void patch_archived_heap_embedded_pointers(MemRegion mem, address oopmap,
225 size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
226
227 static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
228 static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
229 static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
230 static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
231
232 #if INCLUDE_CDS_JAVA_HEAP
233 static ResourceBitMap calculate_oopmap(MemRegion region);
234 static oop archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS);
235 static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
236 #endif
237 };
238 #endif // SHARE_VM_MEMORY_HEAPSHARED_HPP
|