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 // Request the collector enter the indicated concurrent phase, and
588 // wait until it does so. Supports WhiteBox testing. Only one
589 // request may be active at a time. Phases are designated by name;
590 // the set of names and their meaning is GC-specific. Once the
591 // requested phase has been reached, the collector will attempt to
592 // avoid transitioning to a new phase until a new request is made.
593 // [Note: A collector might not be able to remain in a given phase.
594 // For example, a full collection might cancel an in-progress
595 // concurrent collection.]
596 //
597 // Returns true when the phase is reached. Returns false for an
598 // unknown phase. The default implementation returns false.
599 virtual bool request_concurrent_phase(const char* phase);
600
601 // Non product verification and debugging.
602 #ifndef PRODUCT
603 // Support for PromotionFailureALot. Return true if it's time to cause a
604 // promotion failure. The no-argument version uses
605 // this->_promotion_failure_alot_count as the counter.
606 inline bool promotion_should_fail(volatile size_t* count);
607 inline bool promotion_should_fail();
608
609 // Reset the PromotionFailureALot counters. Should be called at the end of a
610 // GC in which promotion failure occurred.
611 inline void reset_promotion_should_fail(volatile size_t* count);
612 inline void reset_promotion_should_fail();
613 #endif // #ifndef PRODUCT
614
615 #ifdef ASSERT
616 static int fired_fake_oom() {
617 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
618 }
619 #endif
|