author | coleenp |
Sat, 01 Sep 2012 13:25:18 -0400 | |
changeset 13728 | 882756847a04 |
parent 11174 | fccee5238e70 |
child 13952 | e3cf184080bc |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11174
diff
changeset
|
2 |
* Copyright (c) 2005, 2012, 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" |
|
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" |
|
1 | 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); |
|
55 |
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
56 |
CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true); |
1 | 57 |
|
58 |
if (_java_thread != NULL) |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
59 |
_java_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs); |
1 | 60 |
|
61 |
if (_vm_thread != NULL) |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
62 |
_vm_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs); |
1 | 63 |
|
64 |
// Do the real work |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
65 |
cm->follow_marking_stacks(); |
1 | 66 |
} |
67 |
||
68 |
||
69 |
void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
70 |
assert(Universe::heap()->is_gc_active(), "called outside gc"); |
|
71 |
||
72 |
NOT_PRODUCT(TraceTime tm("MarkFromRootsTask", |
|
73 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
|
74 |
ParCompactionManager* cm = |
|
75 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
76 |
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11174
diff
changeset
|
77 |
PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); |
1 | 78 |
|
79 |
switch (_root_type) { |
|
80 |
case universe: |
|
81 |
Universe::oops_do(&mark_and_push_closure); |
|
82 |
break; |
|
83 |
||
84 |
case jni_handles: |
|
85 |
JNIHandles::oops_do(&mark_and_push_closure); |
|
86 |
break; |
|
87 |
||
88 |
case threads: |
|
89 |
{ |
|
90 |
ResourceMark rm; |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
91 |
CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
92 |
Threads::oops_do(&mark_and_push_closure, &each_active_code_blob); |
1 | 93 |
} |
94 |
break; |
|
95 |
||
96 |
case object_synchronizer: |
|
97 |
ObjectSynchronizer::oops_do(&mark_and_push_closure); |
|
98 |
break; |
|
99 |
||
100 |
case flat_profiler: |
|
101 |
FlatProfiler::oops_do(&mark_and_push_closure); |
|
102 |
break; |
|
103 |
||
104 |
case management: |
|
105 |
Management::oops_do(&mark_and_push_closure); |
|
106 |
break; |
|
107 |
||
108 |
case jvmti: |
|
109 |
JvmtiExport::oops_do(&mark_and_push_closure); |
|
110 |
break; |
|
111 |
||
112 |
case system_dictionary: |
|
113 |
SystemDictionary::always_strong_oops_do(&mark_and_push_closure); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11174
diff
changeset
|
114 |
ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true); |
1 | 115 |
break; |
116 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
117 |
case code_cache: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
118 |
// 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
|
119 |
//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
|
120 |
break; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1407
diff
changeset
|
121 |
|
1 | 122 |
default: |
123 |
fatal("Unknown root type"); |
|
124 |
} |
|
125 |
||
126 |
// Do the real work |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
127 |
cm->follow_marking_stacks(); |
1 | 128 |
} |
129 |
||
130 |
||
131 |
// |
|
132 |
// RefProcTaskProxy |
|
133 |
// |
|
134 |
||
135 |
void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which) |
|
136 |
{ |
|
137 |
assert(Universe::heap()->is_gc_active(), "called outside gc"); |
|
138 |
||
139 |
NOT_PRODUCT(TraceTime tm("RefProcTask", |
|
140 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
|
141 |
ParCompactionManager* cm = |
|
142 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
143 |
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
|
144 |
PSParallelCompact::FollowStackClosure follow_stack_closure(cm); |
|
145 |
_rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), |
|
146 |
mark_and_push_closure, follow_stack_closure); |
|
147 |
} |
|
148 |
||
149 |
// |
|
150 |
// RefProcTaskExecutor |
|
151 |
// |
|
152 |
||
153 |
void RefProcTaskExecutor::execute(ProcessTask& task) |
|
154 |
{ |
|
155 |
ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); |
|
156 |
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
|
157 |
uint active_gc_threads = heap->gc_task_manager()->active_workers(); |
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
158 |
RegionTaskQueueSet* qset = ParCompactionManager::region_array(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
159 |
ParallelTaskTerminator terminator(active_gc_threads, qset); |
1 | 160 |
GCTaskQueue* q = GCTaskQueue::create(); |
161 |
for(uint i=0; i<parallel_gc_threads; i++) { |
|
162 |
q->enqueue(new RefProcTaskProxy(task, i)); |
|
163 |
} |
|
164 |
if (task.marks_oops_alive()) { |
|
165 |
if (parallel_gc_threads>1) { |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
166 |
for (uint j=0; j<active_gc_threads; j++) { |
1 | 167 |
q->enqueue(new StealMarkingTask(&terminator)); |
168 |
} |
|
169 |
} |
|
170 |
} |
|
171 |
PSParallelCompact::gc_task_manager()->execute_and_wait(q); |
|
172 |
} |
|
173 |
||
174 |
void RefProcTaskExecutor::execute(EnqueueTask& task) |
|
175 |
{ |
|
176 |
ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); |
|
177 |
uint parallel_gc_threads = heap->gc_task_manager()->workers(); |
|
178 |
GCTaskQueue* q = GCTaskQueue::create(); |
|
179 |
for(uint i=0; i<parallel_gc_threads; i++) { |
|
180 |
q->enqueue(new RefEnqueueTaskProxy(task, i)); |
|
181 |
} |
|
182 |
PSParallelCompact::gc_task_manager()->execute_and_wait(q); |
|
183 |
} |
|
184 |
||
185 |
// |
|
186 |
// StealMarkingTask |
|
187 |
// |
|
188 |
||
189 |
StealMarkingTask::StealMarkingTask(ParallelTaskTerminator* t) : |
|
190 |
_terminator(t) {} |
|
191 |
||
192 |
void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { |
|
193 |
assert(Universe::heap()->is_gc_active(), "called outside gc"); |
|
194 |
||
195 |
NOT_PRODUCT(TraceTime tm("StealMarkingTask", |
|
196 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
|
197 |
||
198 |
ParCompactionManager* cm = |
|
199 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
200 |
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
|
201 |
||
202 |
oop obj = NULL; |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
203 |
ObjArrayTask task; |
1 | 204 |
int random_seed = 17; |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
205 |
do { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
206 |
while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11174
diff
changeset
|
207 |
objArrayKlass* const k = (objArrayKlass*)task.obj()->klass(); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
208 |
k->oop_follow_contents(cm, task.obj(), task.index()); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
209 |
cm->follow_marking_stacks(); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
210 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
211 |
while (ParCompactionManager::steal(which, &random_seed, obj)) { |
1 | 212 |
obj->follow_contents(cm); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
213 |
cm->follow_marking_stacks(); |
1 | 214 |
} |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
3919
diff
changeset
|
215 |
} while (!terminator()->offer_termination()); |
1 | 216 |
} |
217 |
||
218 |
// |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
219 |
// StealRegionCompactionTask |
1 | 220 |
// |
221 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
222 |
StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t): |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
223 |
_terminator(t) {} |
1 | 224 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
225 |
void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { |
1 | 226 |
assert(Universe::heap()->is_gc_active(), "called outside gc"); |
227 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
228 |
NOT_PRODUCT(TraceTime tm("StealRegionCompactionTask", |
1 | 229 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
230 |
||
231 |
ParCompactionManager* cm = |
|
232 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
233 |
||
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
234 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
235 |
// 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
|
236 |
// 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
|
237 |
uint which_stack_index; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
238 |
bool use_all_workers = manager->all_workers_active(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
239 |
if (use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
240 |
which_stack_index = which; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
241 |
assert(manager->active_workers() == ParallelGCThreads, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
242 |
err_msg("all_workers_active has been incorrectly set: " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
243 |
" active %d ParallelGCThreads %d", manager->active_workers(), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
244 |
ParallelGCThreads)); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
245 |
} else { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
246 |
which_stack_index = ParCompactionManager::pop_recycled_stack_index(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
247 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
248 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
249 |
cm->set_region_stack_index(which_stack_index); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
250 |
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
|
251 |
if (TraceDynamicGCThreads) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
252 |
gclog_or_tty->print_cr("StealRegionCompactionTask::do_it " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
253 |
"region_stack_index %d region_stack = 0x%x " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
254 |
" empty (%d) use all workers %d", |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
255 |
which_stack_index, ParCompactionManager::region_list(which_stack_index), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
256 |
cm->region_stack()->is_empty(), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
257 |
use_all_workers); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
258 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
259 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
260 |
// Has to drain stacks first because there may be regions on |
1 | 261 |
// preloaded onto the stack and this thread may never have |
262 |
// done a draining task. Are the draining tasks needed? |
|
263 |
||
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
264 |
cm->drain_region_stacks(); |
1 | 265 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
266 |
size_t region_index = 0; |
1 | 267 |
int random_seed = 17; |
268 |
||
269 |
// If we're the termination task, try 10 rounds of stealing before |
|
270 |
// setting the termination flag |
|
271 |
||
272 |
while(true) { |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
273 |
if (ParCompactionManager::steal(which, &random_seed, region_index)) { |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
274 |
PSParallelCompact::fill_and_update_region(cm, region_index); |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
275 |
cm->drain_region_stacks(); |
1 | 276 |
} else { |
277 |
if (terminator()->offer_termination()) { |
|
278 |
break; |
|
279 |
} |
|
280 |
// Go around again. |
|
281 |
} |
|
282 |
} |
|
283 |
return; |
|
284 |
} |
|
285 |
||
286 |
UpdateDensePrefixTask::UpdateDensePrefixTask( |
|
287 |
PSParallelCompact::SpaceId space_id, |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
288 |
size_t region_index_start, |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
289 |
size_t region_index_end) : |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
290 |
_space_id(space_id), _region_index_start(region_index_start), |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
291 |
_region_index_end(region_index_end) {} |
1 | 292 |
|
293 |
void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { |
|
294 |
||
295 |
NOT_PRODUCT(TraceTime tm("UpdateDensePrefixTask", |
|
296 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
|
297 |
||
298 |
ParCompactionManager* cm = |
|
299 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
300 |
||
301 |
PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, |
|
302 |
_space_id, |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
303 |
_region_index_start, |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
304 |
_region_index_end); |
1 | 305 |
} |
306 |
||
307 |
void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { |
|
308 |
assert(Universe::heap()->is_gc_active(), "called outside gc"); |
|
309 |
||
310 |
NOT_PRODUCT(TraceTime tm("DrainStacksCompactionTask", |
|
311 |
PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); |
|
312 |
||
313 |
ParCompactionManager* cm = |
|
314 |
ParCompactionManager::gc_thread_compaction_manager(which); |
|
315 |
||
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
316 |
uint which_stack_index; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
317 |
bool use_all_workers = manager->all_workers_active(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
318 |
if (use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
319 |
which_stack_index = which; |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
320 |
assert(manager->active_workers() == ParallelGCThreads, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
321 |
err_msg("all_workers_active has been incorrectly set: " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
322 |
" active %d ParallelGCThreads %d", manager->active_workers(), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
323 |
ParallelGCThreads)); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
324 |
} else { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
325 |
which_stack_index = stack_index(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
326 |
} |
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 |
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
|
329 |
if (TraceDynamicGCThreads) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
330 |
gclog_or_tty->print_cr("DrainStacksCompactionTask::do_it which = %d " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
331 |
"which_stack_index = %d/empty(%d) " |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
332 |
"use all workers %d", |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
333 |
which, which_stack_index, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
334 |
cm->region_stack()->is_empty(), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
335 |
use_all_workers); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
336 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
337 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
338 |
cm->set_region_stack_index(which_stack_index); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
339 |
|
1407
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
340 |
// Process any regions already in the compaction managers stacks. |
9006b01ba3fd
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
670
diff
changeset
|
341 |
cm->drain_region_stacks(); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
342 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
343 |
assert(cm->region_stack()->is_empty(), "Not empty"); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
344 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
345 |
if (!use_all_workers) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
346 |
// Always give up the region stack. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
347 |
assert(cm->region_stack() == |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
348 |
ParCompactionManager::region_list(cm->region_stack_index()), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
349 |
"region_stack and region_stack_index are inconsistent"); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
350 |
ParCompactionManager::push_recycled_stack_index(cm->region_stack_index()); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
351 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
352 |
if (TraceDynamicGCThreads) { |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
353 |
void* old_region_stack = (void*) cm->region_stack(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
354 |
int old_region_stack_index = cm->region_stack_index(); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
355 |
gclog_or_tty->print_cr("Pushing region stack 0x%x/%d", |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
356 |
old_region_stack, old_region_stack_index); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
357 |
} |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
358 |
|
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
359 |
cm->set_region_stack(NULL); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
360 |
cm->set_region_stack_index((uint)max_uintx); |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
361 |
} |
1 | 362 |
} |