Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @ 10185:d50cc62e94ff
8012715: G1: GraphKit accesses PtrQueue::_index as int but is size_t
Summary: In graphKit INT operations were generated to access PtrQueue::_index which has type size_t. This is 64 bit on 64-bit machines. No problems occur on little endian machines as long as the index fits into 32 bit, but on big endian machines the upper part is read, which is zero. This leads to unnecessary branches to the slow path in the runtime.
Reviewed-by: twisti, johnc
Contributed-by: Martin Doerr <martin.doerr@sap.com>
author | johnc |
---|---|
date | Wed, 24 Apr 2013 14:48:43 -0700 |
parents | d0aa87f04bd5 |
children | 92ef81e2f571 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4095
diff
changeset
|
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1311
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1311
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1311
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/systemDictionary.hpp" | |
27 #include "code/codeCache.hpp" | |
28 #include "gc_implementation/parallelScavenge/pcTasks.hpp" | |
29 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" | |
30 #include "gc_interface/collectedHeap.hpp" | |
31 #include "memory/universe.hpp" | |
32 #include "oops/objArrayKlass.inline.hpp" | |
33 #include "oops/oop.inline.hpp" | |
34 #include "oops/oop.pcgc.inline.hpp" | |
35 #include "prims/jvmtiExport.hpp" | |
36 #include "runtime/fprofiler.hpp" | |
37 #include "runtime/jniHandles.hpp" | |
38 #include "runtime/thread.hpp" | |
39 #include "runtime/vmThread.hpp" | |
40 #include "services/management.hpp" | |
0 | 41 |
42 // | |
43 // ThreadRootsMarkingTask | |
44 // | |
45 | |
46 void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) { | |
47 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
48 | |
49 ResourceMark rm; | |
50 | |
51 NOT_PRODUCT(TraceTime tm("ThreadRootsMarkingTask", | |
52 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
53 ParCompactionManager* cm = | |
54 ParCompactionManager::gc_thread_compaction_manager(which); | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
55 |
0 | 56 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
57 CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true); |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
58 CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true); |
0 | 59 |
60 if (_java_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
61 _java_thread->oops_do( |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
62 &mark_and_push_closure, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
63 &mark_and_push_from_clds, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
64 &mark_and_push_in_blobs); |
0 | 65 |
66 if (_vm_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
67 _vm_thread->oops_do( |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
68 &mark_and_push_closure, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
69 &mark_and_push_from_clds, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
70 &mark_and_push_in_blobs); |
0 | 71 |
72 // Do the real work | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
73 cm->follow_marking_stacks(); |
0 | 74 } |
75 | |
76 | |
77 void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { | |
78 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
79 | |
80 NOT_PRODUCT(TraceTime tm("MarkFromRootsTask", | |
81 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
82 ParCompactionManager* cm = | |
83 ParCompactionManager::gc_thread_compaction_manager(which); | |
84 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4095
diff
changeset
|
85 PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); |
0 | 86 |
87 switch (_root_type) { | |
88 case universe: | |
89 Universe::oops_do(&mark_and_push_closure); | |
90 break; | |
91 | |
92 case jni_handles: | |
93 JNIHandles::oops_do(&mark_and_push_closure); | |
94 break; | |
95 | |
96 case threads: | |
97 { | |
98 ResourceMark rm; | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
99 CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true); |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
100 CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure); |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
101 Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob); |
0 | 102 } |
103 break; | |
104 | |
105 case object_synchronizer: | |
106 ObjectSynchronizer::oops_do(&mark_and_push_closure); | |
107 break; | |
108 | |
109 case flat_profiler: | |
110 FlatProfiler::oops_do(&mark_and_push_closure); | |
111 break; | |
112 | |
113 case management: | |
114 Management::oops_do(&mark_and_push_closure); | |
115 break; | |
116 | |
117 case jvmti: | |
118 JvmtiExport::oops_do(&mark_and_push_closure); | |
119 break; | |
120 | |
121 case system_dictionary: | |
122 SystemDictionary::always_strong_oops_do(&mark_and_push_closure); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4095
diff
changeset
|
123 ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true); |
0 | 124 break; |
125 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
126 case code_cache: |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
127 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them. |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
128 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(&mark_and_push_closure)); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
129 break; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
130 |
0 | 131 default: |
132 fatal("Unknown root type"); | |
133 } | |
134 | |
135 // Do the real work | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
136 cm->follow_marking_stacks(); |
0 | 137 } |
138 | |
139 | |
140 // | |
141 // RefProcTaskProxy | |
142 // | |
143 | |
144 void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which) | |
145 { | |
146 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
147 | |
148 NOT_PRODUCT(TraceTime tm("RefProcTask", | |
149 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
150 ParCompactionManager* cm = | |
151 ParCompactionManager::gc_thread_compaction_manager(which); | |
152 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
153 PSParallelCompact::FollowStackClosure follow_stack_closure(cm); | |
154 _rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), | |
155 mark_and_push_closure, follow_stack_closure); | |
156 } | |
157 | |
158 // | |
159 // RefProcTaskExecutor | |
160 // | |
161 | |
162 void RefProcTaskExecutor::execute(ProcessTask& task) | |
163 { | |
164 ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); | |
165 uint parallel_gc_threads = heap->gc_task_manager()->workers(); | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
166 uint active_gc_threads = heap->gc_task_manager()->active_workers(); |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
167 RegionTaskQueueSet* qset = ParCompactionManager::region_array(); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
168 ParallelTaskTerminator terminator(active_gc_threads, qset); |
0 | 169 GCTaskQueue* q = GCTaskQueue::create(); |
170 for(uint i=0; i<parallel_gc_threads; i++) { | |
171 q->enqueue(new RefProcTaskProxy(task, i)); | |
172 } | |
173 if (task.marks_oops_alive()) { | |
174 if (parallel_gc_threads>1) { | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
175 for (uint j=0; j<active_gc_threads; j++) { |
0 | 176 q->enqueue(new StealMarkingTask(&terminator)); |
177 } | |
178 } | |
179 } | |
180 PSParallelCompact::gc_task_manager()->execute_and_wait(q); | |
181 } | |
182 | |
183 void RefProcTaskExecutor::execute(EnqueueTask& task) | |
184 { | |
185 ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); | |
186 uint parallel_gc_threads = heap->gc_task_manager()->workers(); | |
187 GCTaskQueue* q = GCTaskQueue::create(); | |
188 for(uint i=0; i<parallel_gc_threads; i++) { | |
189 q->enqueue(new RefEnqueueTaskProxy(task, i)); | |
190 } | |
191 PSParallelCompact::gc_task_manager()->execute_and_wait(q); | |
192 } | |
193 | |
194 // | |
195 // StealMarkingTask | |
196 // | |
197 | |
198 StealMarkingTask::StealMarkingTask(ParallelTaskTerminator* t) : | |
199 _terminator(t) {} | |
200 | |
201 void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { | |
202 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
203 | |
204 NOT_PRODUCT(TraceTime tm("StealMarkingTask", | |
205 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
206 | |
207 ParCompactionManager* cm = | |
208 ParCompactionManager::gc_thread_compaction_manager(which); | |
209 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
210 | |
211 oop obj = NULL; | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
212 ObjArrayTask task; |
0 | 213 int random_seed = 17; |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
214 do { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
215 while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
216 ObjArrayKlass* const k = (ObjArrayKlass*)task.obj()->klass(); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
217 k->oop_follow_contents(cm, task.obj(), task.index()); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
218 cm->follow_marking_stacks(); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
219 } |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
220 while (ParCompactionManager::steal(which, &random_seed, obj)) { |
0 | 221 obj->follow_contents(cm); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
222 cm->follow_marking_stacks(); |
0 | 223 } |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
224 } while (!terminator()->offer_termination()); |
0 | 225 } |
226 | |
227 // | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
228 // StealRegionCompactionTask |
0 | 229 // |
230 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
231 StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t): |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
232 _terminator(t) {} |
0 | 233 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
234 void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { |
0 | 235 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
236 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
237 NOT_PRODUCT(TraceTime tm("StealRegionCompactionTask", |
0 | 238 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
239 | |
240 ParCompactionManager* cm = | |
241 ParCompactionManager::gc_thread_compaction_manager(which); | |
242 | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
243 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
244 // If not all threads are active, get a draining stack |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
245 // from the list. Else, just use this threads draining stack. |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
246 uint which_stack_index; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
247 bool use_all_workers = manager->all_workers_active(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
248 if (use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
249 which_stack_index = which; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
250 assert(manager->active_workers() == ParallelGCThreads, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
251 err_msg("all_workers_active has been incorrectly set: " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
252 " active %d ParallelGCThreads %d", manager->active_workers(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
253 ParallelGCThreads)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
254 } else { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
255 which_stack_index = ParCompactionManager::pop_recycled_stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
256 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
257 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
258 cm->set_region_stack_index(which_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
259 cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
260 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
261 gclog_or_tty->print_cr("StealRegionCompactionTask::do_it " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
262 "region_stack_index %d region_stack = 0x%x " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
263 " empty (%d) use all workers %d", |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
264 which_stack_index, ParCompactionManager::region_list(which_stack_index), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
265 cm->region_stack()->is_empty(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
266 use_all_workers); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
267 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
268 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
269 // Has to drain stacks first because there may be regions on |
0 | 270 // preloaded onto the stack and this thread may never have |
271 // done a draining task. Are the draining tasks needed? | |
272 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
273 cm->drain_region_stacks(); |
0 | 274 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
275 size_t region_index = 0; |
0 | 276 int random_seed = 17; |
277 | |
278 // If we're the termination task, try 10 rounds of stealing before | |
279 // setting the termination flag | |
280 | |
281 while(true) { | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
282 if (ParCompactionManager::steal(which, &random_seed, region_index)) { |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
283 PSParallelCompact::fill_and_update_region(cm, region_index); |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
284 cm->drain_region_stacks(); |
0 | 285 } else { |
286 if (terminator()->offer_termination()) { | |
287 break; | |
288 } | |
289 // Go around again. | |
290 } | |
291 } | |
292 return; | |
293 } | |
294 | |
295 UpdateDensePrefixTask::UpdateDensePrefixTask( | |
296 PSParallelCompact::SpaceId space_id, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
297 size_t region_index_start, |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
298 size_t region_index_end) : |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
299 _space_id(space_id), _region_index_start(region_index_start), |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
300 _region_index_end(region_index_end) {} |
0 | 301 |
302 void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { | |
303 | |
304 NOT_PRODUCT(TraceTime tm("UpdateDensePrefixTask", | |
305 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
306 | |
307 ParCompactionManager* cm = | |
308 ParCompactionManager::gc_thread_compaction_manager(which); | |
309 | |
310 PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, | |
311 _space_id, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
312 _region_index_start, |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
313 _region_index_end); |
0 | 314 } |
315 | |
316 void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { | |
317 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
318 | |
319 NOT_PRODUCT(TraceTime tm("DrainStacksCompactionTask", | |
320 PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); | |
321 | |
322 ParCompactionManager* cm = | |
323 ParCompactionManager::gc_thread_compaction_manager(which); | |
324 | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
325 uint which_stack_index; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
326 bool use_all_workers = manager->all_workers_active(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
327 if (use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
328 which_stack_index = which; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
329 assert(manager->active_workers() == ParallelGCThreads, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
330 err_msg("all_workers_active has been incorrectly set: " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
331 " active %d ParallelGCThreads %d", manager->active_workers(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
332 ParallelGCThreads)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
333 } else { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
334 which_stack_index = stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
335 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
336 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
337 cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
338 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
339 gclog_or_tty->print_cr("DrainStacksCompactionTask::do_it which = %d " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
340 "which_stack_index = %d/empty(%d) " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
341 "use all workers %d", |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
342 which, which_stack_index, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
343 cm->region_stack()->is_empty(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
344 use_all_workers); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
345 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
346 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
347 cm->set_region_stack_index(which_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
348 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
349 // Process any regions already in the compaction managers stacks. |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
350 cm->drain_region_stacks(); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
351 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
352 assert(cm->region_stack()->is_empty(), "Not empty"); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
353 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
354 if (!use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
355 // Always give up the region stack. |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
356 assert(cm->region_stack() == |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
357 ParCompactionManager::region_list(cm->region_stack_index()), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
358 "region_stack and region_stack_index are inconsistent"); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
359 ParCompactionManager::push_recycled_stack_index(cm->region_stack_index()); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
360 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
361 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
362 void* old_region_stack = (void*) cm->region_stack(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
363 int old_region_stack_index = cm->region_stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
364 gclog_or_tty->print_cr("Pushing region stack 0x%x/%d", |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
365 old_region_stack, old_region_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
366 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
367 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
368 cm->set_region_stack(NULL); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
369 cm->set_region_stack_index((uint)max_uintx); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
370 } |
0 | 371 } |