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;
189 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
190
191 // Fill with a single object (either an int array or a java.lang.Object).
192 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
193
194 virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
195
196 // Verification functions
197 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
198 PRODUCT_RETURN;
199 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
200 PRODUCT_RETURN;
201 debug_only(static void check_for_valid_allocation_state();)
202
203 public:
204 enum Name {
205 None,
206 Serial,
207 Parallel,
208 CMS,
209 G1
210 };
211
212 static inline size_t filler_array_max_size() {
213 return _filler_array_max_size;
214 }
215
216 virtual Name kind() const = 0;
217
218 virtual const char* name() const = 0;
219
220 /**
221 * Returns JNI error code JNI_ENOMEM if memory could not be allocated,
222 * and JNI_OK on success.
223 */
224 virtual jint initialize() = 0;
225
226 // In many heaps, there will be a need to perform some initialization activities
227 // after the Universe is fully formed, but before general heap allocation is allowed.
228 // This is the correct place to place such initialization methods.
229 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;
190 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
191
192 // Fill with a single object (either an int array or a java.lang.Object).
193 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
194
195 virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
196
197 // Verification functions
198 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
199 PRODUCT_RETURN;
200 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
201 PRODUCT_RETURN;
202 debug_only(static void check_for_valid_allocation_state();)
203
204 public:
205 enum Name {
206 None,
207 Serial,
208 Parallel,
209 CMS,
210 G1,
211 Z
212 };
213
214 static inline size_t filler_array_max_size() {
215 return _filler_array_max_size;
216 }
217
218 virtual Name kind() const = 0;
219
220 virtual const char* name() const = 0;
221
222 /**
223 * Returns JNI error code JNI_ENOMEM if memory could not be allocated,
224 * and JNI_OK on success.
225 */
226 virtual jint initialize() = 0;
227
228 // In many heaps, there will be a need to perform some initialization activities
229 // after the Universe is fully formed, but before general heap allocation is allowed.
230 // This is the correct place to place such initialization methods.
231 virtual void post_initialize();
|