33 #include "runtime/safepoint.hpp"
34 #include "utilities/debug.hpp"
35 #include "utilities/events.hpp"
36 #include "utilities/formatBuffer.hpp"
37
38 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
39 // is an abstract class: there may be many different kinds of heaps. This
40 // class defines the functions that a heap must implement, and contains
41 // infrastructure common to all heaps.
42
43 class AdaptiveSizePolicy;
44 class BarrierSet;
45 class CollectorPolicy;
46 class GCHeapSummary;
47 class GCTimer;
48 class GCTracer;
49 class MetaspaceSummary;
50 class Thread;
51 class ThreadClosure;
52 class VirtualSpaceSummary;
53 class nmethod;
54
55 class GCMessage : public FormatBuffer<1024> {
56 public:
57 bool is_before;
58
59 public:
60 GCMessage() {}
61 };
62
63 class CollectedHeap;
64
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) {
588
589 // Return a NULL terminated array of concurrent phase names provided
590 // by this collector. Supports Whitebox testing. These are the
591 // names recognized by request_concurrent_phase(). The default
592 // implementation returns an array of one NULL element.
593 virtual const char* const* concurrent_phases() const;
594
595 // Request the collector enter the indicated concurrent phase, and
596 // wait until it does so. Supports WhiteBox testing. Only one
597 // request may be active at a time. Phases are designated by name;
598 // the set of names and their meaning is GC-specific. Once the
599 // requested phase has been reached, the collector will attempt to
600 // avoid transitioning to a new phase until a new request is made.
601 // [Note: A collector might not be able to remain in a given phase.
602 // For example, a full collection might cancel an in-progress
603 // concurrent collection.]
604 //
605 // Returns true when the phase is reached. Returns false for an
606 // unknown phase. The default implementation returns false.
607 virtual bool request_concurrent_phase(const char* phase);
608
609 // Non product verification and debugging.
610 #ifndef PRODUCT
611 // Support for PromotionFailureALot. Return true if it's time to cause a
612 // promotion failure. The no-argument version uses
613 // this->_promotion_failure_alot_count as the counter.
614 inline bool promotion_should_fail(volatile size_t* count);
615 inline bool promotion_should_fail();
616
617 // Reset the PromotionFailureALot counters. Should be called at the end of a
618 // GC in which promotion failure occurred.
619 inline void reset_promotion_should_fail(volatile size_t* count);
620 inline void reset_promotion_should_fail();
621 #endif // #ifndef PRODUCT
622
623 #ifdef ASSERT
624 static int fired_fake_oom() {
625 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
626 }
627 #endif
|
33 #include "runtime/safepoint.hpp"
34 #include "utilities/debug.hpp"
35 #include "utilities/events.hpp"
36 #include "utilities/formatBuffer.hpp"
37
38 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
39 // is an abstract class: there may be many different kinds of heaps. This
40 // class defines the functions that a heap must implement, and contains
41 // infrastructure common to all heaps.
42
43 class AdaptiveSizePolicy;
44 class BarrierSet;
45 class CollectorPolicy;
46 class GCHeapSummary;
47 class GCTimer;
48 class GCTracer;
49 class MetaspaceSummary;
50 class Thread;
51 class ThreadClosure;
52 class VirtualSpaceSummary;
53 class WorkGang;
54 class nmethod;
55
56 class GCMessage : public FormatBuffer<1024> {
57 public:
58 bool is_before;
59
60 public:
61 GCMessage() {}
62 };
63
64 class CollectedHeap;
65
66 class GCHeapLog : public EventLogBase<GCMessage> {
67 private:
68 void log_heap(CollectedHeap* heap, bool before);
69
70 public:
71 GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
72
73 void log_heap_before(CollectedHeap* heap) {
589
590 // Return a NULL terminated array of concurrent phase names provided
591 // by this collector. Supports Whitebox testing. These are the
592 // names recognized by request_concurrent_phase(). The default
593 // implementation returns an array of one NULL element.
594 virtual const char* const* concurrent_phases() const;
595
596 // Request the collector enter the indicated concurrent phase, and
597 // wait until it does so. Supports WhiteBox testing. Only one
598 // request may be active at a time. Phases are designated by name;
599 // the set of names and their meaning is GC-specific. Once the
600 // requested phase has been reached, the collector will attempt to
601 // avoid transitioning to a new phase until a new request is made.
602 // [Note: A collector might not be able to remain in a given phase.
603 // For example, a full collection might cancel an in-progress
604 // concurrent collection.]
605 //
606 // Returns true when the phase is reached. Returns false for an
607 // unknown phase. The default implementation returns false.
608 virtual bool request_concurrent_phase(const char* phase);
609
610 // Provides a thread pool to SafepointSynchronize to use
611 // for parallel safepoint cleanup.
612 // GCs that use a GC worker thread pool may want to share
613 // it for use during safepoint cleanup. This is only possible
614 // if the GC can pause and resume concurrent work (e.g. G1
615 // concurrent marking) for an intermittent non-GC safepoint.
616 // If this method returns NULL, SafepointSynchronize will
617 // perform cleanup tasks serially in the VMThread.
618 virtual WorkGang* get_safepoint_workers() { return NULL; }
619
620 // Non product verification and debugging.
621 #ifndef PRODUCT
622 // Support for PromotionFailureALot. Return true if it's time to cause a
623 // promotion failure. The no-argument version uses
624 // this->_promotion_failure_alot_count as the counter.
625 inline bool promotion_should_fail(volatile size_t* count);
626 inline bool promotion_should_fail();
627
628 // Reset the PromotionFailureALot counters. Should be called at the end of a
629 // GC in which promotion failure occurred.
630 inline void reset_promotion_should_fail(volatile size_t* count);
631 inline void reset_promotion_should_fail();
632 #endif // #ifndef PRODUCT
633
634 #ifdef ASSERT
635 static int fired_fake_oom() {
636 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
637 }
638 #endif
|