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 in ns.
117 jlong _last_whole_heap_examined_time_ns;
118
119 unsigned int _total_collections; // ... started
120 unsigned int _total_full_collections; // ... started
121 NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
122 NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
123
124 // Reason for current garbage collection. Should be set to
125 // a value reflecting no collection between collections.
126 GCCause::Cause _gc_cause;
127 GCCause::Cause _gc_lastcause;
128 PerfStringVariable* _perf_gc_cause;
129 PerfStringVariable* _perf_gc_lastcause;
130
131 // Constructor
132 CollectedHeap();
133
134 // Create a new tlab. All TLAB allocations must go through this.
135 // To allow more flexible TLAB allocations min_size specifies
136 // the minimum size needed, while requested_size is the requested
137 // size based on ergonomics. The actually allocated size will be
138 // returned in actual_size.
391 if (full) {
392 increment_total_full_collections();
393 }
394 }
395
396 void increment_total_full_collections() { _total_full_collections++; }
397
398 // Return the SoftRefPolicy for the heap;
399 virtual SoftRefPolicy* soft_ref_policy() = 0;
400
401 virtual MemoryUsage memory_usage();
402 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
403 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
404
405 // Iterate over all objects, calling "cl.do_object" on each.
406 virtual void object_iterate(ObjectClosure* cl) = 0;
407
408 // Keep alive an object that was loaded with AS_NO_KEEPALIVE.
409 virtual void keep_alive(oop obj) {}
410
411 // Perform any cleanup actions necessary before allowing a verification.
412 virtual void prepare_for_verify() = 0;
413
414 // Returns the longest time (in ms) that has elapsed since the last
415 // time that any part of the heap was examined by a garbage collection.
416 jlong millis_since_last_whole_heap_examined();
417 // GC should call this when the next whole heap analysis has completed to
418 // satisfy above requirement.
419 void next_whole_heap_examined();
420
421 private:
422 // Generate any dumps preceding or following a full gc
423 void full_gc_dump(GCTimer* timer, bool before);
424
425 virtual void initialize_serviceability() = 0;
426
427 public:
428 void pre_full_gc_dump(GCTimer* timer);
429 void post_full_gc_dump(GCTimer* timer);
430
431 virtual VirtualSpaceSummary create_heap_space_summary();
432 GCHeapSummary create_heap_summary();
433
434 MetaspaceSummary create_metaspace_summary();
435
436 // Print heap information on the given outputStream.
437 virtual void print_on(outputStream* st) const = 0;
438 // The default behavior is to call print_on() on tty.
439 virtual void print() const;
440
441 // Print more detailed heap information on the given
442 // outputStream. The default behavior is to call print_on(). It is
|