comparison src/share/vm/gc_implementation/g1/satbQueue.cpp @ 3979:4dfb2df418f2

6484982: G1: process references during evacuation pauses Summary: G1 now uses two reference processors - one is used by concurrent marking and the other is used by STW GCs (both full and incremental evacuation pauses). In an evacuation pause, the reference processor is embedded into the closures used to scan objects. Doing so causes causes reference objects to be 'discovered' by the reference processor. At the end of the evacuation pause, these discovered reference objects are processed - preserving (and copying) referent objects (and their reachable graphs) as appropriate. Reviewed-by: ysr, jwilhelm, brutisso, stefank, tonyp
author johnc
date Thu, 22 Sep 2011 10:57:37 -0700
parents 7e37af9d69ef
children 2ace1c4ee8da
comparison
equal deleted inserted replaced
3978:f0ecbe78fc7b 3979:4dfb2df418f2
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) {