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