158 inline static void post_allocation_setup_array(KlassHandle klass,
159 HeapWord* obj, int length);
160
161 // Clears an allocated object.
162 inline static void init_obj(HeapWord* obj, size_t size);
163
164 // Filler object utilities.
165 static inline size_t filler_array_hdr_size();
166 static inline size_t filler_array_min_size();
167
168 DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);)
169 DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);)
170
171 // Fill with a single array; caller must ensure filler_array_min_size() <=
172 // words <= filler_array_max_size().
173 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
174
175 // Fill with a single object (either an int array or a java.lang.Object).
176 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
177
178 virtual void trace_heap(GCWhen::Type when, GCTracer* tracer);
179
180 // Verification functions
181 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
182 PRODUCT_RETURN;
183 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
184 PRODUCT_RETURN;
185 debug_only(static void check_for_valid_allocation_state();)
186
187 public:
188 enum Name {
189 Abstract,
190 SharedHeap,
191 GenCollectedHeap,
192 ParallelScavengeHeap,
193 G1CollectedHeap
194 };
195
196 static inline size_t filler_array_max_size() {
197 return _filler_array_max_size;
198 }
589 virtual void print_gc_threads_on(outputStream* st) const = 0;
590 // The default behavior is to call print_gc_threads_on() on tty.
591 void print_gc_threads() {
592 print_gc_threads_on(tty);
593 }
594 // Iterator for all GC threads (other than VM thread)
595 virtual void gc_threads_do(ThreadClosure* tc) const = 0;
596
597 // Print any relevant tracing info that flags imply.
598 // Default implementation does nothing.
599 virtual void print_tracing_info() const = 0;
600
601 void print_heap_before_gc();
602 void print_heap_after_gc();
603
604 // Registering and unregistering an nmethod (compiled code) with the heap.
605 // Override with specific mechanism for each specialized heap type.
606 virtual void register_nmethod(nmethod* nm);
607 virtual void unregister_nmethod(nmethod* nm);
608
609 void trace_heap_before_gc(GCTracer* gc_tracer);
610 void trace_heap_after_gc(GCTracer* gc_tracer);
611
612 // Heap verification
613 virtual void verify(bool silent, VerifyOption option) = 0;
614
615 // Non product verification and debugging.
616 #ifndef PRODUCT
617 // Support for PromotionFailureALot. Return true if it's time to cause a
618 // promotion failure. The no-argument version uses
619 // this->_promotion_failure_alot_count as the counter.
620 inline bool promotion_should_fail(volatile size_t* count);
621 inline bool promotion_should_fail();
622
623 // Reset the PromotionFailureALot counters. Should be called at the end of a
624 // GC in which promotion failure occurred.
625 inline void reset_promotion_should_fail(volatile size_t* count);
626 inline void reset_promotion_should_fail();
627 #endif // #ifndef PRODUCT
628
629 #ifdef ASSERT
630 static int fired_fake_oom() {
|
158 inline static void post_allocation_setup_array(KlassHandle klass,
159 HeapWord* obj, int length);
160
161 // Clears an allocated object.
162 inline static void init_obj(HeapWord* obj, size_t size);
163
164 // Filler object utilities.
165 static inline size_t filler_array_hdr_size();
166 static inline size_t filler_array_min_size();
167
168 DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);)
169 DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);)
170
171 // Fill with a single array; caller must ensure filler_array_min_size() <=
172 // words <= filler_array_max_size().
173 static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
174
175 // Fill with a single object (either an int array or a java.lang.Object).
176 static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
177
178 virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
179
180 // Verification functions
181 virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
182 PRODUCT_RETURN;
183 virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
184 PRODUCT_RETURN;
185 debug_only(static void check_for_valid_allocation_state();)
186
187 public:
188 enum Name {
189 Abstract,
190 SharedHeap,
191 GenCollectedHeap,
192 ParallelScavengeHeap,
193 G1CollectedHeap
194 };
195
196 static inline size_t filler_array_max_size() {
197 return _filler_array_max_size;
198 }
589 virtual void print_gc_threads_on(outputStream* st) const = 0;
590 // The default behavior is to call print_gc_threads_on() on tty.
591 void print_gc_threads() {
592 print_gc_threads_on(tty);
593 }
594 // Iterator for all GC threads (other than VM thread)
595 virtual void gc_threads_do(ThreadClosure* tc) const = 0;
596
597 // Print any relevant tracing info that flags imply.
598 // Default implementation does nothing.
599 virtual void print_tracing_info() const = 0;
600
601 void print_heap_before_gc();
602 void print_heap_after_gc();
603
604 // Registering and unregistering an nmethod (compiled code) with the heap.
605 // Override with specific mechanism for each specialized heap type.
606 virtual void register_nmethod(nmethod* nm);
607 virtual void unregister_nmethod(nmethod* nm);
608
609 void trace_heap_before_gc(const GCTracer* gc_tracer);
610 void trace_heap_after_gc(const GCTracer* gc_tracer);
611
612 // Heap verification
613 virtual void verify(bool silent, VerifyOption option) = 0;
614
615 // Non product verification and debugging.
616 #ifndef PRODUCT
617 // Support for PromotionFailureALot. Return true if it's time to cause a
618 // promotion failure. The no-argument version uses
619 // this->_promotion_failure_alot_count as the counter.
620 inline bool promotion_should_fail(volatile size_t* count);
621 inline bool promotion_should_fail();
622
623 // Reset the PromotionFailureALot counters. Should be called at the end of a
624 // GC in which promotion failure occurred.
625 inline void reset_promotion_should_fail(volatile size_t* count);
626 inline void reset_promotion_should_fail();
627 #endif // #ifndef PRODUCT
628
629 #ifdef ASSERT
630 static int fired_fake_oom() {
|