23 */
24
25 #ifndef SHARE_MEMORY_HEAPSHARED_HPP
26 #define SHARE_MEMORY_HEAPSHARED_HPP
27
28 #include "classfile/compactHashtable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/metaspaceShared.hpp"
32 #include "oops/compressedOops.hpp"
33 #include "oops/objArrayKlass.hpp"
34 #include "oops/oop.hpp"
35 #include "oops/typeArrayKlass.hpp"
36 #include "utilities/bitMap.hpp"
37 #include "utilities/growableArray.hpp"
38 #include "utilities/resourceHash.hpp"
39
40 #if INCLUDE_CDS_JAVA_HEAP
41 struct ArchivableStaticFieldInfo {
42 const char* klass_name;
43 const char* field_name;
44 InstanceKlass* klass;
45 int offset;
46 BasicType type;
47 };
48
49 // A dump time sub-graph info for Klass _k. It includes the entry points
50 // (static fields in _k's mirror) of the archived sub-graphs reachable
51 // from _k's mirror. It also contains a list of Klasses of the objects
52 // within the sub-graphs.
53 class KlassSubGraphInfo: public CHeapObj<mtClass> {
54 private:
55 // The class that contains the static field(s) as the entry point(s)
56 // of archived object sub-graph(s).
57 Klass* _k;
58 // A list of classes need to be loaded and initialized before the archived
59 // object sub-graphs can be accessed at runtime.
60 GrowableArray<Klass*>* _subgraph_object_klasses;
61 // A list of _k's static fields as the entry points of archived sub-graphs.
62 // For each entry field, it is a tuple of field_offset, field_value and
219 }
220
221 // Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
222 static int _num_new_walked_objs;
223 static int _num_new_archived_objs;
224 static int _num_old_recorded_klasses;
225
226 // Statistics (for all archived subgraphs)
227 static int _num_total_subgraph_recordings;
228 static int _num_total_walked_objs;
229 static int _num_total_archived_objs;
230 static int _num_total_recorded_klasses;
231 static int _num_total_verifications;
232
233 static void start_recording_subgraph(InstanceKlass *k, const char* klass_name);
234 static void done_recording_subgraph(InstanceKlass *k, const char* klass_name);
235
236 static bool has_been_seen_during_subgraph_recording(oop obj);
237 static void set_has_been_seen_during_subgraph_recording(oop obj);
238
239 public:
240 static void create_archived_object_cache() {
241 _archived_object_cache =
242 new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
243 }
244 static void destroy_archived_object_cache() {
245 delete _archived_object_cache;
246 _archived_object_cache = NULL;
247 }
248 static ArchivedObjectCache* archived_object_cache() {
249 return _archived_object_cache;
250 }
251
252 static oop find_archived_heap_object(oop obj);
253 static oop archive_heap_object(oop obj, Thread* THREAD);
254 static oop materialize_archived_object(narrowOop v);
255
256 static void archive_klass_objects(Thread* THREAD);
257
258 static void set_archive_heap_region_fixed() {
259 _archive_heap_region_fixed = true;
|
23 */
24
25 #ifndef SHARE_MEMORY_HEAPSHARED_HPP
26 #define SHARE_MEMORY_HEAPSHARED_HPP
27
28 #include "classfile/compactHashtable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/metaspaceShared.hpp"
32 #include "oops/compressedOops.hpp"
33 #include "oops/objArrayKlass.hpp"
34 #include "oops/oop.hpp"
35 #include "oops/typeArrayKlass.hpp"
36 #include "utilities/bitMap.hpp"
37 #include "utilities/growableArray.hpp"
38 #include "utilities/resourceHash.hpp"
39
40 #if INCLUDE_CDS_JAVA_HEAP
41 struct ArchivableStaticFieldInfo {
42 const char* klass_name;
43 int full_module_graph_only;
44 const char* field_name;
45 InstanceKlass* klass;
46 int offset;
47 BasicType type;
48 };
49
50 // A dump time sub-graph info for Klass _k. It includes the entry points
51 // (static fields in _k's mirror) of the archived sub-graphs reachable
52 // from _k's mirror. It also contains a list of Klasses of the objects
53 // within the sub-graphs.
54 class KlassSubGraphInfo: public CHeapObj<mtClass> {
55 private:
56 // The class that contains the static field(s) as the entry point(s)
57 // of archived object sub-graph(s).
58 Klass* _k;
59 // A list of classes need to be loaded and initialized before the archived
60 // object sub-graphs can be accessed at runtime.
61 GrowableArray<Klass*>* _subgraph_object_klasses;
62 // A list of _k's static fields as the entry points of archived sub-graphs.
63 // For each entry field, it is a tuple of field_offset, field_value and
220 }
221
222 // Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
223 static int _num_new_walked_objs;
224 static int _num_new_archived_objs;
225 static int _num_old_recorded_klasses;
226
227 // Statistics (for all archived subgraphs)
228 static int _num_total_subgraph_recordings;
229 static int _num_total_walked_objs;
230 static int _num_total_archived_objs;
231 static int _num_total_recorded_klasses;
232 static int _num_total_verifications;
233
234 static void start_recording_subgraph(InstanceKlass *k, const char* klass_name);
235 static void done_recording_subgraph(InstanceKlass *k, const char* klass_name);
236
237 static bool has_been_seen_during_subgraph_recording(oop obj);
238 static void set_has_been_seen_during_subgraph_recording(oop obj);
239
240 static void check_module_oop(oop orig_module_obj);
241
242 public:
243 static void reset_archived_object_states(TRAPS);
244 static void create_archived_object_cache() {
245 _archived_object_cache =
246 new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
247 }
248 static void destroy_archived_object_cache() {
249 delete _archived_object_cache;
250 _archived_object_cache = NULL;
251 }
252 static ArchivedObjectCache* archived_object_cache() {
253 return _archived_object_cache;
254 }
255
256 static oop find_archived_heap_object(oop obj);
257 static oop archive_heap_object(oop obj, Thread* THREAD);
258 static oop materialize_archived_object(narrowOop v);
259
260 static void archive_klass_objects(Thread* THREAD);
261
262 static void set_archive_heap_region_fixed() {
263 _archive_heap_region_fixed = true;
|