< prev index next >

src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page




2564 private:
2565   CMTask* _task;
2566 
2567 public:
2568   void do_object(oop obj) {
2569     _task->deal_with_reference(obj);
2570   }
2571 
2572   CMObjectClosure(CMTask* task) : _task(task) { }
2573 };
2574 
2575 class G1RemarkThreadsClosure : public ThreadClosure {
2576   CMObjectClosure _cm_obj;
2577   G1CMOopClosure _cm_cl;
2578   MarkingCodeBlobClosure _code_cl;
2579   int _thread_parity;
2580 
2581  public:
2582   G1RemarkThreadsClosure(G1CollectedHeap* g1h, CMTask* task) :
2583     _cm_obj(task), _cm_cl(g1h, g1h->concurrent_mark(), task), _code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations),
2584     _thread_parity(SharedHeap::heap()->strong_roots_parity()) {}
2585 
2586   void do_thread(Thread* thread) {
2587     if (thread->is_Java_thread()) {
2588       if (thread->claim_oops_do(true, _thread_parity)) {
2589         JavaThread* jt = (JavaThread*)thread;
2590 
2591         // In theory it should not be neccessary to explicitly walk the nmethods to find roots for concurrent marking
2592         // however the liveness of oops reachable from nmethods have very complex lifecycles:
2593         // * Alive if on the stack of an executing method
2594         // * Weakly reachable otherwise
2595         // Some objects reachable from nmethods, such as the class loader (or klass_holder) of the receiver should be
2596         // live by the SATB invariant but other oops recorded in nmethods may behave differently.
2597         jt->nmethods_do(&_code_cl);
2598 
2599         jt->satb_mark_queue().apply_closure_and_empty(&_cm_obj);
2600       }
2601     } else if (thread->is_VM_thread()) {
2602       if (thread->claim_oops_do(true, _thread_parity)) {
2603         JavaThread::satb_mark_queue_set().shared_satb_queue()->apply_closure_and_empty(&_cm_obj);
2604       }




2564 private:
2565   CMTask* _task;
2566 
2567 public:
2568   void do_object(oop obj) {
2569     _task->deal_with_reference(obj);
2570   }
2571 
2572   CMObjectClosure(CMTask* task) : _task(task) { }
2573 };
2574 
2575 class G1RemarkThreadsClosure : public ThreadClosure {
2576   CMObjectClosure _cm_obj;
2577   G1CMOopClosure _cm_cl;
2578   MarkingCodeBlobClosure _code_cl;
2579   int _thread_parity;
2580 
2581  public:
2582   G1RemarkThreadsClosure(G1CollectedHeap* g1h, CMTask* task) :
2583     _cm_obj(task), _cm_cl(g1h, g1h->concurrent_mark(), task), _code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations),
2584     _thread_parity(Threads::thread_claim_parity()) {}
2585 
2586   void do_thread(Thread* thread) {
2587     if (thread->is_Java_thread()) {
2588       if (thread->claim_oops_do(true, _thread_parity)) {
2589         JavaThread* jt = (JavaThread*)thread;
2590 
2591         // In theory it should not be neccessary to explicitly walk the nmethods to find roots for concurrent marking
2592         // however the liveness of oops reachable from nmethods have very complex lifecycles:
2593         // * Alive if on the stack of an executing method
2594         // * Weakly reachable otherwise
2595         // Some objects reachable from nmethods, such as the class loader (or klass_holder) of the receiver should be
2596         // live by the SATB invariant but other oops recorded in nmethods may behave differently.
2597         jt->nmethods_do(&_code_cl);
2598 
2599         jt->satb_mark_queue().apply_closure_and_empty(&_cm_obj);
2600       }
2601     } else if (thread->is_VM_thread()) {
2602       if (thread->claim_oops_do(true, _thread_parity)) {
2603         JavaThread::satb_mark_queue_set().shared_satb_queue()->apply_closure_and_empty(&_cm_obj);
2604       }


< prev index next >