author | mgerdin |
Tue, 05 Apr 2016 13:55:31 +0200 | |
changeset 37260 | 664b7520c44b |
parent 37248 | 11a660dbbb8e |
child 38074 | 8475fdc6dcc3 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
37248 | 2 |
* Copyright (c) 2005, 2016, 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:
5076
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
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:
5076
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
27 |
#include "code/codeCache.hpp" |
|
30764 | 28 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
29 |
#include "gc/parallel/pcTasks.hpp" |
|
30 |
#include "gc/parallel/psCompactionManager.inline.hpp" |
|
31 |
#include "gc/parallel/psParallelCompact.hpp" |
|
32 |
#include "gc/shared/collectedHeap.hpp" |
|
33 |
#include "gc/shared/gcTimer.hpp" |
|
35061 | 34 |
#include "gc/shared/gcTraceTime.inline.hpp" |
35 |
#include "logging/log.hpp" |
|
37248 | 36 |
#include "memory/resourceArea.hpp" |
7397 | 37 |
#include "memory/universe.hpp" |
38 |
#include "oops/objArrayKlass.inline.hpp" |
|
39 |
#include "oops/oop.inline.hpp" |
|
40 |
#include "prims/jvmtiExport.hpp" |
|
41 |
#include "runtime/fprofiler.hpp" |
|
42 |
#include "runtime/jniHandles.hpp" |
|
43 |
#include "runtime/thread.hpp" |
|
44 |
#include "runtime/vmThread.hpp" |
|
45 |
#include "services/management.hpp" |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
46 |
#include "utilities/stack.inline.hpp" |
1 | 47 |
|
48 |
// |
|
49 |
// ThreadRootsMarkingTask |
|
50 |
// |
|
51 |
||
52 |
void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
53 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 54 |
|
55 |
ResourceMark rm; |
|
56 |
||
57 |
ParCompactionManager* cm = |
|
58 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
59 |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
60 |
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); |
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
61 |
CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
62 |
MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations); |
1 | 63 |
|
64 |
if (_java_thread != NULL) |
|
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
65 |
_java_thread->oops_do( |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
66 |
&mark_and_push_closure, |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
67 |
&mark_and_push_from_clds, |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
68 |
&mark_and_push_in_blobs); |
1 | 69 |
|
70 |
if (_vm_thread != NULL) |
|
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
71 |
_vm_thread->oops_do( |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
72 |
&mark_and_push_closure, |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
73 |
&mark_and_push_from_clds, |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
74 |
&mark_and_push_in_blobs); |
1 | 75 |
|
76 |
// Do the real work |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
77 |
cm->follow_marking_stacks(); |
1 | 78 |
} |
79 |
||
80 |
||
81 |
void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
82 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 83 |
|
84 |
ParCompactionManager* cm = |
|
85 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
86 |
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); |
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
87 |
ParCompactionManager::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); |
1 | 88 |
|
89 |
switch (_root_type) { |
|
90 |
case universe: |
|
91 |
Universe::oops_do(&mark_and_push_closure); |
|
92 |
break; |
|
93 |
||
94 |
case jni_handles: |
|
95 |
JNIHandles::oops_do(&mark_and_push_closure); |
|
96 |
break; |
|
97 |
||
98 |
case threads: |
|
99 |
{ |
|
100 |
ResourceMark rm; |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
101 |
MarkingCodeBlobClosure each_active_code_blob(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations); |
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
102 |
CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
13952
diff
changeset
|
103 |
Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob); |
1 | 104 |
} |
105 |
break; |
|
106 |
||
107 |
case object_synchronizer: |
|
108 |
ObjectSynchronizer::oops_do(&mark_and_push_closure); |
|
109 |
break; |
|
110 |
||
111 |
case flat_profiler: |
|
112 |
FlatProfiler::oops_do(&mark_and_push_closure); |
|
113 |
break; |
|
114 |
||
115 |
case management: |
|
116 |
Management::oops_do(&mark_and_push_closure); |
|
117 |
break; |
|
118 |
||
119 |
case jvmti: |
|
120 |
JvmtiExport::oops_do(&mark_and_push_closure); |
|
121 |
break; |
|
122 |
||
123 |
case system_dictionary: |
|
124 |
SystemDictionary::always_strong_oops_do(&mark_and_push_closure); |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
17370
diff
changeset
|
125 |
break; |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
17370
diff
changeset
|
126 |
|
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
17370
diff
changeset
|
127 |
case class_loader_data: |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11174
diff
changeset
|
128 |
ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true); |
1 | 129 |
break; |
130 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
131 |
case code_cache: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
132 |
// Do not treat nmethods as strong roots for mark/sweep, since we can unload them. |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
133 |
//CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(&mark_and_push_closure)); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
134 |
break; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
135 |
|
1 | 136 |
default: |
137 |
fatal("Unknown root type"); |
|
138 |
} |
|
139 |
||
140 |
// Do the real work |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
141 |
cm->follow_marking_stacks(); |
1 | 142 |
} |
143 |
||
144 |
||
145 |
// |
|
146 |
// RefProcTaskProxy |
|
147 |
// |
|
148 |
||
149 |
void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which) |
|
150 |
{ |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
151 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 152 |
|
153 |
ParCompactionManager* cm = |
|
154 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
155 |
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); |
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
156 |
ParCompactionManager::FollowStackClosure follow_stack_closure(cm); |
1 | 157 |
_rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), |
158 |
mark_and_push_closure, follow_stack_closure); |
|
159 |
} |
|
160 |
||
161 |
// |
|
162 |
// RefProcTaskExecutor |
|
163 |
// |
|
164 |
||
165 |
void RefProcTaskExecutor::execute(ProcessTask& task) |
|
166 |
{ |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
167 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 168 |
uint parallel_gc_threads = heap->gc_task_manager()->workers(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
169 |
uint active_gc_threads = heap->gc_task_manager()->active_workers(); |
37260
664b7520c44b
8153176: ParOldGC: Use correct TaskQueueSet for ParallelTaskTerminator in marking.
mgerdin
parents:
37248
diff
changeset
|
170 |
OopTaskQueueSet* qset = ParCompactionManager::stack_array(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
171 |
ParallelTaskTerminator terminator(active_gc_threads, qset); |
1 | 172 |
GCTaskQueue* q = GCTaskQueue::create(); |
173 |
for(uint i=0; i<parallel_gc_threads; i++) { |
|
174 |
q->enqueue(new RefProcTaskProxy(task, i)); |
|
175 |
} |
|
176 |
if (task.marks_oops_alive()) { |
|
177 |
if (parallel_gc_threads>1) { |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
178 |
for (uint j=0; j<active_gc_threads; j++) { |
1 | 179 |
q->enqueue(new StealMarkingTask(&terminator)); |
180 |
} |
|
181 |
} |
|
182 |
} |
|
183 |
PSParallelCompact::gc_task_manager()->execute_and_wait(q); |
|
184 |
} |
|
185 |
||
186 |
void RefProcTaskExecutor::execute(EnqueueTask& task) |
|
187 |
{ |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
188 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 189 |
uint parallel_gc_threads = heap->gc_task_manager()->workers(); |
190 |
GCTaskQueue* q = GCTaskQueue::create(); |
|
191 |
for(uint i=0; i<parallel_gc_threads; i++) { |
|
192 |
q->enqueue(new RefEnqueueTaskProxy(task, i)); |
|
193 |
} |
|
194 |
PSParallelCompact::gc_task_manager()->execute_and_wait(q); |
|
195 |
} |
|
196 |
||
197 |
// |
|
198 |
// StealMarkingTask |
|
199 |
// |
|
200 |
||
201 |
StealMarkingTask::StealMarkingTask(ParallelTaskTerminator* t) : |
|
202 |
_terminator(t) {} |
|
203 |
||
204 |
void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
205 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 206 |
|
207 |
ParCompactionManager* cm = |
|
208 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
30556
750fee2bdb45
8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents:
30173
diff
changeset
|
209 |
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); |
1 | 210 |
|
211 |
oop obj = NULL; |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
212 |
ObjArrayTask task; |
1 | 213 |
int random_seed = 17; |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
214 |
do { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
215 |
while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
29701
diff
changeset
|
216 |
cm->follow_contents((objArrayOop)task.obj(), task.index()); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
217 |
cm->follow_marking_stacks(); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
218 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
219 |
while (ParCompactionManager::steal(which, &random_seed, obj)) { |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
29701
diff
changeset
|
220 |
cm->follow_contents(obj); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
221 |
cm->follow_marking_stacks(); |
1 | 222 |
} |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
223 |
} while (!terminator()->offer_termination()); |
1 | 224 |
} |
225 |
||
226 |
// |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
227 |
// StealRegionCompactionTask |
1 | 228 |
// |
229 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
230 |
StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t): |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
231 |
_terminator(t) {} |
1 | 232 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
233 |
void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
234 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 235 |
|
236 |
ParCompactionManager* cm = |
|
237 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
238 |
||
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
239 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
240 |
// If not all threads are active, get a draining stack |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
241 |
// from the list. Else, just use this threads draining stack. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
242 |
uint which_stack_index; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
243 |
bool use_all_workers = manager->all_workers_active(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
244 |
if (use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
245 |
which_stack_index = which; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
246 |
assert(manager->active_workers() == ParallelGCThreads, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
247 |
"all_workers_active has been incorrectly set: " |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
248 |
" active %d ParallelGCThreads %u", manager->active_workers(), |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
249 |
ParallelGCThreads); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
250 |
} else { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
251 |
which_stack_index = ParCompactionManager::pop_recycled_stack_index(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
252 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
253 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
254 |
cm->set_region_stack_index(which_stack_index); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
255 |
cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
256 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
257 |
// Has to drain stacks first because there may be regions on |
1 | 258 |
// preloaded onto the stack and this thread may never have |
259 |
// done a draining task. Are the draining tasks needed? |
|
260 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
261 |
cm->drain_region_stacks(); |
1 | 262 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
263 |
size_t region_index = 0; |
1 | 264 |
int random_seed = 17; |
265 |
||
266 |
// If we're the termination task, try 10 rounds of stealing before |
|
267 |
// setting the termination flag |
|
268 |
||
269 |
while(true) { |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
270 |
if (ParCompactionManager::steal(which, &random_seed, region_index)) { |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
271 |
PSParallelCompact::fill_and_update_region(cm, region_index); |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
272 |
cm->drain_region_stacks(); |
1 | 273 |
} else { |
274 |
if (terminator()->offer_termination()) { |
|
275 |
break; |
|
276 |
} |
|
277 |
// Go around again. |
|
278 |
} |
|
279 |
} |
|
280 |
return; |
|
281 |
} |
|
282 |
||
283 |
UpdateDensePrefixTask::UpdateDensePrefixTask( |
|
284 |
PSParallelCompact::SpaceId space_id, |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
285 |
size_t region_index_start, |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
286 |
size_t region_index_end) : |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
287 |
_space_id(space_id), _region_index_start(region_index_start), |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
288 |
_region_index_end(region_index_end) {} |
1 | 289 |
|
290 |
void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { |
|
291 |
||
292 |
ParCompactionManager* cm = |
|
293 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
294 |
||
295 |
PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, |
|
296 |
_space_id, |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
297 |
_region_index_start, |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
298 |
_region_index_end); |
1 | 299 |
} |
300 |
||
301 |
void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
302 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 303 |
|
304 |
ParCompactionManager* cm = |
|
305 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
306 |
||
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
307 |
uint which_stack_index; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
308 |
bool use_all_workers = manager->all_workers_active(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
309 |
if (use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
310 |
which_stack_index = which; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
311 |
assert(manager->active_workers() == ParallelGCThreads, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
312 |
"all_workers_active has been incorrectly set: " |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
313 |
" active %d ParallelGCThreads %u", manager->active_workers(), |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31330
diff
changeset
|
314 |
ParallelGCThreads); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
315 |
} else { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
316 |
which_stack_index = stack_index(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
317 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
318 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
319 |
cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
320 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
321 |
cm->set_region_stack_index(which_stack_index); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
322 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
323 |
// Process any regions already in the compaction managers stacks. |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
324 |
cm->drain_region_stacks(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
325 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
326 |
assert(cm->region_stack()->is_empty(), "Not empty"); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
327 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
328 |
if (!use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
329 |
// Always give up the region stack. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
330 |
assert(cm->region_stack() == |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
331 |
ParCompactionManager::region_list(cm->region_stack_index()), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
332 |
"region_stack and region_stack_index are inconsistent"); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
333 |
ParCompactionManager::push_recycled_stack_index(cm->region_stack_index()); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
334 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
335 |
cm->set_region_stack(NULL); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
336 |
cm->set_region_stack_index((uint)max_uintx); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
337 |
} |
1 | 338 |
} |