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