equal
deleted
inserted
replaced
27 #include "gc_implementation/g1/satbQueue.hpp" |
27 #include "gc_implementation/g1/satbQueue.hpp" |
28 #include "memory/allocation.inline.hpp" |
28 #include "memory/allocation.inline.hpp" |
29 #include "memory/sharedHeap.hpp" |
29 #include "memory/sharedHeap.hpp" |
30 #include "runtime/mutexLocker.hpp" |
30 #include "runtime/mutexLocker.hpp" |
31 #include "runtime/thread.hpp" |
31 #include "runtime/thread.hpp" |
|
32 #include "runtime/vmThread.hpp" |
32 |
33 |
33 // This method removes entries from an SATB buffer that will not be |
34 // This method removes entries from an SATB buffer that will not be |
34 // useful to the concurrent marking threads. An entry is removed if it |
35 // useful to the concurrent marking threads. An entry is removed if it |
35 // satisfies one of the following conditions: |
36 // satisfies one of the following conditions: |
36 // |
37 // |
250 for(JavaThread* t = Threads::first(); t; t = t->next()) { |
251 for(JavaThread* t = Threads::first(); t; t = t->next()) { |
251 if (t->claim_oops_do(true, parity)) { |
252 if (t->claim_oops_do(true, parity)) { |
252 t->satb_mark_queue().apply_closure(_par_closures[worker]); |
253 t->satb_mark_queue().apply_closure(_par_closures[worker]); |
253 } |
254 } |
254 } |
255 } |
255 // We'll have worker 0 do this one. |
256 |
256 if (worker == 0) { |
257 // We also need to claim the VMThread so that its parity is updated |
257 shared_satb_queue()->apply_closure(_par_closures[0]); |
258 // otherwise the next call to Thread::possibly_parallel_oops_do inside |
|
259 // a StrongRootsScope might skip the VMThread because it has a stale |
|
260 // parity that matches the parity set by the StrongRootsScope |
|
261 // |
|
262 // Whichever worker succeeds in claiming the VMThread gets to do |
|
263 // the shared queue. |
|
264 |
|
265 VMThread* vmt = VMThread::vm_thread(); |
|
266 if (vmt->claim_oops_do(true, parity)) { |
|
267 shared_satb_queue()->apply_closure(_par_closures[worker]); |
258 } |
268 } |
259 } |
269 } |
260 |
270 |
261 bool SATBMarkQueueSet::apply_closure_to_completed_buffer_work(bool par, |
271 bool SATBMarkQueueSet::apply_closure_to_completed_buffer_work(bool par, |
262 int worker) { |
272 int worker) { |