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 *
23 */
24
25 #ifndef SHARE_VM_GC_SHARED_COLLECTEDHEAP_HPP
26 #define SHARE_VM_GC_SHARED_COLLECTEDHEAP_HPP
27
28 #include "gc/shared/gcCause.hpp"
29 #include "gc/shared/gcWhen.hpp"
30 #include "memory/allocation.hpp"
31 #include "runtime/handles.hpp"
32 #include "runtime/perfData.hpp"
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);
467 // collector -- dld).
468 bool is_gc_active() const { return _is_gc_active; }
469
470 // Total number of GC collections (started)
471 unsigned int total_collections() const { return _total_collections; }
472 unsigned int total_full_collections() const { return _total_full_collections;}
473
474 // Increment total number of GC collections (started)
475 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
476 void increment_total_collections(bool full = false) {
477 _total_collections++;
478 if (full) {
479 increment_total_full_collections();
480 }
481 }
482
483 void increment_total_full_collections() { _total_full_collections++; }
484
485 // Return the CollectorPolicy for the heap
486 virtual CollectorPolicy* collector_policy() const = 0;
487
488 // Iterate over all objects, calling "cl.do_object" on each.
489 virtual void object_iterate(ObjectClosure* cl) = 0;
490
491 // Similar to object_iterate() except iterates only
492 // over live objects.
493 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
494
495 // NOTE! There is no requirement that a collector implement these
496 // functions.
497 //
498 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
499 // each address in the (reserved) heap is a member of exactly
500 // one block. The defining characteristic of a block is that it is
501 // possible to find its size, and thus to progress forward to the next
502 // block. (Blocks may be of different sizes.) Thus, blocks may
503 // represent Java objects, or they might be free blocks in a
504 // free-list-based heap (or subheap), as long as the two kinds are
505 // distinguishable and the size of each is determinable.
506
|
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 *
23 */
24
25 #ifndef SHARE_VM_GC_SHARED_COLLECTEDHEAP_HPP
26 #define SHARE_VM_GC_SHARED_COLLECTEDHEAP_HPP
27
28 #include "gc/shared/gcCause.hpp"
29 #include "gc/shared/gcWhen.hpp"
30 #include "memory/allocation.hpp"
31 #include "runtime/handles.hpp"
32 #include "runtime/perfData.hpp"
33 #include "runtime/safepoint.hpp"
34 #include "utilities/debug.hpp"
35 #include "utilities/events.hpp"
36 #include "utilities/formatBuffer.hpp"
37 #include "utilities/growableArray.hpp"
38
39 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
40 // is an abstract class: there may be many different kinds of heaps. This
41 // class defines the functions that a heap must implement, and contains
42 // infrastructure common to all heaps.
43
44 class AdaptiveSizePolicy;
45 class BarrierSet;
46 class CollectorPolicy;
47 class GCHeapSummary;
48 class GCTimer;
49 class GCTracer;
50 class GCMemoryManager;
51 class MemoryPool;
52 class MetaspaceSummary;
53 class Thread;
54 class ThreadClosure;
55 class VirtualSpaceSummary;
56 class WorkGang;
57 class nmethod;
58
59 class GCMessage : public FormatBuffer<1024> {
60 public:
61 bool is_before;
62
63 public:
64 GCMessage() {}
65 };
66
67 class CollectedHeap;
68
69 class GCHeapLog : public EventLogBase<GCMessage> {
70 private:
71 void log_heap(CollectedHeap* heap, bool before);
470 // collector -- dld).
471 bool is_gc_active() const { return _is_gc_active; }
472
473 // Total number of GC collections (started)
474 unsigned int total_collections() const { return _total_collections; }
475 unsigned int total_full_collections() const { return _total_full_collections;}
476
477 // Increment total number of GC collections (started)
478 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
479 void increment_total_collections(bool full = false) {
480 _total_collections++;
481 if (full) {
482 increment_total_full_collections();
483 }
484 }
485
486 void increment_total_full_collections() { _total_full_collections++; }
487
488 // Return the CollectorPolicy for the heap
489 virtual CollectorPolicy* collector_policy() const = 0;
490
491 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
492 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
493
494 // Iterate over all objects, calling "cl.do_object" on each.
495 virtual void object_iterate(ObjectClosure* cl) = 0;
496
497 // Similar to object_iterate() except iterates only
498 // over live objects.
499 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
500
501 // NOTE! There is no requirement that a collector implement these
502 // functions.
503 //
504 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
505 // each address in the (reserved) heap is a member of exactly
506 // one block. The defining characteristic of a block is that it is
507 // possible to find its size, and thus to progress forward to the next
508 // block. (Blocks may be of different sizes.) Thus, blocks may
509 // represent Java objects, or they might be free blocks in a
510 // free-list-based heap (or subheap), as long as the two kinds are
511 // distinguishable and the size of each is determinable.
512
|