95 // ZCollectedHeap
96 //
97 class CollectedHeap : public CHeapObj<mtInternal> {
98 friend class VMStructs;
99 friend class JVMCIVMStructs;
100 friend class IsGCActiveMark; // Block structured external access to _is_gc_active
101 friend class MemAllocator;
102
103 private:
104 GCHeapLog* _gc_heap_log;
105
106 protected:
107 // Not used by all GCs
108 MemRegion _reserved;
109
110 bool _is_gc_active;
111
112 // Used for filler objects (static, but initialized in ctor).
113 static size_t _filler_array_max_size;
114
115 unsigned int _total_collections; // ... started
116 unsigned int _total_full_collections; // ... started
117 NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
118 NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
119
120 // Reason for current garbage collection. Should be set to
121 // a value reflecting no collection between collections.
122 GCCause::Cause _gc_cause;
123 GCCause::Cause _gc_lastcause;
124 PerfStringVariable* _perf_gc_cause;
125 PerfStringVariable* _perf_gc_lastcause;
126
127 // Constructor
128 CollectedHeap();
129
130 // Create a new tlab. All TLAB allocations must go through this.
131 // To allow more flexible TLAB allocations min_size specifies
132 // the minimum size needed, while requested_size is the requested
133 // size based on ergonomics. The actually allocated size will be
134 // returned in actual_size.
387 if (full) {
388 increment_total_full_collections();
389 }
390 }
391
392 void increment_total_full_collections() { _total_full_collections++; }
393
394 // Return the SoftRefPolicy for the heap;
395 virtual SoftRefPolicy* soft_ref_policy() = 0;
396
397 virtual MemoryUsage memory_usage();
398 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
399 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
400
401 // Iterate over all objects, calling "cl.do_object" on each.
402 virtual void object_iterate(ObjectClosure* cl) = 0;
403
404 // Keep alive an object that was loaded with AS_NO_KEEPALIVE.
405 virtual void keep_alive(oop obj) {}
406
407 // Returns the longest time (in ms) that has elapsed since the last
408 // time that any part of the heap was examined by a garbage collection.
409 virtual jlong millis_since_last_gc() = 0;
410
411 // Perform any cleanup actions necessary before allowing a verification.
412 virtual void prepare_for_verify() = 0;
413
414 // Generate any dumps preceding or following a full gc
415 private:
416 void full_gc_dump(GCTimer* timer, bool before);
417
418 virtual void initialize_serviceability() = 0;
419
420 public:
421 void pre_full_gc_dump(GCTimer* timer);
422 void post_full_gc_dump(GCTimer* timer);
423
424 virtual VirtualSpaceSummary create_heap_space_summary();
425 GCHeapSummary create_heap_summary();
426
427 MetaspaceSummary create_metaspace_summary();
428
429 // Print heap information on the given outputStream.
430 virtual void print_on(outputStream* st) const = 0;
431 // The default behavior is to call print_on() on tty.
432 virtual void print() const;
433
434 // Print more detailed heap information on the given
435 // outputStream. The default behavior is to call print_on(). It is
|
95 // ZCollectedHeap
96 //
97 class CollectedHeap : public CHeapObj<mtInternal> {
98 friend class VMStructs;
99 friend class JVMCIVMStructs;
100 friend class IsGCActiveMark; // Block structured external access to _is_gc_active
101 friend class MemAllocator;
102
103 private:
104 GCHeapLog* _gc_heap_log;
105
106 protected:
107 // Not used by all GCs
108 MemRegion _reserved;
109
110 bool _is_gc_active;
111
112 // Used for filler objects (static, but initialized in ctor).
113 static size_t _filler_array_max_size;
114
115 // Last time the whole heap has been examined in support of RMI
116 // MaxObjectInspectionAge.
117 // This timestamp must be monotonically non-decreasing to avoid
118 // time-warp warnings.
119 jlong _last_whole_heap_examined_time_ns;
120
121 unsigned int _total_collections; // ... started
122 unsigned int _total_full_collections; // ... started
123 NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
124 NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
125
126 // Reason for current garbage collection. Should be set to
127 // a value reflecting no collection between collections.
128 GCCause::Cause _gc_cause;
129 GCCause::Cause _gc_lastcause;
130 PerfStringVariable* _perf_gc_cause;
131 PerfStringVariable* _perf_gc_lastcause;
132
133 // Constructor
134 CollectedHeap();
135
136 // Create a new tlab. All TLAB allocations must go through this.
137 // To allow more flexible TLAB allocations min_size specifies
138 // the minimum size needed, while requested_size is the requested
139 // size based on ergonomics. The actually allocated size will be
140 // returned in actual_size.
393 if (full) {
394 increment_total_full_collections();
395 }
396 }
397
398 void increment_total_full_collections() { _total_full_collections++; }
399
400 // Return the SoftRefPolicy for the heap;
401 virtual SoftRefPolicy* soft_ref_policy() = 0;
402
403 virtual MemoryUsage memory_usage();
404 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
405 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
406
407 // Iterate over all objects, calling "cl.do_object" on each.
408 virtual void object_iterate(ObjectClosure* cl) = 0;
409
410 // Keep alive an object that was loaded with AS_NO_KEEPALIVE.
411 virtual void keep_alive(oop obj) {}
412
413 // Perform any cleanup actions necessary before allowing a verification.
414 virtual void prepare_for_verify() = 0;
415
416 // Returns the longest time (in ms) that has elapsed since the last
417 // time that the whole heap has been examined by a garbage collection.
418 jlong millis_since_last_whole_heap_examined();
419 // GC should call this when the next whole heap analysis has completed to
420 // satisfy above requirement.
421 void record_whole_heap_examined_timestamp();
422
423 private:
424 // Generate any dumps preceding or following a full gc
425 void full_gc_dump(GCTimer* timer, bool before);
426
427 virtual void initialize_serviceability() = 0;
428
429 public:
430 void pre_full_gc_dump(GCTimer* timer);
431 void post_full_gc_dump(GCTimer* timer);
432
433 virtual VirtualSpaceSummary create_heap_space_summary();
434 GCHeapSummary create_heap_summary();
435
436 MetaspaceSummary create_metaspace_summary();
437
438 // Print heap information on the given outputStream.
439 virtual void print_on(outputStream* st) const = 0;
440 // The default behavior is to call print_on() on tty.
441 virtual void print() const;
442
443 // Print more detailed heap information on the given
444 // outputStream. The default behavior is to call print_on(). It is
|