20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 /* |
|
26 * This file has been modified by Loongson Technology in 2015. These |
|
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made |
|
28 * available on the same license terms set forth above. |
|
29 */ |
|
30 |
|
31 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
32 #include "classfile/systemDictionary.hpp" |
26 #include "classfile/systemDictionary.hpp" |
33 #include "code/codeCache.hpp" |
27 #include "code/codeCache.hpp" |
34 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" |
28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" |
35 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" |
29 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" |
36 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp" |
30 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp" |
37 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" |
31 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" |
38 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
32 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
39 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
33 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
40 #include "gc_implementation/parallelScavenge/psTasks.hpp" |
34 #include "gc_implementation/parallelScavenge/psTasks.hpp" |
41 #include "gc_implementation/shared/mutableNUMASpace.hpp" |
|
42 #include "memory/iterator.hpp" |
35 #include "memory/iterator.hpp" |
43 #include "memory/universe.hpp" |
36 #include "memory/universe.hpp" |
44 #include "oops/oop.inline.hpp" |
37 #include "oops/oop.inline.hpp" |
45 #include "oops/oop.psgc.inline.hpp" |
38 #include "oops/oop.psgc.inline.hpp" |
46 #include "runtime/fprofiler.hpp" |
39 #include "runtime/fprofiler.hpp" |
121 } |
114 } |
122 |
115 |
123 // |
116 // |
124 // ThreadRootsTask |
117 // ThreadRootsTask |
125 // |
118 // |
126 extern int task_tag[16]; |
119 |
127 void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { |
120 void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { |
128 task_tag[which] = 1; |
|
129 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
121 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
130 |
122 |
131 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
123 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
132 PSScavengeRootsClosure roots_closure(pm); |
124 PSScavengeRootsClosure roots_closure(pm); |
133 CLDToOopClosure* roots_from_clds = NULL; // Not needed. All CLDs are already visited. |
125 CLDToOopClosure* roots_from_clds = NULL; // Not needed. All CLDs are already visited. |
146 // |
138 // |
147 // StealTask |
139 // StealTask |
148 // |
140 // |
149 |
141 |
150 StealTask::StealTask(ParallelTaskTerminator* t) : |
142 StealTask::StealTask(ParallelTaskTerminator* t) : |
151 _terminator(t) {set_task_numa_id(-1);} |
143 _terminator(t) {} |
152 |
144 |
153 void StealTask::do_it(GCTaskManager* manager, uint which) { |
145 void StealTask::do_it(GCTaskManager* manager, uint which) { |
154 |
|
155 task_tag[which] = 3; |
|
156 |
|
157 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
146 assert(Universe::heap()->is_gc_active(), "called outside gc"); |
158 |
147 |
159 PSPromotionManager* pm = |
148 PSPromotionManager* pm = |
160 PSPromotionManager::gc_thread_promotion_manager(which); |
149 PSPromotionManager::gc_thread_promotion_manager(which); |
161 pm->drain_stacks(true); |
150 pm->drain_stacks(true); |
181 // |
170 // |
182 // OldToYoungRootsTask |
171 // OldToYoungRootsTask |
183 // |
172 // |
184 |
173 |
185 void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { |
174 void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { |
186 task_tag[which] = 2; |
|
187 // There are not old-to-young pointers if the old gen is empty. |
175 // There are not old-to-young pointers if the old gen is empty. |
188 assert(!_gen->object_space()->is_empty(), |
176 assert(!_gen->object_space()->is_empty(), |
189 "Should not be called is there is no work"); |
177 "Should not be called is there is no work"); |
190 assert(_gen != NULL, "Sanity"); |
178 assert(_gen != NULL, "Sanity"); |
191 assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity"); |
179 assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity"); |
207 |
195 |
208 // Do the real work |
196 // Do the real work |
209 pm->drain_stacks(false); |
197 pm->drain_stacks(false); |
210 } |
198 } |
211 } |
199 } |
212 |
|
213 // |
|
214 // OldToYoungRootsTask_OldNUMA |
|
215 // |
|
216 |
|
217 void OldToYoungRootsTask_OldNUMA::do_it(GCTaskManager* manager, uint which) { |
|
218 assert(_gen != NULL, "Sanity"); |
|
219 assert(_stripe_number < ParallelGCThreads, "Sanity"); |
|
220 |
|
221 { |
|
222 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
223 |
|
224 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); |
|
225 CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set(); |
|
226 // FIX ME! Assert that card_table is the type we believe it to be. |
|
227 |
|
228 MutableNUMASpace* s = (MutableNUMASpace*) _gen->object_space(); |
|
229 int i = s->lgrp_spaces()->length(); |
|
230 int j; |
|
231 for(j = 0; j < i; j++) { |
|
232 MutableNUMASpace::LGRPSpace *ls = s->lgrp_spaces()->at(j); |
|
233 MutableSpace* sp = ls->space(); |
|
234 /* 2014/2/12/ Liao:[cardTableExtension.cpp] assert(sp->bottom() < sp->top(), "Should not be called if empty"); |
|
235 * The situation sp->bottom() = sp->top() indicates that the lgrp is empty, |
|
236 * so no need of the following operations. */ |
|
237 if(sp->bottom() != sp->top()) { |
|
238 if(j == 0) { |
|
239 card_table->scavenge_contents_parallel(_gen->start_array(), |
|
240 sp, |
|
241 *(_gen_top + j), |
|
242 pm, |
|
243 _stripe_number, |
|
244 _stripe_total); |
|
245 |
|
246 } |
|
247 else { |
|
248 MutableNUMASpace::LGRPSpace *ls_below = s->lgrp_spaces()->at(j-1); |
|
249 MutableSpace* sp_below = ls_below->space(); |
|
250 card_table->scavenge_contents_parallel_oldnuma(_gen->start_array(), |
|
251 sp_below, |
|
252 sp, |
|
253 *(_gen_top + j), |
|
254 pm, |
|
255 _stripe_number, |
|
256 _stripe_total); |
|
257 } |
|
258 } |
|
259 } |
|
260 // Do the real work |
|
261 pm->drain_stacks(false); |
|
262 } |
|
263 } |
|
264 |
|