72 void log_heap(CollectedHeap* heap, bool before);
73
74 public:
75 GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
76
77 void log_heap_before(CollectedHeap* heap) {
78 log_heap(heap, true);
79 }
80 void log_heap_after(CollectedHeap* heap) {
81 log_heap(heap, false);
82 }
83 };
84
85 //
86 // CollectedHeap
87 // GenCollectedHeap
88 // SerialHeap
89 // CMSHeap
90 // G1CollectedHeap
91 // ParallelScavengeHeap
92 //
93 class CollectedHeap : public CHeapObj<mtInternal> {
94 friend class VMStructs;
95 friend class JVMCIVMStructs;
96 friend class IsGCActiveMark; // Block structured external access to _is_gc_active
97
98 private:
99 #ifdef ASSERT
100 static int _fire_out_of_memory_count;
101 #endif
102
103 GCHeapLog* _gc_heap_log;
104
105 MemRegion _reserved;
106
107 protected:
108 bool _is_gc_active;
109
110 // Used for filler objects (static, but initialized in ctor).
111 static size_t _filler_array_max_size;
179 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
180
181 // Fill with a single object (either an int array or a java.lang.Object).
182 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
183
184 virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
185
186 // Verification functions
187 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
188 PRODUCT_RETURN;
189 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
190 PRODUCT_RETURN;
191 debug_only(static void check_for_valid_allocation_state();)
192
193 public:
194 enum Name {
195 None,
196 Serial,
197 Parallel,
198 CMS,
199 G1
200 };
201
202 static inline size_t filler_array_max_size() {
203 return _filler_array_max_size;
204 }
205
206 virtual Name kind() const = 0;
207
208 virtual const char* name() const = 0;
209
210 /**
211 * Returns JNI error code JNI_ENOMEM if memory could not be allocated,
212 * and JNI_OK on success.
213 */
214 virtual jint initialize() = 0;
215
216 // In many heaps, there will be a need to perform some initialization activities
217 // after the Universe is fully formed, but before general heap allocation is allowed.
218 // This is the correct place to place such initialization methods.
219 virtual void post_initialize();
|
72 void log_heap(CollectedHeap* heap, bool before);
73
74 public:
75 GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
76
77 void log_heap_before(CollectedHeap* heap) {
78 log_heap(heap, true);
79 }
80 void log_heap_after(CollectedHeap* heap) {
81 log_heap(heap, false);
82 }
83 };
84
85 //
86 // CollectedHeap
87 // GenCollectedHeap
88 // SerialHeap
89 // CMSHeap
90 // G1CollectedHeap
91 // ParallelScavengeHeap
92 // ZCollectedHeap
93 //
94 class CollectedHeap : public CHeapObj<mtInternal> {
95 friend class VMStructs;
96 friend class JVMCIVMStructs;
97 friend class IsGCActiveMark; // Block structured external access to _is_gc_active
98
99 private:
100 #ifdef ASSERT
101 static int _fire_out_of_memory_count;
102 #endif
103
104 GCHeapLog* _gc_heap_log;
105
106 MemRegion _reserved;
107
108 protected:
109 bool _is_gc_active;
110
111 // Used for filler objects (static, but initialized in ctor).
112 static size_t _filler_array_max_size;
180 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
181
182 // Fill with a single object (either an int array or a java.lang.Object).
183 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
184
185 virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
186
187 // Verification functions
188 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
189 PRODUCT_RETURN;
190 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
191 PRODUCT_RETURN;
192 debug_only(static void check_for_valid_allocation_state();)
193
194 public:
195 enum Name {
196 None,
197 Serial,
198 Parallel,
199 CMS,
200 G1,
201 Z
202 };
203
204 static inline size_t filler_array_max_size() {
205 return _filler_array_max_size;
206 }
207
208 virtual Name kind() const = 0;
209
210 virtual const char* name() const = 0;
211
212 /**
213 * Returns JNI error code JNI_ENOMEM if memory could not be allocated,
214 * and JNI_OK on success.
215 */
216 virtual jint initialize() = 0;
217
218 // In many heaps, there will be a need to perform some initialization activities
219 // after the Universe is fully formed, but before general heap allocation is allowed.
220 // This is the correct place to place such initialization methods.
221 virtual void post_initialize();
|