comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20192:581e70386ec9

8039147: Cleanup SuspendibleThreadSet Reviewed-by: brutisso, tschatzl, mgerdin
author pliden
date Fri, 11 Apr 2014 12:29:24 +0200
parents fd81a5764900
children ce8f6bb717c9
comparison
equal deleted inserted replaced
20191:fd81a5764900 20192:581e70386ec9
94 // 94 //
95 95
96 // Local to this file. 96 // Local to this file.
97 97
98 class RefineCardTableEntryClosure: public CardTableEntryClosure { 98 class RefineCardTableEntryClosure: public CardTableEntryClosure {
99 SuspendibleThreadSet* _sts;
100 G1RemSet* _g1rs; 99 G1RemSet* _g1rs;
101 ConcurrentG1Refine* _cg1r; 100 ConcurrentG1Refine* _cg1r;
102 bool _concurrent; 101 bool _concurrent;
103 public: 102 public:
104 RefineCardTableEntryClosure(SuspendibleThreadSet* sts, 103 RefineCardTableEntryClosure(G1RemSet* g1rs,
105 G1RemSet* g1rs,
106 ConcurrentG1Refine* cg1r) : 104 ConcurrentG1Refine* cg1r) :
107 _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true) 105 _g1rs(g1rs), _cg1r(cg1r), _concurrent(true)
108 {} 106 {}
109 bool do_card_ptr(jbyte* card_ptr, uint worker_i) { 107 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
110 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false); 108 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false);
111 // This path is executed by the concurrent refine or mutator threads, 109 // This path is executed by the concurrent refine or mutator threads,
112 // concurrently, and so we do not care if card_ptr contains references 110 // concurrently, and so we do not care if card_ptr contains references
113 // that point into the collection set. 111 // that point into the collection set.
114 assert(!oops_into_cset, "should be"); 112 assert(!oops_into_cset, "should be");
115 113
116 if (_concurrent && _sts->should_yield()) { 114 if (_concurrent && SuspendibleThreadSet::should_yield()) {
117 // Caller will actually yield. 115 // Caller will actually yield.
118 return false; 116 return false;
119 } 117 }
120 // Otherwise, we finished successfully; return true. 118 // Otherwise, we finished successfully; return true.
121 return true; 119 return true;
2111 2109
2112 // Perform any initialization actions delegated to the policy. 2110 // Perform any initialization actions delegated to the policy.
2113 g1_policy()->init(); 2111 g1_policy()->init();
2114 2112
2115 _refine_cte_cl = 2113 _refine_cte_cl =
2116 new RefineCardTableEntryClosure(ConcurrentG1RefineThread::sts(), 2114 new RefineCardTableEntryClosure(g1_rem_set(),
2117 g1_rem_set(),
2118 concurrent_g1_refine()); 2115 concurrent_g1_refine());
2119 JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl); 2116 JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl);
2120 2117
2121 JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon, 2118 JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon,
2122 SATB_Q_FL_lock, 2119 SATB_Q_FL_lock,
4323 // the concurrent marking thread(s) could be running 4320 // the concurrent marking thread(s) could be running
4324 // concurrently with us. Make sure that anything after 4321 // concurrently with us. Make sure that anything after
4325 // this point does not assume that we are the only GC thread 4322 // this point does not assume that we are the only GC thread
4326 // running. Note: of course, the actual marking work will 4323 // running. Note: of course, the actual marking work will
4327 // not start until the safepoint itself is released in 4324 // not start until the safepoint itself is released in
4328 // ConcurrentGCThread::safepoint_desynchronize(). 4325 // SuspendibleThreadSet::desynchronize().
4329 doConcurrentMark(); 4326 doConcurrentMark();
4330 } 4327 }
4331 4328
4332 return true; 4329 return true;
4333 } 4330 }