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);
72
425 // collector -- dld).
426 bool is_gc_active() const { return _is_gc_active; }
427
428 // Total number of GC collections (started)
429 unsigned int total_collections() const { return _total_collections; }
430 unsigned int total_full_collections() const { return _total_full_collections;}
431
432 // Increment total number of GC collections (started)
433 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
434 void increment_total_collections(bool full = false) {
435 _total_collections++;
436 if (full) {
437 increment_total_full_collections();
438 }
439 }
440
441 void increment_total_full_collections() { _total_full_collections++; }
442
443 // Return the CollectorPolicy for the heap
444 virtual CollectorPolicy* collector_policy() const = 0;
445
446 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
447 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
448
449 // Iterate over all objects, calling "cl.do_object" on each.
450 virtual void object_iterate(ObjectClosure* cl) = 0;
451
452 // Similar to object_iterate() except iterates only
453 // over live objects.
454 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
455
456 // NOTE! There is no requirement that a collector implement these
457 // functions.
458 //
459 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
460 // each address in the (reserved) heap is a member of exactly
461 // one block. The defining characteristic of a block is that it is
462 // possible to find its size, and thus to progress forward to the next
463 // block. (Blocks may be of different sizes.) Thus, blocks may
464 // represent Java objects, or they might be free blocks in a
|
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 SoftRefPolicy;
54 class Thread;
55 class ThreadClosure;
56 class VirtualSpaceSummary;
57 class WorkGang;
58 class nmethod;
59
60 class GCMessage : public FormatBuffer<1024> {
61 public:
62 bool is_before;
63
64 public:
65 GCMessage() {}
66 };
67
68 class CollectedHeap;
69
70 class GCHeapLog : public EventLogBase<GCMessage> {
71 private:
72 void log_heap(CollectedHeap* heap, bool before);
73
426 // collector -- dld).
427 bool is_gc_active() const { return _is_gc_active; }
428
429 // Total number of GC collections (started)
430 unsigned int total_collections() const { return _total_collections; }
431 unsigned int total_full_collections() const { return _total_full_collections;}
432
433 // Increment total number of GC collections (started)
434 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
435 void increment_total_collections(bool full = false) {
436 _total_collections++;
437 if (full) {
438 increment_total_full_collections();
439 }
440 }
441
442 void increment_total_full_collections() { _total_full_collections++; }
443
444 // Return the CollectorPolicy for the heap
445 virtual CollectorPolicy* collector_policy() const = 0;
446
447 // Return the SoftRefPolicy for the heap;
448 virtual SoftRefPolicy* soft_ref_policy() = 0;
449
450 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
451 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
452
453 // Iterate over all objects, calling "cl.do_object" on each.
454 virtual void object_iterate(ObjectClosure* cl) = 0;
455
456 // Similar to object_iterate() except iterates only
457 // over live objects.
458 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
459
460 // NOTE! There is no requirement that a collector implement these
461 // functions.
462 //
463 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
464 // each address in the (reserved) heap is a member of exactly
465 // one block. The defining characteristic of a block is that it is
466 // possible to find its size, and thus to progress forward to the next
467 // block. (Blocks may be of different sizes.) Thus, blocks may
468 // represent Java objects, or they might be free blocks in a
|