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
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;
|
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
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;
|