Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @ 12233:40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
Summary: Use conservative assumptions of required alignment for the various garbage collector components into account when determining the maximum heap size that supports compressed oops. Using this conservative value avoids several circular dependencies in the calculation.
Reviewed-by: stefank, dholmes
author | tschatzl |
---|---|
date | Wed, 11 Sep 2013 16:25:02 +0200 |
parents | f2110083203d |
children | 78bbf4d43a14 |
rev | line source |
---|---|
0 | 1 /* |
10265
92ef81e2f571
8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents:
7179
diff
changeset
|
2 * Copyright (c) 2005, 2013, 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" | |
10405 | 30 #include "gc_implementation/shared/gcTimer.hpp" |
31 #include "gc_implementation/shared/gcTraceTime.hpp" | |
1972 | 32 #include "gc_interface/collectedHeap.hpp" |
33 #include "memory/universe.hpp" | |
34 #include "oops/objArrayKlass.inline.hpp" | |
35 #include "oops/oop.inline.hpp" | |
36 #include "oops/oop.pcgc.inline.hpp" | |
37 #include "prims/jvmtiExport.hpp" | |
38 #include "runtime/fprofiler.hpp" | |
39 #include "runtime/jniHandles.hpp" | |
40 #include "runtime/thread.hpp" | |
41 #include "runtime/vmThread.hpp" | |
42 #include "services/management.hpp" | |
0 | 43 |
44 // | |
45 // ThreadRootsMarkingTask | |
46 // | |
47 | |
48 void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) { | |
49 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
50 | |
51 ResourceMark rm; | |
52 | |
10405 | 53 NOT_PRODUCT(GCTraceTime tm("ThreadRootsMarkingTask", |
54 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 55 ParCompactionManager* cm = |
56 ParCompactionManager::gc_thread_compaction_manager(which); | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
57 |
0 | 58 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
59 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
|
60 CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true); |
0 | 61 |
62 if (_java_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
63 _java_thread->oops_do( |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
64 &mark_and_push_closure, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
65 &mark_and_push_from_clds, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
66 &mark_and_push_in_blobs); |
0 | 67 |
68 if (_vm_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
69 _vm_thread->oops_do( |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
70 &mark_and_push_closure, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
71 &mark_and_push_from_clds, |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6831
diff
changeset
|
72 &mark_and_push_in_blobs); |
0 | 73 |
74 // Do the real work | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
75 cm->follow_marking_stacks(); |
0 | 76 } |
77 | |
78 | |
79 void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { | |
80 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
81 | |
10405 | 82 NOT_PRODUCT(GCTraceTime tm("MarkFromRootsTask", |
83 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 84 ParCompactionManager* cm = |
85 ParCompactionManager::gc_thread_compaction_manager(which); | |
86 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4095
diff
changeset
|
87 PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); |
0 | 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; | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
101 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
|
102 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
|
103 Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob); |
0 | 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); | |
10361
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
10265
diff
changeset
|
125 break; |
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
10265
diff
changeset
|
126 |
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
10265
diff
changeset
|
127 case class_loader_data: |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4095
diff
changeset
|
128 ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true); |
0 | 129 break; |
130 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
131 case code_cache: |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
132 // 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
|
133 //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
|
134 break; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
375
diff
changeset
|
135 |
0 | 136 default: |
137 fatal("Unknown root type"); | |
138 } | |
139 | |
140 // Do the real work | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
141 cm->follow_marking_stacks(); |
0 | 142 } |
143 | |
144 | |
145 // | |
146 // RefProcTaskProxy | |
147 // | |
148 | |
149 void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which) | |
150 { | |
151 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
152 | |
10405 | 153 NOT_PRODUCT(GCTraceTime tm("RefProcTask", |
154 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 155 ParCompactionManager* cm = |
156 ParCompactionManager::gc_thread_compaction_manager(which); | |
157 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
158 PSParallelCompact::FollowStackClosure follow_stack_closure(cm); | |
159 _rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), | |
160 mark_and_push_closure, follow_stack_closure); | |
161 } | |
162 | |
163 // | |
164 // RefProcTaskExecutor | |
165 // | |
166 | |
167 void RefProcTaskExecutor::execute(ProcessTask& task) | |
168 { | |
169 ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); | |
170 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
|
171 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
|
172 RegionTaskQueueSet* qset = ParCompactionManager::region_array(); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
173 ParallelTaskTerminator terminator(active_gc_threads, qset); |
0 | 174 GCTaskQueue* q = GCTaskQueue::create(); |
175 for(uint i=0; i<parallel_gc_threads; i++) { | |
176 q->enqueue(new RefProcTaskProxy(task, i)); | |
177 } | |
178 if (task.marks_oops_alive()) { | |
179 if (parallel_gc_threads>1) { | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
180 for (uint j=0; j<active_gc_threads; j++) { |
0 | 181 q->enqueue(new StealMarkingTask(&terminator)); |
182 } | |
183 } | |
184 } | |
185 PSParallelCompact::gc_task_manager()->execute_and_wait(q); | |
186 } | |
187 | |
188 void RefProcTaskExecutor::execute(EnqueueTask& task) | |
189 { | |
190 ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); | |
191 uint parallel_gc_threads = heap->gc_task_manager()->workers(); | |
192 GCTaskQueue* q = GCTaskQueue::create(); | |
193 for(uint i=0; i<parallel_gc_threads; i++) { | |
194 q->enqueue(new RefEnqueueTaskProxy(task, i)); | |
195 } | |
196 PSParallelCompact::gc_task_manager()->execute_and_wait(q); | |
197 } | |
198 | |
199 // | |
200 // StealMarkingTask | |
201 // | |
202 | |
203 StealMarkingTask::StealMarkingTask(ParallelTaskTerminator* t) : | |
204 _terminator(t) {} | |
205 | |
206 void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { | |
207 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
208 | |
10405 | 209 NOT_PRODUCT(GCTraceTime tm("StealMarkingTask", |
210 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 211 |
212 ParCompactionManager* cm = | |
213 ParCompactionManager::gc_thread_compaction_manager(which); | |
214 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); | |
215 | |
216 oop obj = NULL; | |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
217 ObjArrayTask task; |
0 | 218 int random_seed = 17; |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
219 do { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
220 while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { |
10265
92ef81e2f571
8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents:
7179
diff
changeset
|
221 ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass(); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
222 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
|
223 cm->follow_marking_stacks(); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
224 } |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
225 while (ParCompactionManager::steal(which, &random_seed, obj)) { |
0 | 226 obj->follow_contents(cm); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
227 cm->follow_marking_stacks(); |
0 | 228 } |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1000
diff
changeset
|
229 } while (!terminator()->offer_termination()); |
0 | 230 } |
231 | |
232 // | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
233 // StealRegionCompactionTask |
0 | 234 // |
235 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
236 StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t): |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
237 _terminator(t) {} |
0 | 238 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
239 void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { |
0 | 240 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
241 | |
10405 | 242 NOT_PRODUCT(GCTraceTime tm("StealRegionCompactionTask", |
243 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 244 |
245 ParCompactionManager* cm = | |
246 ParCompactionManager::gc_thread_compaction_manager(which); | |
247 | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
248 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
249 // 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
|
250 // 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
|
251 uint which_stack_index; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
252 bool use_all_workers = manager->all_workers_active(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
253 if (use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
254 which_stack_index = which; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
255 assert(manager->active_workers() == ParallelGCThreads, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
256 err_msg("all_workers_active has been incorrectly set: " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
257 " active %d ParallelGCThreads %d", manager->active_workers(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
258 ParallelGCThreads)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
259 } else { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
260 which_stack_index = ParCompactionManager::pop_recycled_stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
261 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
262 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
263 cm->set_region_stack_index(which_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
264 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
|
265 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
266 gclog_or_tty->print_cr("StealRegionCompactionTask::do_it " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
267 "region_stack_index %d region_stack = 0x%x " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
268 " empty (%d) use all workers %d", |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
269 which_stack_index, ParCompactionManager::region_list(which_stack_index), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
270 cm->region_stack()->is_empty(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
271 use_all_workers); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
272 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
273 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
274 // Has to drain stacks first because there may be regions on |
0 | 275 // preloaded onto the stack and this thread may never have |
276 // done a draining task. Are the draining tasks needed? | |
277 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
278 cm->drain_region_stacks(); |
0 | 279 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
280 size_t region_index = 0; |
0 | 281 int random_seed = 17; |
282 | |
283 // If we're the termination task, try 10 rounds of stealing before | |
284 // setting the termination flag | |
285 | |
286 while(true) { | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
287 if (ParCompactionManager::steal(which, &random_seed, region_index)) { |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
288 PSParallelCompact::fill_and_update_region(cm, region_index); |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
289 cm->drain_region_stacks(); |
0 | 290 } else { |
291 if (terminator()->offer_termination()) { | |
292 break; | |
293 } | |
294 // Go around again. | |
295 } | |
296 } | |
297 return; | |
298 } | |
299 | |
300 UpdateDensePrefixTask::UpdateDensePrefixTask( | |
301 PSParallelCompact::SpaceId space_id, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
302 size_t region_index_start, |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
303 size_t region_index_end) : |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
304 _space_id(space_id), _region_index_start(region_index_start), |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
305 _region_index_end(region_index_end) {} |
0 | 306 |
307 void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { | |
308 | |
10405 | 309 NOT_PRODUCT(GCTraceTime tm("UpdateDensePrefixTask", |
310 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 311 |
312 ParCompactionManager* cm = | |
313 ParCompactionManager::gc_thread_compaction_manager(which); | |
314 | |
315 PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, | |
316 _space_id, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
317 _region_index_start, |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
318 _region_index_end); |
0 | 319 } |
320 | |
321 void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { | |
322 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
323 | |
10405 | 324 NOT_PRODUCT(GCTraceTime tm("DrainStacksCompactionTask", |
325 PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); | |
0 | 326 |
327 ParCompactionManager* cm = | |
328 ParCompactionManager::gc_thread_compaction_manager(which); | |
329 | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
330 uint which_stack_index; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
331 bool use_all_workers = manager->all_workers_active(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
332 if (use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
333 which_stack_index = which; |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
334 assert(manager->active_workers() == ParallelGCThreads, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
335 err_msg("all_workers_active has been incorrectly set: " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
336 " active %d ParallelGCThreads %d", manager->active_workers(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
337 ParallelGCThreads)); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
338 } else { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
339 which_stack_index = stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
340 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
341 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
342 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
|
343 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
344 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
|
345 "which_stack_index = %d/empty(%d) " |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
346 "use all workers %d", |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
347 which, which_stack_index, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
348 cm->region_stack()->is_empty(), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
349 use_all_workers); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
350 } |
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 cm->set_region_stack_index(which_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
353 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
354 // Process any regions already in the compaction managers stacks. |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
196
diff
changeset
|
355 cm->drain_region_stacks(); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
356 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
357 assert(cm->region_stack()->is_empty(), "Not empty"); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
358 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
359 if (!use_all_workers) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
360 // Always give up the region stack. |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
361 assert(cm->region_stack() == |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
362 ParCompactionManager::region_list(cm->region_stack_index()), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
363 "region_stack and region_stack_index are inconsistent"); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
364 ParCompactionManager::push_recycled_stack_index(cm->region_stack_index()); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
365 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
366 if (TraceDynamicGCThreads) { |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
367 void* old_region_stack = (void*) cm->region_stack(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
368 int old_region_stack_index = cm->region_stack_index(); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
369 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
|
370 old_region_stack, old_region_stack_index); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
371 } |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
372 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
373 cm->set_region_stack(NULL); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
374 cm->set_region_stack_index((uint)max_uintx); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
375 } |
0 | 376 } |