Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @ 2015:79d8657be916
6993125: runThese crashes with assert(Thread::current()->on_local_stack((address)this))
Summary: add another ResourceObj debug field to distinguish garbage
Reviewed-by: dholmes, coleenp
author | kvn |
---|---|
date | Fri, 10 Dec 2010 14:14:02 -0800 |
parents | f95d63e2154a |
children | 3582bf76420e |
rev | line source |
---|---|
0 | 1 /* |
1833
8b10f48633dc
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
1552
diff
changeset
|
2 * Copyright (c) 2005, 2010, 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:
989
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
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:
989
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PCTASKS_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PCTASKS_HPP | |
27 | |
28 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" | |
29 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" | |
30 #include "gc_implementation/parallelScavenge/psTasks.hpp" | |
31 | |
0 | 32 |
33 // Tasks for parallel compaction of the old generation | |
34 // | |
35 // Tasks are created and enqueued on a task queue. The | |
36 // tasks for parallel old collector for marking objects | |
37 // are MarkFromRootsTask and ThreadRootsMarkingTask. | |
38 // | |
39 // MarkFromRootsTask's are created | |
40 // with a root group (e.g., jni_handles) and when the do_it() | |
41 // method of a MarkFromRootsTask is executed, it starts marking | |
42 // form it's root group. | |
43 // | |
44 // ThreadRootsMarkingTask's are created for each Java thread. When | |
45 // the do_it() method of a ThreadRootsMarkingTask is executed, it | |
46 // starts marking from the thread's roots. | |
47 // | |
48 // The enqueuing of the MarkFromRootsTask and ThreadRootsMarkingTask | |
49 // do little more than create the task and put it on a queue. The | |
50 // queue is a GCTaskQueue and threads steal tasks from this GCTaskQueue. | |
51 // | |
52 // In addition to the MarkFromRootsTask and ThreadRootsMarkingTask | |
53 // tasks there are StealMarkingTask tasks. The StealMarkingTask's | |
54 // steal a reference from the marking stack of another | |
55 // thread and transitively marks the object of the reference | |
56 // and internal references. After successfully stealing a reference | |
57 // and marking it, the StealMarkingTask drains its marking stack | |
58 // stack before attempting another steal. | |
59 // | |
60 // ThreadRootsMarkingTask | |
61 // | |
62 // This task marks from the roots of a single thread. This task | |
63 // enables marking of thread roots in parallel. | |
64 // | |
65 | |
66 class ParallelTaskTerminator; | |
67 | |
68 class ThreadRootsMarkingTask : public GCTask { | |
69 private: | |
70 JavaThread* _java_thread; | |
71 VMThread* _vm_thread; | |
72 public: | |
73 ThreadRootsMarkingTask(JavaThread* root) : _java_thread(root), _vm_thread(NULL) {} | |
74 ThreadRootsMarkingTask(VMThread* root) : _java_thread(NULL), _vm_thread(root) {} | |
75 | |
76 char* name() { return (char *)"thread-roots-marking-task"; } | |
77 | |
78 virtual void do_it(GCTaskManager* manager, uint which); | |
79 }; | |
80 | |
81 | |
82 // | |
83 // MarkFromRootsTask | |
84 // | |
85 // This task marks from all the roots to all live | |
86 // objects. | |
87 // | |
88 // | |
89 | |
90 class MarkFromRootsTask : public GCTask { | |
91 public: | |
92 enum RootType { | |
93 universe = 1, | |
94 jni_handles = 2, | |
95 threads = 3, | |
96 object_synchronizer = 4, | |
97 flat_profiler = 5, | |
98 management = 6, | |
99 jvmti = 7, | |
100 system_dictionary = 8, | |
101 vm_symbols = 9, | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
470
diff
changeset
|
102 reference_processing = 10, |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
470
diff
changeset
|
103 code_cache = 11 |
0 | 104 }; |
105 private: | |
106 RootType _root_type; | |
107 public: | |
108 MarkFromRootsTask(RootType value) : _root_type(value) {} | |
109 | |
110 char* name() { return (char *)"mark-from-roots-task"; } | |
111 | |
112 virtual void do_it(GCTaskManager* manager, uint which); | |
113 }; | |
114 | |
115 // | |
116 // RefProcTaskProxy | |
117 // | |
118 // This task is used as a proxy to parallel reference processing tasks . | |
119 // | |
120 | |
121 class RefProcTaskProxy : public GCTask { | |
122 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; | |
123 ProcessTask & _rp_task; | |
124 uint _work_id; | |
125 public: | |
126 RefProcTaskProxy(ProcessTask & rp_task, uint work_id) | |
127 : _rp_task(rp_task), | |
128 _work_id(work_id) | |
129 { } | |
130 | |
131 private: | |
132 virtual char* name() { return (char *)"Process referents by policy in parallel"; } | |
133 | |
134 virtual void do_it(GCTaskManager* manager, uint which); | |
135 }; | |
136 | |
137 | |
138 | |
139 // | |
140 // RefEnqueueTaskProxy | |
141 // | |
142 // This task is used as a proxy to parallel reference processing tasks . | |
143 // | |
144 | |
145 class RefEnqueueTaskProxy: public GCTask { | |
146 typedef AbstractRefProcTaskExecutor::EnqueueTask EnqueueTask; | |
147 EnqueueTask& _enq_task; | |
148 uint _work_id; | |
149 | |
150 public: | |
151 RefEnqueueTaskProxy(EnqueueTask& enq_task, uint work_id) | |
152 : _enq_task(enq_task), | |
153 _work_id(work_id) | |
154 { } | |
155 | |
156 virtual char* name() { return (char *)"Enqueue reference objects in parallel"; } | |
157 virtual void do_it(GCTaskManager* manager, uint which) | |
158 { | |
159 _enq_task.work(_work_id); | |
160 } | |
161 }; | |
162 | |
163 | |
164 // | |
165 // RefProcTaskExecutor | |
166 // | |
167 // Task executor is an interface for the reference processor to run | |
168 // tasks using GCTaskManager. | |
169 // | |
170 | |
171 class RefProcTaskExecutor: public AbstractRefProcTaskExecutor { | |
172 virtual void execute(ProcessTask& task); | |
173 virtual void execute(EnqueueTask& task); | |
174 }; | |
175 | |
176 | |
177 // | |
178 // StealMarkingTask | |
179 // | |
180 // This task is used to distribute work to idle threads. | |
181 // | |
182 | |
183 class StealMarkingTask : public GCTask { | |
184 private: | |
185 ParallelTaskTerminator* const _terminator; | |
186 private: | |
187 | |
188 public: | |
189 char* name() { return (char *)"steal-marking-task"; } | |
190 | |
191 StealMarkingTask(ParallelTaskTerminator* t); | |
192 | |
193 ParallelTaskTerminator* terminator() { return _terminator; } | |
194 | |
195 virtual void do_it(GCTaskManager* manager, uint which); | |
196 }; | |
197 | |
198 // | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
199 // StealRegionCompactionTask |
0 | 200 // |
201 // This task is used to distribute work to idle threads. | |
202 // | |
203 | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
204 class StealRegionCompactionTask : public GCTask { |
0 | 205 private: |
206 ParallelTaskTerminator* const _terminator; | |
207 public: | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
208 StealRegionCompactionTask(ParallelTaskTerminator* t); |
0 | 209 |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
210 char* name() { return (char *)"steal-region-task"; } |
0 | 211 ParallelTaskTerminator* terminator() { return _terminator; } |
212 | |
213 virtual void do_it(GCTaskManager* manager, uint which); | |
214 }; | |
215 | |
216 // | |
217 // UpdateDensePrefixTask | |
218 // | |
219 // This task is used to update the dense prefix | |
220 // of a space. | |
221 // | |
222 | |
223 class UpdateDensePrefixTask : public GCTask { | |
224 private: | |
225 PSParallelCompact::SpaceId _space_id; | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
226 size_t _region_index_start; |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
227 size_t _region_index_end; |
0 | 228 |
229 public: | |
230 char* name() { return (char *)"update-dense_prefix-task"; } | |
231 | |
232 UpdateDensePrefixTask(PSParallelCompact::SpaceId space_id, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
233 size_t region_index_start, |
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
234 size_t region_index_end); |
0 | 235 |
236 virtual void do_it(GCTaskManager* manager, uint which); | |
237 }; | |
238 | |
239 // | |
240 // DrainStacksCompactionTask | |
241 // | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
242 // This task processes regions that have been added to the stacks of each |
0 | 243 // compaction manager. |
244 // | |
245 // Trying to use one draining thread does not work because there are no | |
246 // guarantees about which task will be picked up by which thread. For example, | |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
247 // if thread A gets all the preloaded regions, thread A may not get a draining |
0 | 248 // task (they may all be done by other threads). |
249 // | |
250 | |
251 class DrainStacksCompactionTask : public GCTask { | |
1833
8b10f48633dc
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
1552
diff
changeset
|
252 uint _stack_index; |
8b10f48633dc
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
1552
diff
changeset
|
253 uint stack_index() { return _stack_index; } |
0 | 254 public: |
1833
8b10f48633dc
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
1552
diff
changeset
|
255 DrainStacksCompactionTask(uint stack_index) : GCTask(), |
8b10f48633dc
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
1552
diff
changeset
|
256 _stack_index(stack_index) {}; |
375
81cd571500b0
6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents:
0
diff
changeset
|
257 char* name() { return (char *)"drain-region-task"; } |
0 | 258 virtual void do_it(GCTaskManager* manager, uint which); |
259 }; | |
1972 | 260 |
261 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PCTASKS_HPP |