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 *
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 SoftRefPolicy;
406 unsigned int total_collections() const { return _total_collections; }
407 unsigned int total_full_collections() const { return _total_full_collections;}
408
409 // Increment total number of GC collections (started)
410 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
411 void increment_total_collections(bool full = false) {
412 _total_collections++;
413 if (full) {
414 increment_total_full_collections();
415 }
416 }
417
418 void increment_total_full_collections() { _total_full_collections++; }
419
420 // Return the CollectorPolicy for the heap
421 virtual CollectorPolicy* collector_policy() const = 0;
422
423 // Return the SoftRefPolicy for the heap;
424 virtual SoftRefPolicy* soft_ref_policy() = 0;
425
426 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
427 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
428
429 // Iterate over all objects, calling "cl.do_object" on each.
430 virtual void object_iterate(ObjectClosure* cl) = 0;
431
432 // Similar to object_iterate() except iterates only
433 // over live objects.
434 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
435
436 // NOTE! There is no requirement that a collector implement these
437 // functions.
438 //
439 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
440 // each address in the (reserved) heap is a member of exactly
441 // one block. The defining characteristic of a block is that it is
442 // possible to find its size, and thus to progress forward to the next
443 // block. (Blocks may be of different sizes.) Thus, blocks may
444 // represent Java objects, or they might be free blocks in a
445 // free-list-based heap (or subheap), as long as the two kinds are
|
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 *
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 "services/memoryUsage.hpp"
35 #include "utilities/debug.hpp"
36 #include "utilities/events.hpp"
37 #include "utilities/formatBuffer.hpp"
38 #include "utilities/growableArray.hpp"
39
40 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
41 // is an abstract class: there may be many different kinds of heaps. This
42 // class defines the functions that a heap must implement, and contains
43 // infrastructure common to all heaps.
44
45 class AdaptiveSizePolicy;
46 class BarrierSet;
47 class CollectorPolicy;
48 class GCHeapSummary;
49 class GCTimer;
50 class GCTracer;
51 class GCMemoryManager;
52 class MemoryPool;
53 class MetaspaceSummary;
54 class SoftRefPolicy;
407 unsigned int total_collections() const { return _total_collections; }
408 unsigned int total_full_collections() const { return _total_full_collections;}
409
410 // Increment total number of GC collections (started)
411 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
412 void increment_total_collections(bool full = false) {
413 _total_collections++;
414 if (full) {
415 increment_total_full_collections();
416 }
417 }
418
419 void increment_total_full_collections() { _total_full_collections++; }
420
421 // Return the CollectorPolicy for the heap
422 virtual CollectorPolicy* collector_policy() const = 0;
423
424 // Return the SoftRefPolicy for the heap;
425 virtual SoftRefPolicy* soft_ref_policy() = 0;
426
427 virtual MemoryUsage memory_usage();
428 virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
429 virtual GrowableArray<MemoryPool*> memory_pools() = 0;
430
431 // Iterate over all objects, calling "cl.do_object" on each.
432 virtual void object_iterate(ObjectClosure* cl) = 0;
433
434 // Similar to object_iterate() except iterates only
435 // over live objects.
436 virtual void safe_object_iterate(ObjectClosure* cl) = 0;
437
438 // NOTE! There is no requirement that a collector implement these
439 // functions.
440 //
441 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
442 // each address in the (reserved) heap is a member of exactly
443 // one block. The defining characteristic of a block is that it is
444 // possible to find its size, and thus to progress forward to the next
445 // block. (Blocks may be of different sizes.) Thus, blocks may
446 // represent Java objects, or they might be free blocks in a
447 // free-list-based heap (or subheap), as long as the two kinds are
|