author | ihse |
Tue, 13 Feb 2018 10:37:33 +0100 | |
branch | ihse-remove-mapfiles-branch |
changeset 56106 | 40e61db323c2 |
parent 48168 | cb5d2d4453d0 |
child 48961 | 120b61d50f85 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
2 |
* Copyright (c) 2001, 2017, 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" |
|
33 |
#include "gc/shared/collectedHeap.hpp" |
|
34 |
#include "gc/shared/collectorPolicy.hpp" |
|
35 |
#include "gc/shared/gcPolicyCounters.hpp" |
|
36 |
#include "gc/shared/gcWhen.hpp" |
|
37 |
#include "gc/shared/strongRootsScope.hpp" |
|
35061 | 38 |
#include "memory/metaspace.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
39 |
#include "utilities/growableArray.hpp" |
7397 | 40 |
#include "utilities/ostream.hpp" |
41 |
||
1 | 42 |
class AdjoiningGenerations; |
18025 | 43 |
class GCHeapSummary; |
1 | 44 |
class GCTaskManager; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
45 |
class MemoryManager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
46 |
class MemoryPool; |
18025 | 47 |
class PSAdaptiveSizePolicy; |
48 |
class PSHeapSummary; |
|
1 | 49 |
|
50 |
class ParallelScavengeHeap : public CollectedHeap { |
|
51 |
friend class VMStructs; |
|
52 |
private: |
|
53 |
static PSYoungGen* _young_gen; |
|
54 |
static PSOldGen* _old_gen; |
|
55 |
||
56 |
// Sizing policy for entire heap |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
57 |
static PSAdaptiveSizePolicy* _size_policy; |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
58 |
static PSGCAdaptivePolicyCounters* _gc_policy_counters; |
1 | 59 |
|
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
4637
diff
changeset
|
60 |
GenerationSizer* _collector_policy; |
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
4637
diff
changeset
|
61 |
|
1 | 62 |
// Collection of generations that are adjacent in the |
63 |
// space reserved for the heap. |
|
64 |
AdjoiningGenerations* _gens; |
|
11758
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
65 |
unsigned int _death_march_count; |
1 | 66 |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
67 |
// The task manager |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
68 |
static GCTaskManager* _gc_task_manager; |
1 | 69 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
70 |
GCMemoryManager* _young_manager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
71 |
GCMemoryManager* _old_manager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
72 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
73 |
MemoryPool* _eden_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
74 |
MemoryPool* _survivor_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
75 |
MemoryPool* _old_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
76 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
77 |
virtual void initialize_serviceability(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
78 |
|
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
22552
diff
changeset
|
79 |
void trace_heap(GCWhen::Type when, const GCTracer* tracer); |
18025 | 80 |
|
1 | 81 |
protected: |
82 |
static inline size_t total_invocations(); |
|
83 |
HeapWord* allocate_new_tlab(size_t size); |
|
84 |
||
11758
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
85 |
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
|
86 |
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
|
87 |
HeapWord* mem_allocate_old_gen(size_t size); |
b1a0089f89d2
6330863: vm/gc/InfiniteList.java fails intermittently due to timeout
jcoomes
parents:
10997
diff
changeset
|
88 |
|
1 | 89 |
public: |
30260 | 90 |
ParallelScavengeHeap(GenerationSizer* policy) : |
91 |
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
|
92 |
|
1 | 93 |
// For use by VM operations |
94 |
enum CollectionType { |
|
95 |
Scavenge, |
|
96 |
MarkSweep |
|
97 |
}; |
|
98 |
||
29808 | 99 |
virtual Name kind() const { |
1 | 100 |
return CollectedHeap::ParallelScavengeHeap; |
101 |
} |
|
102 |
||
35061 | 103 |
virtual const char* name() const { |
104 |
return "Parallel"; |
|
105 |
} |
|
106 |
||
32735
c6063d028c3c
8134797: Remove explicit casts in CollectorPolicy hierarchy
kbarrett
parents:
30764
diff
changeset
|
107 |
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
|
108 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
109 |
virtual GrowableArray<GCMemoryManager*> memory_managers(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
110 |
virtual GrowableArray<MemoryPool*> memory_pools(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
111 |
|
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
112 |
static PSYoungGen* young_gen() { return _young_gen; } |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
113 |
static PSOldGen* old_gen() { return _old_gen; } |
1 | 114 |
|
115 |
virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; } |
|
116 |
||
117 |
static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; } |
|
118 |
||
119 |
static ParallelScavengeHeap* heap(); |
|
120 |
||
121 |
static GCTaskManager* const gc_task_manager() { return _gc_task_manager; } |
|
122 |
||
123 |
AdjoiningGenerations* gens() { return _gens; } |
|
124 |
||
125 |
// Returns JNI_OK on success |
|
126 |
virtual jint initialize(); |
|
127 |
||
128 |
void post_initialize(); |
|
129 |
void update_counters(); |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
130 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
131 |
// The alignment used for the various areas |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
132 |
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
|
133 |
size_t generation_alignment() { return _collector_policy->gen_alignment(); } |
1 | 134 |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
135 |
// Return the (conservative) maximum heap alignment |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
136 |
static size_t conservative_max_heap_alignment() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
137 |
return CollectorPolicy::compute_heap_alignment(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21560
diff
changeset
|
138 |
} |
1 | 139 |
|
140 |
size_t capacity() const; |
|
141 |
size_t used() const; |
|
142 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
143 |
// Return "true" if all generations have reached the |
1 | 144 |
// maximal committed limit that they can reach, without a garbage |
145 |
// collection. |
|
146 |
virtual bool is_maximal_no_gc() const; |
|
147 |
||
9935
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
148 |
// 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
|
149 |
// 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
|
150 |
// generational collectors that means during a collection of |
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
151 |
// the young gen. |
47624
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
152 |
virtual bool is_scavengable(oop obj); |
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
153 |
virtual void register_nmethod(nmethod* nm); |
b055cb5170f5
8185141: Generalize scavengeable nmethod root handling
eosterlund
parents:
47216
diff
changeset
|
154 |
virtual void verify_nmethod(nmethod* nmethod); |
9935
51267b5e1a3d
7041789: 30% perf regression with c2/arm following 7017732
jmasa
parents:
7397
diff
changeset
|
155 |
|
1 | 156 |
size_t max_capacity() const; |
157 |
||
158 |
// Whether p is in the allocated part of the heap |
|
159 |
bool is_in(const void* p) const; |
|
160 |
||
161 |
bool is_in_reserved(const void* p) const; |
|
162 |
||
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
163 |
bool is_in_young(oop p); // reserved part |
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
164 |
bool is_in_old(oop p); // reserved part |
1 | 165 |
|
166 |
// Memory allocation. "gc_time_limit_was_exceeded" will |
|
167 |
// be set to true if the adaptive size policy determine that |
|
168 |
// an excessive amount of time is being spent doing collections |
|
169 |
// and caused a NULL to be returned. If a NULL is not returned, |
|
170 |
// "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
|
171 |
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded); |
1 | 172 |
|
9997
b75b7939f448
6994322: Remove the is_tlab and is_noref / is_large_noref parameters from the CollectedHeap
tonyp
parents:
9995
diff
changeset
|
173 |
// 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
|
174 |
// 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
|
175 |
// 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
|
176 |
HeapWord* failed_mem_allocate(size_t size); |
1 | 177 |
|
178 |
// Support for System.gc() |
|
179 |
void collect(GCCause::Cause cause); |
|
180 |
||
181 |
// These also should be called by the vm thread at a safepoint (e.g., from a |
|
182 |
// VM operation). |
|
183 |
// |
|
184 |
// The first collects the young generation only, unless the scavenge fails; it |
|
185 |
// will then attempt a full gc. The second collects the entire heap; if |
|
186 |
// maximum_compaction is true, it will compact everything and clear all soft |
|
187 |
// references. |
|
188 |
inline void invoke_scavenge(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
189 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
190 |
// Perform a full collection |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
191 |
virtual void do_full_collection(bool clear_all_soft_refs); |
1 | 192 |
|
193 |
bool supports_inline_contig_alloc() const { return !UseNUMA; } |
|
388 | 194 |
|
41283
2615c024f3eb
8033552: Fix missing missing volatile specifiers in CAS operations in GC code
eosterlund
parents:
35061
diff
changeset
|
195 |
HeapWord* volatile* top_addr() const { return !UseNUMA ? young_gen()->top_addr() : (HeapWord* volatile*)-1; } |
388 | 196 |
HeapWord** end_addr() const { return !UseNUMA ? young_gen()->end_addr() : (HeapWord**)-1; } |
1 | 197 |
|
198 |
void ensure_parsability(bool retire_tlabs); |
|
199 |
void accumulate_statistics_all_tlabs(); |
|
200 |
void resize_all_tlabs(); |
|
201 |
||
202 |
bool supports_tlab_allocation() const { return true; } |
|
203 |
||
204 |
size_t tlab_capacity(Thread* thr) const; |
|
22552 | 205 |
size_t tlab_used(Thread* thr) const; |
1 | 206 |
size_t unsafe_max_tlab_alloc(Thread* thr) const; |
207 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
208 |
// Can a compiler initialize a new object without store barriers? |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
209 |
// This permission only extends from the creation of a new object |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
210 |
// via a TLAB up to the first subsequent safepoint. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
211 |
virtual bool can_elide_tlab_store_barriers() const { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
212 |
return true; |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
213 |
} |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
388
diff
changeset
|
214 |
|
4637 | 215 |
virtual bool card_mark_must_follow_store() const { |
216 |
return false; |
|
217 |
} |
|
218 |
||
4030
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
3908
diff
changeset
|
219 |
// Return true if we don't we need a store barrier for |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
3908
diff
changeset
|
220 |
// initializing stores to an object at this address. |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
3908
diff
changeset
|
221 |
virtual bool can_elide_initializing_store_barrier(oop new_obj); |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
3908
diff
changeset
|
222 |
|
1 | 223 |
void object_iterate(ObjectClosure* cl); |
1893
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
1388
diff
changeset
|
224 |
void safe_object_iterate(ObjectClosure* cl) { object_iterate(cl); } |
1 | 225 |
|
226 |
HeapWord* block_start(const void* addr) const; |
|
227 |
size_t block_size(const HeapWord* addr) const; |
|
228 |
bool block_is_obj(const HeapWord* addr) const; |
|
229 |
||
230 |
jlong millis_since_last_gc(); |
|
231 |
||
232 |
void prepare_for_verify(); |
|
18025 | 233 |
PSHeapSummary create_ps_heap_summary(); |
10997
0be4b3be7197
7099849: G1: include heap region information in hs_err files
tonyp
parents:
9997
diff
changeset
|
234 |
virtual void print_on(outputStream* st) const; |
16685
41c34debcde0
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
13728
diff
changeset
|
235 |
virtual void print_on_error(outputStream* st) const; |
1 | 236 |
virtual void print_gc_threads_on(outputStream* st) const; |
237 |
virtual void gc_threads_do(ThreadClosure* tc) const; |
|
238 |
virtual void print_tracing_info() const; |
|
239 |
||
35061 | 240 |
void verify(VerifyOption option /* ignored */); |
1 | 241 |
|
242 |
// Resize the young generation. The reserved space for the |
|
243 |
// generation may be expanded in preparation for the resize. |
|
244 |
void resize_young_gen(size_t eden_size, size_t survivor_size); |
|
245 |
||
246 |
// Resize the old generation. The reserved space for the |
|
247 |
// generation may be expanded in preparation for the resize. |
|
248 |
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
|
249 |
|
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
250 |
// 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
|
251 |
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
|
252 |
|
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
388
diff
changeset
|
253 |
// 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
|
254 |
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
|
255 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
256 |
// 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
|
257 |
class ParStrongRootsScope : public MarkScope { |
21560
b3ae3ba25ebb
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
19986
diff
changeset
|
258 |
public: |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
259 |
ParStrongRootsScope(); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
260 |
~ParStrongRootsScope(); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3262
diff
changeset
|
261 |
}; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
262 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
263 |
GCMemoryManager* old_gc_manager() const { return _old_manager; } |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47624
diff
changeset
|
264 |
GCMemoryManager* young_gc_manager() const { return _young_manager; } |
1 | 265 |
}; |
266 |
||
35061 | 267 |
// Simple class for storing info about the heap at the start of GC, to be used |
268 |
// after GC for comparison/printing. |
|
269 |
class PreGCValues { |
|
270 |
public: |
|
271 |
PreGCValues(ParallelScavengeHeap* heap) : |
|
272 |
_heap_used(heap->used()), |
|
273 |
_young_gen_used(heap->young_gen()->used_in_bytes()), |
|
274 |
_old_gen_used(heap->old_gen()->used_in_bytes()), |
|
275 |
_metadata_used(MetaspaceAux::used_bytes()) { }; |
|
276 |
||
277 |
size_t heap_used() const { return _heap_used; } |
|
278 |
size_t young_gen_used() const { return _young_gen_used; } |
|
279 |
size_t old_gen_used() const { return _old_gen_used; } |
|
280 |
size_t metadata_used() const { return _metadata_used; } |
|
281 |
||
282 |
private: |
|
283 |
size_t _heap_used; |
|
284 |
size_t _young_gen_used; |
|
285 |
size_t _old_gen_used; |
|
286 |
size_t _metadata_used; |
|
287 |
}; |
|
288 |
||
46657
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
289 |
// 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
|
290 |
// adaptive size policy at intervals specified by |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
291 |
// AdaptiveSizePolicyOutputInterval. Only print information |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
292 |
// 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
|
293 |
class AdaptiveSizePolicyOutput : AllStatic { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
294 |
static bool enabled() { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
295 |
return UseParallelGC && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
296 |
UseAdaptiveSizePolicy && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
297 |
log_is_enabled(Debug, gc, ergo); |
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 |
public: |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
300 |
static void print() { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
301 |
if (enabled()) { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
302 |
ParallelScavengeHeap::heap()->size_policy()->print(); |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
303 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
304 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
305 |
|
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
306 |
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
|
307 |
bool do_print = |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
308 |
enabled() && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
309 |
(AdaptiveSizePolicyOutputInterval > 0) && |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
310 |
(count % AdaptiveSizePolicyOutputInterval) == 0; |
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 |
if (do_print) { |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
313 |
size_policy->print(); |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
314 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
315 |
} |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
316 |
}; |
cc4ac8d1ef6b
8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
rkennke
parents:
41283
diff
changeset
|
317 |
|
30764 | 318 |
#endif // SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_HPP |