90 // |
90 // |
91 |
91 |
92 // Local to this file. |
92 // Local to this file. |
93 |
93 |
94 class RefineCardTableEntryClosure: public CardTableEntryClosure { |
94 class RefineCardTableEntryClosure: public CardTableEntryClosure { |
95 SuspendibleThreadSet* _sts; |
|
96 G1RemSet* _g1rs; |
95 G1RemSet* _g1rs; |
97 ConcurrentG1Refine* _cg1r; |
96 ConcurrentG1Refine* _cg1r; |
98 bool _concurrent; |
97 bool _concurrent; |
99 public: |
98 public: |
100 RefineCardTableEntryClosure(SuspendibleThreadSet* sts, |
99 RefineCardTableEntryClosure(G1RemSet* g1rs, |
101 G1RemSet* g1rs, |
|
102 ConcurrentG1Refine* cg1r) : |
100 ConcurrentG1Refine* cg1r) : |
103 _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true) |
101 _g1rs(g1rs), _cg1r(cg1r), _concurrent(true) |
104 {} |
102 {} |
105 bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
103 bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
106 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false); |
104 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false); |
107 // This path is executed by the concurrent refine or mutator threads, |
105 // This path is executed by the concurrent refine or mutator threads, |
108 // concurrently, and so we do not care if card_ptr contains references |
106 // concurrently, and so we do not care if card_ptr contains references |
109 // that point into the collection set. |
107 // that point into the collection set. |
110 assert(!oops_into_cset, "should be"); |
108 assert(!oops_into_cset, "should be"); |
111 |
109 |
112 if (_concurrent && _sts->should_yield()) { |
110 if (_concurrent && SuspendibleThreadSet::should_yield()) { |
113 // Caller will actually yield. |
111 // Caller will actually yield. |
114 return false; |
112 return false; |
115 } |
113 } |
116 // Otherwise, we finished successfully; return true. |
114 // Otherwise, we finished successfully; return true. |
117 return true; |
115 return true; |
2115 |
2113 |
2116 // Perform any initialization actions delegated to the policy. |
2114 // Perform any initialization actions delegated to the policy. |
2117 g1_policy()->init(); |
2115 g1_policy()->init(); |
2118 |
2116 |
2119 _refine_cte_cl = |
2117 _refine_cte_cl = |
2120 new RefineCardTableEntryClosure(ConcurrentG1RefineThread::sts(), |
2118 new RefineCardTableEntryClosure(g1_rem_set(), |
2121 g1_rem_set(), |
|
2122 concurrent_g1_refine()); |
2119 concurrent_g1_refine()); |
2123 JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl); |
2120 JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl); |
2124 |
2121 |
2125 JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon, |
2122 JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon, |
2126 SATB_Q_FL_lock, |
2123 SATB_Q_FL_lock, |
4315 // the concurrent marking thread(s) could be running |
4312 // the concurrent marking thread(s) could be running |
4316 // concurrently with us. Make sure that anything after |
4313 // concurrently with us. Make sure that anything after |
4317 // this point does not assume that we are the only GC thread |
4314 // this point does not assume that we are the only GC thread |
4318 // running. Note: of course, the actual marking work will |
4315 // running. Note: of course, the actual marking work will |
4319 // not start until the safepoint itself is released in |
4316 // not start until the safepoint itself is released in |
4320 // ConcurrentGCThread::safepoint_desynchronize(). |
4317 // SuspendibleThreadSet::desynchronize(). |
4321 doConcurrentMark(); |
4318 doConcurrentMark(); |
4322 } |
4319 } |
4323 |
4320 |
4324 return true; |
4321 return true; |
4325 } |
4322 } |