author | pliden |
Wed, 28 Mar 2018 11:38:47 +0200 | |
changeset 49628 | 88478047bc8f |
parent 49455 | 848864ed9b17 |
child 49945 | 9425445633cf |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48168
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5343
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5343
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5343
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_HPP |
26 |
#define SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/parallel/generationSizer.hpp" |
29 |
#include "gc/parallel/objectStartArray.hpp" |
|
30 |
#include "gc/parallel/psGCAdaptivePolicyCounters.hpp" |
|
31 |
#include "gc/parallel/psOldGen.hpp" |
|
32 |
#include "gc/parallel/psYoungGen.hpp" |
|
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49389
diff
changeset
|
33 |
#include "gc/shared/cardTableBarrierSet.hpp" |
30764 | 34 |
#include "gc/shared/collectedHeap.hpp" |
35 |
#include "gc/shared/collectorPolicy.hpp" |
|
36 |
#include "gc/shared/gcPolicyCounters.hpp" |
|
37 |
#include "gc/shared/gcWhen.hpp" |
|
49047
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48961
diff
changeset
|
38 |
#include "gc/shared/softRefPolicy.hpp" |
30764 | 39 |
#include "gc/shared/strongRootsScope.hpp" |
35061 | 40 |
#include "memory/metaspace.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
41 |
#include "utilities/growableArray.hpp" |
7397 | 42 |
#include "utilities/ostream.hpp" |
43 |
||
1 | 44 |
class AdjoiningGenerations; |
18025 | 45 |
class GCHeapSummary; |
1 | 46 |
class GCTaskManager; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
47 |
class MemoryManager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
48 |
class MemoryPool; |
18025 | 49 |
class PSAdaptiveSizePolicy; |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
50 |
class PSCardTable; |
18025 | 51 |
class PSHeapSummary; |
1 | 52 |
|
53 |
class ParallelScavengeHeap : public CollectedHeap { |
|
54 |
friend class VMStructs; |
|
55 |
private: |
|
56 |
static PSYoungGen* _young_gen; |
|
57 |
static PSOldGen* _old_gen; |
|
58 |
||
59 |
// Sizing policy for entire heap |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
60 |
static PSAdaptiveSizePolicy* _size_policy; |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
61 |
static PSGCAdaptivePolicyCounters* _gc_policy_counters; |
1 | 62 |
|
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
4637
diff
changeset
|
63 |
GenerationSizer* _collector_policy; |
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
4637
diff
changeset
|
64 |
|
49047
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48961
diff
changeset
|
65 |
SoftRefPolicy _soft_ref_policy; |
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48961
diff
changeset
|
66 |
|
1 | 67 |
// Collection of generations that are adjacent in the |
68 |
// space reserved for the heap. |
|
69 |
AdjoiningGenerations* _gens; |
|
11758
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
70 |
unsigned int _death_march_count; |
1 | 71 |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
72 |
// The task manager |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
73 |
static GCTaskManager* _gc_task_manager; |
1 | 74 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
75 |
GCMemoryManager* _young_manager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
76 |
GCMemoryManager* _old_manager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
77 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
78 |
MemoryPool* _eden_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
79 |
MemoryPool* _survivor_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
80 |
MemoryPool* _old_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
81 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
82 |
virtual void initialize_serviceability(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
83 |
|
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
22552
diff
changeset
|
84 |
void trace_heap(GCWhen::Type when, const GCTracer* tracer); |
18025 | 85 |
|
1 | 86 |
protected: |
87 |
static inline size_t total_invocations(); |
|
88 |
HeapWord* allocate_new_tlab(size_t size); |
|
89 |
||
11758
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
90 |
inline bool should_alloc_in_eden(size_t size) const; |
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
91 |
inline void death_march_check(HeapWord* const result, size_t size); |
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
92 |
HeapWord* mem_allocate_old_gen(size_t size); |
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
93 |
|
1 | 94 |
public: |
30260 | 95 |
ParallelScavengeHeap(GenerationSizer* policy) : |
96 |
CollectedHeap(), _collector_policy(policy), _death_march_count(0) { } |
|
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
18025
diff
changeset
|
97 |
|
1 | 98 |
// For use by VM operations |
99 |
enum CollectionType { |
|
100 |
Scavenge, |
|
101 |
MarkSweep |
|
102 |
}; |
|
103 |
||
29808 | 104 |
virtual Name kind() const { |
49628
88478047bc8f
8199918: Shorten names of CollectedHeap::Name members
pliden
parents:
49455
diff
changeset
|
105 |
return CollectedHeap::Parallel; |
1 | 106 |
} |
107 |
||
35061 | 108 |
virtual const char* name() const { |
109 |
return "Parallel"; |
|
110 |
} |
|
111 |
||
32735
c6063d028c3c
8134797: Remove explicit casts in CollectorPolicy hierarchy
kbarrett
parents:
30764
diff
changeset
|
112 |
virtual CollectorPolicy* collector_policy() const { return _collector_policy; } |
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
4637
diff
changeset
|
113 |
|
49047
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48961
diff
changeset
|
114 |
virtual SoftRefPolicy* soft_ref_policy() { return &_soft_ref_policy; } |
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48961
diff
changeset
|
115 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
116 |
virtual GrowableArray<GCMemoryManager*> memory_managers(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
117 |
virtual GrowableArray<MemoryPool*> memory_pools(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
118 |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
119 |
static PSYoungGen* young_gen() { return _young_gen; } |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
120 |
static PSOldGen* old_gen() { return _old_gen; } |
1 | 121 |
|
122 |
virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; } |
|
123 |
||
124 |
static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; } |
|
125 |
||
126 |
static ParallelScavengeHeap* heap(); |
|
127 |
||
128 |
static GCTaskManager* const gc_task_manager() { return _gc_task_manager; } |
|
129 |
||
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49389
diff
changeset
|
130 |
CardTableBarrierSet* barrier_set(); |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
131 |
PSCardTable* card_table(); |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
132 |
|
1 | 133 |
AdjoiningGenerations* gens() { return _gens; } |
134 |
||
135 |
// Returns JNI_OK on success |
|
136 |
virtual jint initialize(); |
|
137 |
||
138 |
void post_initialize(); |
|
139 |
void update_counters(); |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
140 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
141 |
// The alignment used for the various areas |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
142 |
size_t space_alignment() { return _collector_policy->space_alignment(); } |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
143 |
size_t generation_alignment() { return _collector_policy->gen_alignment(); } |
1 | 144 |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
145 |
// Return the (conservative) maximum heap alignment |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
146 |
static size_t conservative_max_heap_alignment() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
147 |
return CollectorPolicy::compute_heap_alignment(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
148 |
} |
1 | 149 |
|
150 |
size_t capacity() const; |
|
151 |
size_t used() const; |
|
152 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
153 |
// Return "true" if all generations have reached the |
1 | 154 |
// maximal committed limit that they can reach, without a garbage |
155 |
// collection. |
|
156 |
virtual bool is_maximal_no_gc() const; |
|
157 |
||
9935
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
158 |
// Return true if the reference points to an object that |
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
159 |
// can be moved in a partial collection. For currently implemented |
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
160 |
// generational collectors that means during a collection of |
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
161 |
// the young gen. |
47624
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
162 |
virtual bool is_scavengable(oop obj); |
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
163 |
virtual void register_nmethod(nmethod* nm); |
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
164 |
virtual void verify_nmethod(nmethod* nmethod); |
9935
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
165 |
|
1 | 166 |
size_t max_capacity() const; |
167 |
||
168 |
// Whether p is in the allocated part of the heap |
|
169 |
bool is_in(const void* p) const; |
|
170 |
||
171 |
bool is_in_reserved(const void* p) const; |
|
172 |
||
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
173 |
bool is_in_young(oop p); // reserved part |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
174 |
bool is_in_old(oop p); // reserved part |
1 | 175 |
|
176 |
// Memory allocation. "gc_time_limit_was_exceeded" will |
|
177 |
// be set to true if the adaptive size policy determine that |
|
178 |
// an excessive amount of time is being spent doing collections |
|
179 |
// and caused a NULL to be returned. If a NULL is not returned, |
|
180 |
// "gc_time_limit_was_exceeded" has an undefined meaning. |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
181 |
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded); |
1 | 182 |
|
9997
b75b7939f448
6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
tonyp
parents:
9995
diff
changeset
|
183 |
// Allocation attempt(s) during a safepoint. It should never be called |
b75b7939f448
6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
tonyp
parents:
9995
diff
changeset
|
184 |
// to allocate a new TLAB as this allocation might be satisfied out |
b75b7939f448
6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
tonyp
parents:
9995
diff
changeset
|
185 |
// of the old generation. |
b75b7939f448
6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
tonyp
parents:
9995
diff
changeset
|
186 |
HeapWord* failed_mem_allocate(size_t size); |
1 | 187 |
|
188 |
// Support for System.gc() |
|
189 |
void collect(GCCause::Cause cause); |
|
190 |
||
191 |
// These also should be called by the vm thread at a safepoint (e.g., from a |
|
192 |
// VM operation). |
|
193 |
// |
|
194 |
// The first collects the young generation only, unless the scavenge fails; it |
|
195 |
// will then attempt a full gc. The second collects the entire heap; if |
|
196 |
// maximum_compaction is true, it will compact everything and clear all soft |
|
197 |
// references. |
|
198 |
inline void invoke_scavenge(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
199 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
200 |
// Perform a full collection |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
201 |
virtual void do_full_collection(bool clear_all_soft_refs); |
1 | 202 |
|
203 |
bool supports_inline_contig_alloc() const { return !UseNUMA; } |
|
388 | 204 |
|
41283
2615c024f3eb
8033552: Fix missing missing volatile specifiers in CAS operations in GC code
eosterlund
parents:
35061
diff
changeset
|
205 |
HeapWord* volatile* top_addr() const { return !UseNUMA ? young_gen()->top_addr() : (HeapWord* volatile*)-1; } |
388 | 206 |
HeapWord** end_addr() const { return !UseNUMA ? young_gen()->end_addr() : (HeapWord**)-1; } |
1 | 207 |
|
208 |
void ensure_parsability(bool retire_tlabs); |
|
209 |
void accumulate_statistics_all_tlabs(); |
|
210 |
void resize_all_tlabs(); |
|
211 |
||
212 |
bool supports_tlab_allocation() const { return true; } |
|
213 |
||
214 |
size_t tlab_capacity(Thread* thr) const; |
|
22552 | 215 |
size_t tlab_used(Thread* thr) const; |
1 | 216 |
size_t unsafe_max_tlab_alloc(Thread* thr) const; |
217 |
||
218 |
void object_iterate(ObjectClosure* cl); |
|
1893
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
1388
diff
changeset
|
219 |
void safe_object_iterate(ObjectClosure* cl) { object_iterate(cl); } |
1 | 220 |
|
221 |
HeapWord* block_start(const void* addr) const; |
|
222 |
size_t block_size(const HeapWord* addr) const; |
|
223 |
bool block_is_obj(const HeapWord* addr) const; |
|
224 |
||
225 |
jlong millis_since_last_gc(); |
|
226 |
||
227 |
void prepare_for_verify(); |
|
18025 | 228 |
PSHeapSummary create_ps_heap_summary(); |
10997
0be4b3be7197
7099849: G1: include heap region information in hs_err files
tonyp
parents:
9997
diff
changeset
|
229 |
virtual void print_on(outputStream* st) const; |
16685
41c34debcde0
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
13728
diff
changeset
|
230 |
virtual void print_on_error(outputStream* st) const; |
1 | 231 |
virtual void print_gc_threads_on(outputStream* st) const; |
232 |
virtual void gc_threads_do(ThreadClosure* tc) const; |
|
233 |
virtual void print_tracing_info() const; |
|
234 |
||
35061 | 235 |
void verify(VerifyOption option /* ignored */); |
1 | 236 |
|
237 |
// Resize the young generation. The reserved space for the |
|
238 |
// generation may be expanded in preparation for the resize. |
|
239 |
void resize_young_gen(size_t eden_size, size_t survivor_size); |
|
240 |
||
241 |
// Resize the old generation. The reserved space for the |
|
242 |
// generation may be expanded in preparation for the resize. |
|
243 |
void resize_old_gen(size_t desired_free_space); |
|
971
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
244 |
|
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
245 |
// Save the tops of the spaces in all generations |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
246 |
void record_gen_tops_before_GC() PRODUCT_RETURN; |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
247 |
|
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
248 |
// Mangle the unused parts of all spaces in the heap |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
249 |
void gen_mangle_unused_area() PRODUCT_RETURN; |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
250 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
251 |
// Call these in sequential code around the processing of strong roots. |
30153
596ed88949ad
8076289: Move the StrongRootsScope out of SharedHeap
brutisso
parents:
30152
diff
changeset
|
252 |
class ParStrongRootsScope : public MarkScope { |
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
253 |
public: |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
254 |
ParStrongRootsScope(); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
255 |
~ParStrongRootsScope(); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
256 |
}; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
257 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
258 |
GCMemoryManager* old_gc_manager() const { return _old_manager; } |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
259 |
GCMemoryManager* young_gc_manager() const { return _young_manager; } |
1 | 260 |
}; |
261 |
||
35061 | 262 |
// Simple class for storing info about the heap at the start of GC, to be used |
263 |
// after GC for comparison/printing. |
|
264 |
class PreGCValues { |
|
265 |
public: |
|
266 |
PreGCValues(ParallelScavengeHeap* heap) : |
|
267 |
_heap_used(heap->used()), |
|
268 |
_young_gen_used(heap->young_gen()->used_in_bytes()), |
|
269 |
_old_gen_used(heap->old_gen()->used_in_bytes()), |
|
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49164
diff
changeset
|
270 |
_metadata_used(MetaspaceUtils::used_bytes()) { }; |
35061 | 271 |
|
272 |
size_t heap_used() const { return _heap_used; } |
|
273 |
size_t young_gen_used() const { return _young_gen_used; } |
|
274 |
size_t old_gen_used() const { return _old_gen_used; } |
|
275 |
size_t metadata_used() const { return _metadata_used; } |
|
276 |
||
277 |
private: |
|
278 |
size_t _heap_used; |
|
279 |
size_t _young_gen_used; |
|
280 |
size_t _old_gen_used; |
|
281 |
size_t _metadata_used; |
|
282 |
}; |
|
283 |
||
46657
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
284 |
// Class that can be used to print information about the |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
285 |
// adaptive size policy at intervals specified by |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
286 |
// AdaptiveSizePolicyOutputInterval. Only print information |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
287 |
// if an adaptive size policy is in use. |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
288 |
class AdaptiveSizePolicyOutput : AllStatic { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
289 |
static bool enabled() { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
290 |
return UseParallelGC && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
291 |
UseAdaptiveSizePolicy && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
292 |
log_is_enabled(Debug, gc, ergo); |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
293 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
294 |
public: |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
295 |
static void print() { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
296 |
if (enabled()) { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
297 |
ParallelScavengeHeap::heap()->size_policy()->print(); |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
298 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
299 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
300 |
|
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
301 |
static void print(AdaptiveSizePolicy* size_policy, uint count) { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
302 |
bool do_print = |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
303 |
enabled() && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
304 |
(AdaptiveSizePolicyOutputInterval > 0) && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
305 |
(count % AdaptiveSizePolicyOutputInterval) == 0; |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
306 |
|
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
307 |
if (do_print) { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
308 |
size_policy->print(); |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
309 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
310 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
311 |
}; |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
312 |
|
30764 | 313 |
#endif // SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_HPP |