1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
23 */ |
23 */ |
24 |
24 |
25 #ifndef SHARE_VM_MEMORY_COLLECTORPOLICY_HPP |
25 #ifndef SHARE_VM_MEMORY_COLLECTORPOLICY_HPP |
26 #define SHARE_VM_MEMORY_COLLECTORPOLICY_HPP |
26 #define SHARE_VM_MEMORY_COLLECTORPOLICY_HPP |
27 |
27 |
|
28 #include "memory/allocation.hpp" |
28 #include "memory/barrierSet.hpp" |
29 #include "memory/barrierSet.hpp" |
|
30 #include "memory/generationSpec.hpp" |
29 #include "memory/genRemSet.hpp" |
31 #include "memory/genRemSet.hpp" |
30 #include "memory/permGen.hpp" |
|
31 |
32 |
32 // This class (or more correctly, subtypes of this class) |
33 // This class (or more correctly, subtypes of this class) |
33 // are used to define global garbage collector attributes. |
34 // are used to define global garbage collector attributes. |
34 // This includes initialization of generations and any other |
35 // This includes initialization of generations and any other |
35 // shared resources they may need. |
36 // shared resources they may need. |
51 class ConcurrentMarkSweepPolicy; |
52 class ConcurrentMarkSweepPolicy; |
52 class G1CollectorPolicy; |
53 class G1CollectorPolicy; |
53 #endif // SERIALGC |
54 #endif // SERIALGC |
54 |
55 |
55 class GCPolicyCounters; |
56 class GCPolicyCounters; |
56 class PermanentGenerationSpec; |
|
57 class MarkSweepPolicy; |
57 class MarkSweepPolicy; |
58 |
58 |
59 class CollectorPolicy : public CHeapObj<mtGC> { |
59 class CollectorPolicy : public CHeapObj<mtGC> { |
60 protected: |
60 protected: |
61 PermanentGenerationSpec *_permanent_generation; |
|
62 GCPolicyCounters* _gc_policy_counters; |
61 GCPolicyCounters* _gc_policy_counters; |
63 |
62 |
64 // Requires that the concrete subclass sets the alignment constraints |
63 // Requires that the concrete subclass sets the alignment constraints |
65 // before calling. |
64 // before calling. |
66 virtual void initialize_flags(); |
65 virtual void initialize_flags(); |
67 virtual void initialize_size_info(); |
66 virtual void initialize_size_info(); |
68 // Initialize "_permanent_generation" to a spec for the given kind of |
|
69 // Perm Gen. |
|
70 void initialize_perm_generation(PermGen::Name pgnm); |
|
71 |
67 |
72 size_t _initial_heap_byte_size; |
68 size_t _initial_heap_byte_size; |
73 size_t _max_heap_byte_size; |
69 size_t _max_heap_byte_size; |
74 size_t _min_heap_byte_size; |
70 size_t _min_heap_byte_size; |
75 |
71 |
153 bool is_concurrent_mark_sweep_policy() { return false; } |
149 bool is_concurrent_mark_sweep_policy() { return false; } |
154 bool is_g1_policy() { return false; } |
150 bool is_g1_policy() { return false; } |
155 #endif // SERIALGC |
151 #endif // SERIALGC |
156 |
152 |
157 |
153 |
158 virtual PermanentGenerationSpec *permanent_generation() { |
|
159 assert(_permanent_generation != NULL, "Sanity check"); |
|
160 return _permanent_generation; |
|
161 } |
|
162 |
|
163 virtual BarrierSet::Name barrier_set_name() = 0; |
154 virtual BarrierSet::Name barrier_set_name() = 0; |
164 virtual GenRemSet::Name rem_set_name() = 0; |
155 virtual GenRemSet::Name rem_set_name() = 0; |
165 |
156 |
166 // Create the remembered set (to cover the given reserved region, |
157 // Create the remembered set (to cover the given reserved region, |
167 // allowing breaking up into at most "max_covered_regions"). |
158 // allowing breaking up into at most "max_covered_regions"). |
179 bool* gc_overhead_limit_was_exceeded) = 0; |
170 bool* gc_overhead_limit_was_exceeded) = 0; |
180 |
171 |
181 // This method controls how a collector handles one or more |
172 // This method controls how a collector handles one or more |
182 // of its generations being fully allocated. |
173 // of its generations being fully allocated. |
183 virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0; |
174 virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0; |
|
175 // This method controls how a collector handles a metadata allocation |
|
176 // failure. |
|
177 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, |
|
178 size_t size, |
|
179 Metaspace::MetadataType mdtype); |
|
180 |
184 // Performace Counter support |
181 // Performace Counter support |
185 GCPolicyCounters* counters() { return _gc_policy_counters; } |
182 GCPolicyCounters* counters() { return _gc_policy_counters; } |
186 |
183 |
187 // Create the jstat counters for the GC policy. By default, policy's |
184 // Create the jstat counters for the GC policy. By default, policy's |
188 // don't have associated counters, and we complain if this is invoked. |
185 // don't have associated counters, and we complain if this is invoked. |