1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
561 // Iterator for all GC threads (other than VM thread)
562 virtual void gc_threads_do(ThreadClosure* tc) const = 0;
563
564 // Print any relevant tracing info that flags imply.
565 // Default implementation does nothing.
566 virtual void print_tracing_info() const = 0;
567
568 void print_heap_before_gc();
569 void print_heap_after_gc();
570
571 // Registering and unregistering an nmethod (compiled code) with the heap.
572 // Override with specific mechanism for each specialized heap type.
573 virtual void register_nmethod(nmethod* nm);
574 virtual void unregister_nmethod(nmethod* nm);
575
576 void trace_heap_before_gc(const GCTracer* gc_tracer);
577 void trace_heap_after_gc(const GCTracer* gc_tracer);
578
579 // Heap verification
580 virtual void verify(VerifyOption option) = 0;
581
582 // Non product verification and debugging.
583 #ifndef PRODUCT
584 // Support for PromotionFailureALot. Return true if it's time to cause a
585 // promotion failure. The no-argument version uses
586 // this->_promotion_failure_alot_count as the counter.
587 inline bool promotion_should_fail(volatile size_t* count);
588 inline bool promotion_should_fail();
589
590 // Reset the PromotionFailureALot counters. Should be called at the end of a
591 // GC in which promotion failure occurred.
592 inline void reset_promotion_should_fail(volatile size_t* count);
593 inline void reset_promotion_should_fail();
594 #endif // #ifndef PRODUCT
595
596 #ifdef ASSERT
597 static int fired_fake_oom() {
598 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
599 }
600 #endif
|
1 /*
2 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
561 // Iterator for all GC threads (other than VM thread)
562 virtual void gc_threads_do(ThreadClosure* tc) const = 0;
563
564 // Print any relevant tracing info that flags imply.
565 // Default implementation does nothing.
566 virtual void print_tracing_info() const = 0;
567
568 void print_heap_before_gc();
569 void print_heap_after_gc();
570
571 // Registering and unregistering an nmethod (compiled code) with the heap.
572 // Override with specific mechanism for each specialized heap type.
573 virtual void register_nmethod(nmethod* nm);
574 virtual void unregister_nmethod(nmethod* nm);
575
576 void trace_heap_before_gc(const GCTracer* gc_tracer);
577 void trace_heap_after_gc(const GCTracer* gc_tracer);
578
579 // Heap verification
580 virtual void verify(VerifyOption option) = 0;
581
582 // Return true if concurrent phase control (via
583 // request_concurrent_phase_control) is supported by this collector.
584 // The default implementation returns false.
585 virtual bool supports_concurrent_phase_control() const;
586
587 // Return a NULL terminated array of concurrent phase names provided
588 // by this collector. Supports Whitebox testing. These are the
589 // names recognized by request_concurrent_phase(). The default
590 // implementation returns an array of one NULL element.
591 virtual const char* const* concurrent_phases() const;
592
593 // Request the collector enter the indicated concurrent phase, and
594 // wait until it does so. Supports WhiteBox testing. Only one
595 // request may be active at a time. Phases are designated by name;
596 // the set of names and their meaning is GC-specific. Once the
597 // requested phase has been reached, the collector will attempt to
598 // avoid transitioning to a new phase until a new request is made.
599 // [Note: A collector might not be able to remain in a given phase.
600 // For example, a full collection might cancel an in-progress
601 // concurrent collection.]
602 //
603 // Returns true when the phase is reached. Returns false for an
604 // unknown phase. The default implementation returns false.
605 virtual bool request_concurrent_phase(const char* phase);
606
607 // Non product verification and debugging.
608 #ifndef PRODUCT
609 // Support for PromotionFailureALot. Return true if it's time to cause a
610 // promotion failure. The no-argument version uses
611 // this->_promotion_failure_alot_count as the counter.
612 inline bool promotion_should_fail(volatile size_t* count);
613 inline bool promotion_should_fail();
614
615 // Reset the PromotionFailureALot counters. Should be called at the end of a
616 // GC in which promotion failure occurred.
617 inline void reset_promotion_should_fail(volatile size_t* count);
618 inline void reset_promotion_should_fail();
619 #endif // #ifndef PRODUCT
620
621 #ifdef ASSERT
622 static int fired_fake_oom() {
623 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
624 }
625 #endif
|