author | stefank |
Mon, 07 May 2018 16:12:07 +0200 | |
changeset 50058 | f7e564cacfbc |
parent 50049 | 9d17c375dc30 |
child 50071 | 758deedaae84 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
2 |
* Copyright (c) 2002, 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 |
||
7397 | 25 |
#include "precompiled.hpp" |
24426
0a69c8cdfca9
8038654: Separate SymbolTable and StringTable code
gziemski
parents:
24092
diff
changeset
|
26 |
#include "classfile/stringTable.hpp" |
11753 | 27 |
#include "code/codeCache.hpp" |
30764 | 28 |
#include "gc/parallel/gcTaskManager.hpp" |
29 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
|
30 |
#include "gc/parallel/psAdaptiveSizePolicy.hpp" |
|
49982 | 31 |
#include "gc/parallel/psMarkSweepProxy.hpp" |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
32 |
#include "gc/parallel/psParallelCompact.inline.hpp" |
30764 | 33 |
#include "gc/parallel/psScavenge.inline.hpp" |
34 |
#include "gc/parallel/psTasks.hpp" |
|
35 |
#include "gc/shared/collectorPolicy.hpp" |
|
36 |
#include "gc/shared/gcCause.hpp" |
|
37 |
#include "gc/shared/gcHeapSummary.hpp" |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
33105
diff
changeset
|
38 |
#include "gc/shared/gcId.hpp" |
49594
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49592
diff
changeset
|
39 |
#include "gc/shared/gcLocker.hpp" |
30764 | 40 |
#include "gc/shared/gcTimer.hpp" |
41 |
#include "gc/shared/gcTrace.hpp" |
|
35061 | 42 |
#include "gc/shared/gcTraceTime.inline.hpp" |
30764 | 43 |
#include "gc/shared/isGCActiveMark.hpp" |
44 |
#include "gc/shared/referencePolicy.hpp" |
|
45 |
#include "gc/shared/referenceProcessor.hpp" |
|
46 |
#include "gc/shared/spaceDecorator.hpp" |
|
47648
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
47546
diff
changeset
|
47 |
#include "gc/shared/weakProcessor.hpp" |
7397 | 48 |
#include "memory/resourceArea.hpp" |
35061 | 49 |
#include "logging/log.hpp" |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49389
diff
changeset
|
50 |
#include "oops/access.inline.hpp" |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49389
diff
changeset
|
51 |
#include "oops/compressedOops.inline.hpp" |
7397 | 52 |
#include "oops/oop.inline.hpp" |
53 |
#include "runtime/biasedLocking.hpp" |
|
54 |
#include "runtime/handles.inline.hpp" |
|
55 |
#include "runtime/threadCritical.hpp" |
|
56 |
#include "runtime/vmThread.hpp" |
|
57 |
#include "runtime/vm_operations.hpp" |
|
58 |
#include "services/memoryService.hpp" |
|
59 |
#include "utilities/stack.inline.hpp" |
|
1 | 60 |
|
49964
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
61 |
HeapWord* PSScavenge::_to_space_top_before_gc = NULL; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
62 |
int PSScavenge::_consecutive_skipped_scavenges = 0; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
63 |
SpanSubjectToDiscoveryClosure PSScavenge::_span_based_discoverer; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
64 |
ReferenceProcessor* PSScavenge::_ref_processor = NULL; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
65 |
PSCardTable* PSScavenge::_card_table = NULL; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
66 |
bool PSScavenge::_survivor_overflow = false; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
67 |
uint PSScavenge::_tenuring_threshold = 0; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
68 |
HeapWord* PSScavenge::_young_generation_boundary = NULL; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
69 |
uintptr_t PSScavenge::_young_generation_boundary_compressed = 0; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
70 |
elapsedTimer PSScavenge::_accumulated_time; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
71 |
STWGCTimer PSScavenge::_gc_timer; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
72 |
ParallelScavengeTracer PSScavenge::_gc_tracer; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
73 |
CollectorCounters* PSScavenge::_counters = NULL; |
1 | 74 |
|
75 |
// Define before use |
|
76 |
class PSIsAliveClosure: public BoolObjectClosure { |
|
77 |
public: |
|
78 |
bool do_object_b(oop p) { |
|
17852
59b05e1db547
8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops
stefank
parents:
17846
diff
changeset
|
79 |
return (!PSScavenge::is_obj_in_young(p)) || p->is_forwarded(); |
1 | 80 |
} |
81 |
}; |
|
82 |
||
83 |
PSIsAliveClosure PSScavenge::_is_alive_closure; |
|
84 |
||
85 |
class PSKeepAliveClosure: public OopClosure { |
|
86 |
protected: |
|
87 |
MutableSpace* _to_space; |
|
88 |
PSPromotionManager* _promotion_manager; |
|
89 |
||
90 |
public: |
|
91 |
PSKeepAliveClosure(PSPromotionManager* pm) : _promotion_manager(pm) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
92 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 93 |
_to_space = heap->young_gen()->to_space(); |
94 |
||
95 |
assert(_promotion_manager != NULL, "Sanity"); |
|
96 |
} |
|
97 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
98 |
template <class T> void do_oop_work(T* p) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49389
diff
changeset
|
99 |
assert (oopDesc::is_oop(RawAccess<OOP_NOT_NULL>::oop_load(p)), |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
100 |
"expected an oop while scanning weak refs"); |
1 | 101 |
|
102 |
// Weak refs may be visited more than once. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
103 |
if (PSScavenge::should_scavenge(p, _to_space)) { |
29208
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
28212
diff
changeset
|
104 |
_promotion_manager->copy_and_push_safe_barrier<T, /*promote_immediately=*/false>(p); |
1 | 105 |
} |
106 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
107 |
virtual void do_oop(oop* p) { PSKeepAliveClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
108 |
virtual void do_oop(narrowOop* p) { PSKeepAliveClosure::do_oop_work(p); } |
1 | 109 |
}; |
110 |
||
111 |
class PSEvacuateFollowersClosure: public VoidClosure { |
|
112 |
private: |
|
113 |
PSPromotionManager* _promotion_manager; |
|
114 |
public: |
|
115 |
PSEvacuateFollowersClosure(PSPromotionManager* pm) : _promotion_manager(pm) {} |
|
116 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
117 |
virtual void do_void() { |
1 | 118 |
assert(_promotion_manager != NULL, "Sanity"); |
119 |
_promotion_manager->drain_stacks(true); |
|
120 |
guarantee(_promotion_manager->stacks_empty(), |
|
121 |
"stacks should be empty at this point"); |
|
122 |
} |
|
123 |
}; |
|
124 |
||
125 |
class PSRefProcTaskProxy: public GCTask { |
|
126 |
typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; |
|
127 |
ProcessTask & _rp_task; |
|
128 |
uint _work_id; |
|
129 |
public: |
|
130 |
PSRefProcTaskProxy(ProcessTask & rp_task, uint work_id) |
|
131 |
: _rp_task(rp_task), |
|
132 |
_work_id(work_id) |
|
133 |
{ } |
|
134 |
||
135 |
private: |
|
136 |
virtual char* name() { return (char *)"Process referents by policy in parallel"; } |
|
137 |
virtual void do_it(GCTaskManager* manager, uint which); |
|
138 |
}; |
|
139 |
||
140 |
void PSRefProcTaskProxy::do_it(GCTaskManager* manager, uint which) |
|
141 |
{ |
|
142 |
PSPromotionManager* promotion_manager = |
|
143 |
PSPromotionManager::gc_thread_promotion_manager(which); |
|
144 |
assert(promotion_manager != NULL, "sanity check"); |
|
145 |
PSKeepAliveClosure keep_alive(promotion_manager); |
|
146 |
PSEvacuateFollowersClosure evac_followers(promotion_manager); |
|
147 |
PSIsAliveClosure is_alive; |
|
148 |
_rp_task.work(_work_id, is_alive, keep_alive, evac_followers); |
|
149 |
} |
|
150 |
||
151 |
class PSRefEnqueueTaskProxy: public GCTask { |
|
152 |
typedef AbstractRefProcTaskExecutor::EnqueueTask EnqueueTask; |
|
153 |
EnqueueTask& _enq_task; |
|
154 |
uint _work_id; |
|
155 |
||
156 |
public: |
|
157 |
PSRefEnqueueTaskProxy(EnqueueTask& enq_task, uint work_id) |
|
158 |
: _enq_task(enq_task), |
|
159 |
_work_id(work_id) |
|
160 |
{ } |
|
161 |
||
162 |
virtual char* name() { return (char *)"Enqueue reference objects in parallel"; } |
|
163 |
virtual void do_it(GCTaskManager* manager, uint which) |
|
164 |
{ |
|
165 |
_enq_task.work(_work_id); |
|
166 |
} |
|
167 |
}; |
|
168 |
||
169 |
class PSRefProcTaskExecutor: public AbstractRefProcTaskExecutor { |
|
170 |
virtual void execute(ProcessTask& task); |
|
171 |
virtual void execute(EnqueueTask& task); |
|
172 |
}; |
|
173 |
||
174 |
void PSRefProcTaskExecutor::execute(ProcessTask& task) |
|
175 |
{ |
|
176 |
GCTaskQueue* q = GCTaskQueue::create(); |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
177 |
GCTaskManager* manager = ParallelScavengeHeap::gc_task_manager(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
178 |
for(uint i=0; i < manager->active_workers(); i++) { |
1 | 179 |
q->enqueue(new PSRefProcTaskProxy(task, i)); |
180 |
} |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
181 |
ParallelTaskTerminator terminator(manager->active_workers(), |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
5918
diff
changeset
|
182 |
(TaskQueueSetSuper*) PSPromotionManager::stack_array_depth()); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
183 |
if (task.marks_oops_alive() && manager->active_workers() > 1) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
184 |
for (uint j = 0; j < manager->active_workers(); j++) { |
1 | 185 |
q->enqueue(new StealTask(&terminator)); |
186 |
} |
|
187 |
} |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
188 |
manager->execute_and_wait(q); |
1 | 189 |
} |
190 |
||
191 |
||
192 |
void PSRefProcTaskExecutor::execute(EnqueueTask& task) |
|
193 |
{ |
|
194 |
GCTaskQueue* q = GCTaskQueue::create(); |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
195 |
GCTaskManager* manager = ParallelScavengeHeap::gc_task_manager(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
196 |
for(uint i=0; i < manager->active_workers(); i++) { |
1 | 197 |
q->enqueue(new PSRefEnqueueTaskProxy(task, i)); |
198 |
} |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
199 |
manager->execute_and_wait(q); |
1 | 200 |
} |
201 |
||
202 |
// This method contains all heap specific policy for invoking scavenge. |
|
203 |
// PSScavenge::invoke_no_policy() will do nothing but attempt to |
|
204 |
// scavenge. It will not clean up after failed promotions, bail out if |
|
205 |
// we've exceeded policy time limits, or any other special behavior. |
|
206 |
// All such policy should be placed here. |
|
207 |
// |
|
208 |
// Note that this method should only be called from the vm_thread while |
|
209 |
// at a safepoint! |
|
11757
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
210 |
bool PSScavenge::invoke() { |
1 | 211 |
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); |
212 |
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread"); |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
213 |
assert(!ParallelScavengeHeap::heap()->is_gc_active(), "not reentrant"); |
1 | 214 |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
215 |
ParallelScavengeHeap* const heap = ParallelScavengeHeap::heap(); |
1 | 216 |
PSAdaptiveSizePolicy* policy = heap->size_policy(); |
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
217 |
IsGCActiveMark mark; |
1 | 218 |
|
11757
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
219 |
const bool scavenge_done = PSScavenge::invoke_no_policy(); |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
220 |
const bool need_full_gc = !scavenge_done || |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
221 |
policy->should_full_GC(heap->old_gen()->free_in_bytes()); |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
222 |
bool full_gc_done = false; |
1 | 223 |
|
11757
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
224 |
if (UsePerfData) { |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
225 |
PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters(); |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
226 |
const int ffs_val = need_full_gc ? full_follows_scavenge : not_skipped; |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
227 |
counters->update_full_follows_scavenge(ffs_val); |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
228 |
} |
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
229 |
|
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
230 |
if (need_full_gc) { |
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
231 |
GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy); |
49047
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48168
diff
changeset
|
232 |
SoftRefPolicy* srp = heap->soft_ref_policy(); |
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48168
diff
changeset
|
233 |
const bool clear_all_softrefs = srp->should_clear_all_soft_refs(); |
1 | 234 |
|
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
235 |
if (UseParallelOldGC) { |
11757
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
236 |
full_gc_done = PSParallelCompact::invoke_no_policy(clear_all_softrefs); |
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
237 |
} else { |
49982 | 238 |
full_gc_done = PSMarkSweepProxy::invoke_no_policy(clear_all_softrefs); |
1 | 239 |
} |
240 |
} |
|
11757
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
241 |
|
cdf6204b114a
7146343: PS invoke methods should indicate the type of gc done
jcoomes
parents:
11753
diff
changeset
|
242 |
return full_gc_done; |
1 | 243 |
} |
244 |
||
50058
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
245 |
class PSAddThreadRootsTaskClosure : public ThreadClosure { |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
246 |
private: |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
247 |
GCTaskQueue* _q; |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
248 |
|
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
249 |
public: |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
250 |
PSAddThreadRootsTaskClosure(GCTaskQueue* q) : _q(q) { } |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
251 |
void do_thread(Thread* t) { |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
252 |
_q->enqueue(new ThreadRootsTask(t)); |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
253 |
} |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
254 |
}; |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
255 |
|
1 | 256 |
// This method contains no policy. You should probably |
257 |
// be calling invoke() instead. |
|
258 |
bool PSScavenge::invoke_no_policy() { |
|
259 |
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); |
|
260 |
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread"); |
|
261 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
20317
diff
changeset
|
262 |
_gc_timer.register_gc_start(); |
18025 | 263 |
|
1 | 264 |
TimeStamp scavenge_entry; |
265 |
TimeStamp scavenge_midpoint; |
|
266 |
TimeStamp scavenge_exit; |
|
267 |
||
268 |
scavenge_entry.update(); |
|
269 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
270 |
if (GCLocker::check_active_before_gc()) { |
1 | 271 |
return false; |
272 |
} |
|
273 |
||
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
274 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 275 |
GCCause::Cause gc_cause = heap->gc_cause(); |
276 |
||
277 |
// Check for potential problems. |
|
278 |
if (!should_attempt_scavenge()) { |
|
279 |
return false; |
|
280 |
} |
|
281 |
||
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
33105
diff
changeset
|
282 |
GCIdMark gc_id_mark; |
18025 | 283 |
_gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start()); |
284 |
||
1 | 285 |
bool promotion_failure_occurred = false; |
286 |
||
287 |
PSYoungGen* young_gen = heap->young_gen(); |
|
288 |
PSOldGen* old_gen = heap->old_gen(); |
|
289 |
PSAdaptiveSizePolicy* size_policy = heap->size_policy(); |
|
18025 | 290 |
|
1 | 291 |
heap->increment_total_collections(); |
292 |
||
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31330
diff
changeset
|
293 |
if (AdaptiveSizePolicy::should_update_eden_stats(gc_cause)) { |
1 | 294 |
// Gather the feedback data for eden occupancy. |
295 |
young_gen->eden_space()->accumulate_statistics(); |
|
296 |
} |
|
297 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11174
diff
changeset
|
298 |
heap->print_heap_before_gc(); |
18025 | 299 |
heap->trace_heap_before_gc(&_gc_tracer); |
1 | 300 |
|
301 |
assert(!NeverTenure || _tenuring_threshold == markOopDesc::max_age + 1, "Sanity"); |
|
302 |
assert(!AlwaysTenure || _tenuring_threshold == 0, "Sanity"); |
|
303 |
||
304 |
// Fill in TLABs |
|
305 |
heap->accumulate_statistics_all_tlabs(); |
|
306 |
heap->ensure_parsability(true); // retire TLABs |
|
307 |
||
308 |
if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) { |
|
309 |
HandleMark hm; // Discard invalid handles created during verification |
|
35061 | 310 |
Universe::verify("Before GC"); |
1 | 311 |
} |
312 |
||
313 |
{ |
|
314 |
ResourceMark rm; |
|
315 |
HandleMark hm; |
|
316 |
||
35061 | 317 |
GCTraceCPUTime tcpu; |
318 |
GCTraceTime(Info, gc) tm("Pause Young", NULL, gc_cause, true); |
|
1 | 319 |
TraceCollectorStats tcs(counters()); |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47799
diff
changeset
|
320 |
TraceMemoryManagerStats tms(heap->young_gc_manager(), gc_cause); |
1 | 321 |
|
47546
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
322 |
if (log_is_enabled(Debug, gc, heap, exit)) { |
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
323 |
accumulated_time()->start(); |
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
324 |
} |
1 | 325 |
|
326 |
// Let the size policy know we're starting |
|
327 |
size_policy->minor_collection_begin(); |
|
328 |
||
329 |
// Verify the object start arrays. |
|
330 |
if (VerifyObjectStartArray && |
|
331 |
VerifyBeforeGC) { |
|
332 |
old_gen->verify_object_start_array(); |
|
333 |
} |
|
334 |
||
335 |
// Verify no unmarked old->young roots |
|
336 |
if (VerifyRememberedSets) { |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
337 |
heap->card_table()->verify_all_young_refs_imprecise(); |
1 | 338 |
} |
339 |
||
33227
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
340 |
assert(young_gen->to_space()->is_empty(), |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
341 |
"Attempt to scavenge with live objects in to_space"); |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
342 |
young_gen->to_space()->clear(SpaceDecorator::Mangle); |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
343 |
|
1 | 344 |
save_to_space_top_before_gc(); |
345 |
||
47799 | 346 |
#if COMPILER2_OR_JVMCI |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32623
diff
changeset
|
347 |
DerivedPointerTable::clear(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32623
diff
changeset
|
348 |
#endif |
1 | 349 |
|
28212
647b7d0efb88
8066827: Remove ReferenceProcessor::clean_up_discovered_references()
kbarrett
parents:
27887
diff
changeset
|
350 |
reference_processor()->enable_discovery(); |
1610
5dddd195cc86
6778647: snap(), snap_policy() should be renamed setup(), setup_policy()
ysr
parents:
1606
diff
changeset
|
351 |
reference_processor()->setup_policy(false); |
1 | 352 |
|
35061 | 353 |
PreGCValues pre_gc_values(heap); |
1 | 354 |
|
355 |
// Reset our survivor overflow. |
|
356 |
set_survivor_overflow(false); |
|
357 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
358 |
// We need to save the old top values before |
1 | 359 |
// creating the promotion_manager. We pass the top |
360 |
// values to the card_table, to prevent it from |
|
361 |
// straying into the promotion labs. |
|
362 |
HeapWord* old_top = old_gen->object_space()->top(); |
|
363 |
||
364 |
// Release all previously held resources |
|
365 |
gc_task_manager()->release_all_resources(); |
|
366 |
||
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
367 |
// Set the number of GC threads to be used in this collection |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
368 |
gc_task_manager()->set_active_gang(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
369 |
gc_task_manager()->task_idle_workers(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
370 |
// Get the active number of workers here and use that value |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
371 |
// throughout the methods. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
372 |
uint active_workers = gc_task_manager()->active_workers(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
373 |
|
1 | 374 |
PSPromotionManager::pre_scavenge(); |
375 |
||
376 |
// We'll use the promotion manager again later. |
|
377 |
PSPromotionManager* promotion_manager = PSPromotionManager::vm_thread_promotion_manager(); |
|
378 |
{ |
|
35061 | 379 |
GCTraceTime(Debug, gc, phases) tm("Scavenge", &_gc_timer); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2105
diff
changeset
|
380 |
ParallelScavengeHeap::ParStrongRootsScope psrs; |
1 | 381 |
|
382 |
GCTaskQueue* q = GCTaskQueue::create(); |
|
383 |
||
13924 | 384 |
if (!old_gen->object_space()->is_empty()) { |
385 |
// There are only old-to-young pointers if there are objects |
|
386 |
// in the old gen. |
|
387 |
uint stripe_total = active_workers; |
|
388 |
for(uint i=0; i < stripe_total; i++) { |
|
389 |
q->enqueue(new OldToYoungRootsTask(old_gen, old_top, i, stripe_total)); |
|
390 |
} |
|
1 | 391 |
} |
392 |
||
393 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::universe)); |
|
394 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::jni_handles)); |
|
395 |
// We scan the thread roots in parallel |
|
50058
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
396 |
PSAddThreadRootsTaskClosure cl(q); |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
50049
diff
changeset
|
397 |
Threads::java_threads_and_vm_thread_do(&cl); |
1 | 398 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::object_synchronizer)); |
399 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::management)); |
|
400 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::system_dictionary)); |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
17625
diff
changeset
|
401 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::class_loader_data)); |
1 | 402 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::jvmti)); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2105
diff
changeset
|
403 |
q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::code_cache)); |
1 | 404 |
|
405 |
ParallelTaskTerminator terminator( |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
406 |
active_workers, |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
5918
diff
changeset
|
407 |
(TaskQueueSetSuper*) promotion_manager->stack_array_depth()); |
40096
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
408 |
// If active_workers can exceed 1, add a StrealTask. |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
409 |
// PSPromotionManager::drain_stacks_depth() does not fully drain its |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
410 |
// stacks and expects a StealTask to complete the draining if |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
411 |
// ParallelGCThreads is > 1. |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
412 |
if (gc_task_manager()->workers() > 1) { |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
413 |
for (uint j = 0; j < active_workers; j++) { |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
414 |
q->enqueue(new StealTask(&terminator)); |
246c62cd9180
8159073: : Error handling incomplete when creating GC threads lazily
jmasa
parents:
38080
diff
changeset
|
415 |
} |
1 | 416 |
} |
417 |
||
418 |
gc_task_manager()->execute_and_wait(q); |
|
419 |
} |
|
420 |
||
421 |
scavenge_midpoint.update(); |
|
422 |
||
423 |
// Process reference objects discovered during scavenge |
|
424 |
{ |
|
37146 | 425 |
GCTraceTime(Debug, gc, phases) tm("Reference Processing", &_gc_timer); |
18025 | 426 |
|
1610
5dddd195cc86
6778647: snap(), snap_policy() should be renamed setup(), setup_policy()
ysr
parents:
1606
diff
changeset
|
427 |
reference_processor()->setup_policy(false); // not always_clear |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
428 |
reference_processor()->set_active_mt_degree(active_workers); |
47676
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
429 |
PSKeepAliveClosure keep_alive(promotion_manager); |
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
430 |
PSEvacuateFollowersClosure evac_followers(promotion_manager); |
18025 | 431 |
ReferenceProcessorStats stats; |
49967
672ded60a082
8202021: Improve variable naming in ReferenceProcesso
tschatzl
parents:
49964
diff
changeset
|
432 |
ReferenceProcessorPhaseTimes pt(&_gc_timer, reference_processor()->num_queues()); |
1 | 433 |
if (reference_processor()->processing_is_mt()) { |
434 |
PSRefProcTaskExecutor task_executor; |
|
18025 | 435 |
stats = reference_processor()->process_discovered_references( |
436 |
&_is_alive_closure, &keep_alive, &evac_followers, &task_executor, |
|
46795
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
40096
diff
changeset
|
437 |
&pt); |
1 | 438 |
} else { |
18025 | 439 |
stats = reference_processor()->process_discovered_references( |
46795
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
40096
diff
changeset
|
440 |
&_is_alive_closure, &keep_alive, &evac_followers, NULL, &pt); |
18025 | 441 |
} |
442 |
||
443 |
_gc_tracer.report_gc_reference_stats(stats); |
|
46795
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
40096
diff
changeset
|
444 |
pt.print_all_references(); |
1 | 445 |
} |
446 |
||
47676
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
447 |
assert(promotion_manager->stacks_empty(),"stacks should be empty at this point"); |
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
448 |
|
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
449 |
PSScavengeRootsClosure root_closure(promotion_manager); |
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
450 |
|
22205
8ee59199b85d
8027364: PSScavenge accounts too large code section to StringTable unlink
tschatzl
parents:
21767
diff
changeset
|
451 |
{ |
47648
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
47546
diff
changeset
|
452 |
GCTraceTime(Debug, gc, phases) tm("Weak Processing", &_gc_timer); |
47676
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
453 |
WeakProcessor::weak_oops_do(&_is_alive_closure, &root_closure); |
47648
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
47546
diff
changeset
|
454 |
} |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
47546
diff
changeset
|
455 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
47546
diff
changeset
|
456 |
{ |
37146 | 457 |
GCTraceTime(Debug, gc, phases) tm("Scrub String Table", &_gc_timer); |
22205
8ee59199b85d
8027364: PSScavenge accounts too large code section to StringTable unlink
tschatzl
parents:
21767
diff
changeset
|
458 |
// Unlink any dead interned Strings and process the remaining live ones. |
8ee59199b85d
8027364: PSScavenge accounts too large code section to StringTable unlink
tschatzl
parents:
21767
diff
changeset
|
459 |
StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); |
8ee59199b85d
8027364: PSScavenge accounts too large code section to StringTable unlink
tschatzl
parents:
21767
diff
changeset
|
460 |
} |
8728
3f1bcd33068e
6962931: move interned strings out of the perm gen
jcoomes
parents:
8688
diff
changeset
|
461 |
|
47676
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
462 |
// Verify that usage of root_closure didn't copy any objects. |
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
463 |
assert(promotion_manager->stacks_empty(),"stacks should be empty at this point"); |
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
464 |
|
1 | 465 |
// Finally, flush the promotion_manager's labs, and deallocate its stacks. |
18025 | 466 |
promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); |
1 | 467 |
if (promotion_failure_occurred) { |
468 |
clean_up_failed_promotion(); |
|
38080 | 469 |
log_info(gc, promotion)("Promotion failed"); |
1 | 470 |
} |
471 |
||
33143
2083f82acec8
8139134: Wrong tenuring threshold in young GC trace event
ehelin
parents:
33107
diff
changeset
|
472 |
_gc_tracer.report_tenuring_threshold(tenuring_threshold()); |
2083f82acec8
8139134: Wrong tenuring threshold in young GC trace event
ehelin
parents:
33107
diff
changeset
|
473 |
|
1 | 474 |
// Let the size policy know we're done. Note that we count promotion |
475 |
// failure cleanup time as part of the collection (otherwise, we're |
|
476 |
// implicitly saying it's mutator time). |
|
477 |
size_policy->minor_collection_end(gc_cause); |
|
478 |
||
479 |
if (!promotion_failure_occurred) { |
|
480 |
// Swap the survivor spaces. |
|
971
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
481 |
young_gen->eden_space()->clear(SpaceDecorator::Mangle); |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
482 |
young_gen->from_space()->clear(SpaceDecorator::Mangle); |
1 | 483 |
young_gen->swap_spaces(); |
484 |
||
485 |
size_t survived = young_gen->from_space()->used_in_bytes(); |
|
35061 | 486 |
size_t promoted = old_gen->used_in_bytes() - pre_gc_values.old_gen_used(); |
1 | 487 |
size_policy->update_averages(_survivor_overflow, survived, promoted); |
488 |
||
5343
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
489 |
// A successful scavenge should restart the GC time limit count which is |
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
490 |
// for full GC's. |
95a5c4b89273
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
3908
diff
changeset
|
491 |
size_policy->reset_gc_overhead_limit_count(); |
1 | 492 |
if (UseAdaptiveSizePolicy) { |
493 |
// Calculate the new survivor size and tenuring threshold |
|
494 |
||
35061 | 495 |
log_debug(gc, ergo)("AdaptiveSizeStart: collection: %d ", heap->total_collections()); |
496 |
log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT, |
|
497 |
old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes()); |
|
1 | 498 |
|
499 |
if (UsePerfData) { |
|
500 |
PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); |
|
501 |
counters->update_old_eden_size( |
|
502 |
size_policy->calculated_eden_size_in_bytes()); |
|
503 |
counters->update_old_promo_size( |
|
504 |
size_policy->calculated_promo_size_in_bytes()); |
|
505 |
counters->update_old_capacity(old_gen->capacity_in_bytes()); |
|
506 |
counters->update_young_capacity(young_gen->capacity_in_bytes()); |
|
507 |
counters->update_survived(survived); |
|
508 |
counters->update_promoted(promoted); |
|
509 |
counters->update_survivor_overflowed(_survivor_overflow); |
|
510 |
} |
|
511 |
||
22555
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
512 |
size_t max_young_size = young_gen->max_size(); |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
513 |
|
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
514 |
// Deciding a free ratio in the young generation is tricky, so if |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
515 |
// MinHeapFreeRatio or MaxHeapFreeRatio are in use (implicating |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
516 |
// that the old generation size may have been limited because of them) we |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
517 |
// should then limit our young generation size using NewRatio to have it |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
518 |
// follow the old generation size. |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
519 |
if (MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) { |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
520 |
max_young_size = MIN2(old_gen->capacity_in_bytes() / NewRatio, young_gen->max_size()); |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
521 |
} |
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
522 |
|
1 | 523 |
size_t survivor_limit = |
22555
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
524 |
size_policy->max_survivor_size(max_young_size); |
1 | 525 |
_tenuring_threshold = |
526 |
size_policy->compute_survivor_space_size_and_threshold( |
|
527 |
_survivor_overflow, |
|
528 |
_tenuring_threshold, |
|
529 |
survivor_limit); |
|
530 |
||
35061 | 531 |
log_debug(gc, age)("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max threshold " UINTX_FORMAT ")", |
532 |
size_policy->calculated_survivor_size_in_bytes(), |
|
533 |
_tenuring_threshold, MaxTenuringThreshold); |
|
1 | 534 |
|
535 |
if (UsePerfData) { |
|
536 |
PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); |
|
537 |
counters->update_tenuring_threshold(_tenuring_threshold); |
|
538 |
counters->update_survivor_size_counters(); |
|
539 |
} |
|
540 |
||
541 |
// Do call at minor collections? |
|
542 |
// Don't check if the size_policy is ready at this |
|
543 |
// level. Let the size_policy check that internally. |
|
22555
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
544 |
if (UseAdaptiveGenerationSizePolicyAtMinorCollection && |
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31330
diff
changeset
|
545 |
(AdaptiveSizePolicy::should_update_eden_stats(gc_cause))) { |
22551 | 546 |
// Calculate optimal free space amounts |
1 | 547 |
assert(young_gen->max_size() > |
548 |
young_gen->from_space()->capacity_in_bytes() + |
|
549 |
young_gen->to_space()->capacity_in_bytes(), |
|
550 |
"Sizes of space in young gen are out-of-bounds"); |
|
17393
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
551 |
|
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
552 |
size_t young_live = young_gen->used_in_bytes(); |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
553 |
size_t eden_live = young_gen->eden_space()->used_in_bytes(); |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
554 |
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes(); |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
555 |
size_t max_old_gen_size = old_gen->max_gen_size(); |
22555
ea32f6c51d08
8028391: Make the Min/MaxHeapFreeRatio flags manageable
jwilhelm
parents:
22551
diff
changeset
|
556 |
size_t max_eden_size = max_young_size - |
1 | 557 |
young_gen->from_space()->capacity_in_bytes() - |
558 |
young_gen->to_space()->capacity_in_bytes(); |
|
17393
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
559 |
|
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
560 |
// Used for diagnostics |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
561 |
size_policy->clear_generation_free_space_flags(); |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
562 |
|
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
563 |
size_policy->compute_eden_space_size(young_live, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
564 |
eden_live, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
565 |
cur_eden, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
566 |
max_eden_size, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
567 |
false /* not full gc*/); |
1 | 568 |
|
17393
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
569 |
size_policy->check_gc_overhead_limit(young_live, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
570 |
eden_live, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
571 |
max_old_gen_size, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
572 |
max_eden_size, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
573 |
false /* not full gc*/, |
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
574 |
gc_cause, |
49047
8f004146e407
8198515: Extract SoftReferencePolicy code out of CollectorPolicy
stefank
parents:
48168
diff
changeset
|
575 |
heap->soft_ref_policy()); |
17393
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
576 |
|
7e99f263902c
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
17112
diff
changeset
|
577 |
size_policy->decay_supplemental_growth(false /* not full gc*/); |
1 | 578 |
} |
579 |
// Resize the young generation at every collection |
|
580 |
// even if new sizes have not been calculated. This is |
|
581 |
// to allow resizes that may have been inhibited by the |
|
582 |
// relative location of the "to" and "from" spaces. |
|
583 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31634
diff
changeset
|
584 |
// Resizing the old gen at young collections can cause increases |
1 | 585 |
// that don't feed back to the generation sizing policy until |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31634
diff
changeset
|
586 |
// a full collection. Don't resize the old gen here. |
1 | 587 |
|
588 |
heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(), |
|
589 |
size_policy->calculated_survivor_size_in_bytes()); |
|
590 |
||
35061 | 591 |
log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections()); |
1 | 592 |
} |
593 |
||
594 |
// Update the structure of the eden. With NUMA-eden CPU hotplugging or offlining can |
|
595 |
// cause the change of the heap layout. Make sure eden is reshaped if that's the case. |
|
596 |
// Also update() will case adaptive NUMA chunk resizing. |
|
597 |
assert(young_gen->eden_space()->is_empty(), "eden space should be empty now"); |
|
598 |
young_gen->eden_space()->update(); |
|
599 |
||
600 |
heap->gc_policy_counters()->update_counters(); |
|
601 |
||
602 |
heap->resize_all_tlabs(); |
|
603 |
||
604 |
assert(young_gen->to_space()->is_empty(), "to space should be empty now"); |
|
605 |
} |
|
606 |
||
47799 | 607 |
#if COMPILER2_OR_JVMCI |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32623
diff
changeset
|
608 |
DerivedPointerTable::update_pointers(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32623
diff
changeset
|
609 |
#endif |
1 | 610 |
|
611 |
NOT_PRODUCT(reference_processor()->verify_no_references_recorded()); |
|
612 |
||
613 |
// Re-verify object start arrays |
|
614 |
if (VerifyObjectStartArray && |
|
615 |
VerifyAfterGC) { |
|
616 |
old_gen->verify_object_start_array(); |
|
617 |
} |
|
618 |
||
619 |
// Verify all old -> young cards are now precise |
|
620 |
if (VerifyRememberedSets) { |
|
621 |
// Precise verification will give false positives. Until this is fixed, |
|
622 |
// use imprecise verification. |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
623 |
// heap->card_table()->verify_all_young_refs_precise(); |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
624 |
heap->card_table()->verify_all_young_refs_imprecise(); |
1 | 625 |
} |
626 |
||
47546
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
627 |
if (log_is_enabled(Debug, gc, heap, exit)) { |
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
628 |
accumulated_time()->stop(); |
64ba55ba8516
8184286: print_tracing_info() does not use Unified Logging for output
sjohanss
parents:
47216
diff
changeset
|
629 |
} |
1 | 630 |
|
35061 | 631 |
young_gen->print_used_change(pre_gc_values.young_gen_used()); |
632 |
old_gen->print_used_change(pre_gc_values.old_gen_used()); |
|
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49164
diff
changeset
|
633 |
MetaspaceUtils::print_metaspace_change(pre_gc_values.metadata_used()); |
1 | 634 |
|
635 |
// Track memory usage and detect low memory |
|
636 |
MemoryService::track_memory_usage(); |
|
637 |
heap->update_counters(); |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
638 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10670
diff
changeset
|
639 |
gc_task_manager()->release_idle_workers(); |
1 | 640 |
} |
641 |
||
642 |
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) { |
|
643 |
HandleMark hm; // Discard invalid handles created during verification |
|
35061 | 644 |
Universe::verify("After GC"); |
1 | 645 |
} |
646 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11174
diff
changeset
|
647 |
heap->print_heap_after_gc(); |
18025 | 648 |
heap->trace_heap_after_gc(&_gc_tracer); |
1 | 649 |
|
650 |
scavenge_exit.update(); |
|
651 |
||
35061 | 652 |
log_debug(gc, task, time)("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " JLONG_FORMAT, |
653 |
scavenge_entry.ticks(), scavenge_midpoint.ticks(), |
|
654 |
scavenge_exit.ticks()); |
|
655 |
gc_task_manager()->print_task_time_stamps(); |
|
1 | 656 |
|
2010
c13462bbad17
6690928: Use spinning in combination with yields for workstealing termination.
jmasa
parents:
1610
diff
changeset
|
657 |
#ifdef TRACESPINNING |
c13462bbad17
6690928: Use spinning in combination with yields for workstealing termination.
jmasa
parents:
1610
diff
changeset
|
658 |
ParallelTaskTerminator::print_termination_counts(); |
c13462bbad17
6690928: Use spinning in combination with yields for workstealing termination.
jmasa
parents:
1610
diff
changeset
|
659 |
#endif |
c13462bbad17
6690928: Use spinning in combination with yields for workstealing termination.
jmasa
parents:
1610
diff
changeset
|
660 |
|
35061 | 661 |
AdaptiveSizePolicyOutput::print(size_policy, heap->total_collections()); |
18025 | 662 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
20317
diff
changeset
|
663 |
_gc_timer.register_gc_end(); |
18025 | 664 |
|
665 |
_gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions()); |
|
666 |
||
1 | 667 |
return !promotion_failure_occurred; |
668 |
} |
|
669 |
||
670 |
// This method iterates over all objects in the young generation, |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
36591
diff
changeset
|
671 |
// removing all forwarding references. It then restores any preserved marks. |
1 | 672 |
void PSScavenge::clean_up_failed_promotion() { |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
673 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 674 |
PSYoungGen* young_gen = heap->young_gen(); |
675 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
36591
diff
changeset
|
676 |
RemoveForwardedPointerClosure remove_fwd_ptr_closure; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
36591
diff
changeset
|
677 |
young_gen->object_iterate(&remove_fwd_ptr_closure); |
1 | 678 |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
36591
diff
changeset
|
679 |
PSPromotionManager::restore_preserved_marks(); |
1 | 680 |
|
681 |
// Reset the PromotionFailureALot counters. |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
682 |
NOT_PRODUCT(heap->reset_promotion_should_fail();) |
1 | 683 |
} |
684 |
||
685 |
bool PSScavenge::should_attempt_scavenge() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
686 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 687 |
PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); |
688 |
||
689 |
if (UsePerfData) { |
|
690 |
counters->update_scavenge_skipped(not_skipped); |
|
691 |
} |
|
692 |
||
693 |
PSYoungGen* young_gen = heap->young_gen(); |
|
694 |
PSOldGen* old_gen = heap->old_gen(); |
|
695 |
||
33227
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
696 |
// Do not attempt to promote unless to_space is empty |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
697 |
if (!young_gen->to_space()->is_empty()) { |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
698 |
_consecutive_skipped_scavenges++; |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
699 |
if (UsePerfData) { |
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
700 |
counters->update_scavenge_skipped(to_space_not_empty); |
1 | 701 |
} |
33227
b00ec45f8c2c
8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause
david
parents:
33143
diff
changeset
|
702 |
return false; |
1 | 703 |
} |
704 |
||
705 |
// Test to see if the scavenge will likely fail. |
|
706 |
PSAdaptiveSizePolicy* policy = heap->size_policy(); |
|
707 |
||
708 |
// A similar test is done in the policy's should_full_GC(). If this is |
|
709 |
// changed, decide if that test should also be changed. |
|
710 |
size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes(); |
|
711 |
size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes()); |
|
712 |
bool result = promotion_estimate < old_gen->free_in_bytes(); |
|
713 |
||
35061 | 714 |
log_trace(ergo)("%s scavenge: average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT, |
715 |
result ? "Do" : "Skip", (size_t) policy->average_promoted_in_bytes(), |
|
716 |
(size_t) policy->padded_average_promoted_in_bytes(), |
|
717 |
old_gen->free_in_bytes()); |
|
718 |
if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) { |
|
719 |
log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes()); |
|
1 | 720 |
} |
721 |
||
722 |
if (result) { |
|
723 |
_consecutive_skipped_scavenges = 0; |
|
724 |
} else { |
|
725 |
_consecutive_skipped_scavenges++; |
|
726 |
if (UsePerfData) { |
|
727 |
counters->update_scavenge_skipped(promoted_too_large); |
|
728 |
} |
|
729 |
} |
|
730 |
return result; |
|
731 |
} |
|
732 |
||
733 |
// Used to add tasks |
|
734 |
GCTaskManager* const PSScavenge::gc_task_manager() { |
|
735 |
assert(ParallelScavengeHeap::gc_task_manager() != NULL, |
|
736 |
"shouldn't return NULL"); |
|
737 |
return ParallelScavengeHeap::gc_task_manager(); |
|
738 |
} |
|
739 |
||
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
740 |
// Adaptive size policy support. When the young generation/old generation |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
741 |
// boundary moves, _young_generation_boundary must be reset |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
742 |
void PSScavenge::set_young_generation_boundary(HeapWord* v) { |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
743 |
_young_generation_boundary = v; |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
744 |
if (UseCompressedOops) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49389
diff
changeset
|
745 |
_young_generation_boundary_compressed = (uintptr_t)CompressedOops::encode((oop)v); |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
746 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
747 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35492
diff
changeset
|
748 |
|
1 | 749 |
void PSScavenge::initialize() { |
750 |
// Arguments must have been parsed |
|
751 |
||
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
22555
diff
changeset
|
752 |
if (AlwaysTenure || NeverTenure) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
22555
diff
changeset
|
753 |
assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32623
diff
changeset
|
754 |
"MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold); |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
22555
diff
changeset
|
755 |
_tenuring_threshold = MaxTenuringThreshold; |
1 | 756 |
} else { |
757 |
// We want to smooth out our startup times for the AdaptiveSizePolicy |
|
758 |
_tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold : |
|
759 |
MaxTenuringThreshold; |
|
760 |
} |
|
761 |
||
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29798
diff
changeset
|
762 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 763 |
PSYoungGen* young_gen = heap->young_gen(); |
764 |
PSOldGen* old_gen = heap->old_gen(); |
|
765 |
||
766 |
// Set boundary between young_gen and old_gen |
|
767 |
assert(old_gen->reserved().end() <= young_gen->eden_space()->bottom(), |
|
768 |
"old above young"); |
|
17852
59b05e1db547
8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops
stefank
parents:
17846
diff
changeset
|
769 |
set_young_generation_boundary(young_gen->eden_space()->bottom()); |
1 | 770 |
|
771 |
// Initialize ref handling object for scavenging. |
|
49964
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
772 |
_span_based_discoverer.set_span(young_gen->reserved()); |
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7658
diff
changeset
|
773 |
_ref_processor = |
49964
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49594
diff
changeset
|
774 |
new ReferenceProcessor(&_span_based_discoverer, |
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7658
diff
changeset
|
775 |
ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing |
31330
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
31032
diff
changeset
|
776 |
ParallelGCThreads, // mt processing degree |
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7658
diff
changeset
|
777 |
true, // mt discovery |
31330
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
31032
diff
changeset
|
778 |
ParallelGCThreads, // mt discovery degree |
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7658
diff
changeset
|
779 |
true, // atomic_discovery |
24845
e8b8894a77df
8043239: G1: Missing post barrier in processing of j.l.ref.Reference objects
brutisso
parents:
24429
diff
changeset
|
780 |
NULL); // header provides liveness info |
1 | 781 |
|
782 |
// Cache the cardtable |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49047
diff
changeset
|
783 |
_card_table = heap->card_table(); |
1 | 784 |
|
785 |
_counters = new CollectorCounters("PSScavenge", 0); |
|
786 |
} |