< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp

Print this page
rev 55400 : 8225813: Shenandoah: Obsolete ShenandoahSuspendibleWorkers flag, as suspendible workers are required


 139     ShenandoahHeap* heap = ShenandoahHeap::heap();
 140     ShenandoahUpdateRefsClosure cl;
 141     AlwaysTrueClosure always_true;
 142     _root_updater->roots_do<AlwaysTrueClosure, ShenandoahUpdateRefsClosure>(worker_id, &always_true, &cl);
 143   }
 144 };
 145 
 146 class ShenandoahConcurrentMarkingTask : public AbstractGangTask {
 147 private:
 148   ShenandoahConcurrentMark* _cm;
 149   ShenandoahTaskTerminator* _terminator;
 150 
 151 public:
 152   ShenandoahConcurrentMarkingTask(ShenandoahConcurrentMark* cm, ShenandoahTaskTerminator* terminator) :
 153     AbstractGangTask("Root Region Scan"), _cm(cm), _terminator(terminator) {
 154   }
 155 
 156   void work(uint worker_id) {
 157     ShenandoahHeap* heap = ShenandoahHeap::heap();
 158     ShenandoahConcurrentWorkerSession worker_session(worker_id);
 159     ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers);
 160     ShenandoahObjToScanQueue* q = _cm->get_queue(worker_id);
 161     ReferenceProcessor* rp;
 162     if (heap->process_references()) {
 163       rp = heap->ref_processor();
 164       shenandoah_assert_rp_isalive_installed();
 165     } else {
 166       rp = NULL;
 167     }
 168 
 169     _cm->concurrent_scan_code_roots(worker_id, rp);
 170     _cm->mark_loop(worker_id, _terminator, rp,
 171                    true, // cancellable
 172                    ShenandoahStringDedup::is_enabled()); // perform string dedup
 173   }
 174 };
 175 
 176 class ShenandoahSATBThreadsClosure : public ThreadClosure {
 177 private:
 178   ShenandoahSATBBufferClosure* _satb_cl;
 179   uintx _claim_token;


 965     }
 966 
 967     while (satb_mq_set.completed_buffers_num() > 0) {
 968       satb_mq_set.apply_closure_to_completed_buffer(&drain_satb);
 969     }
 970 
 971     uint work = 0;
 972     for (uint i = 0; i < stride; i++) {
 973       if (q->pop(t) ||
 974           queues->steal(worker_id, t)) {
 975         do_task<T>(q, cl, live_data, &t);
 976         work++;
 977       } else {
 978         break;
 979       }
 980     }
 981 
 982     if (work == 0) {
 983       // No work encountered in current stride, try to terminate.
 984       // Need to leave the STS here otherwise it might block safepoints.
 985       ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers);
 986       ShenandoahTerminationTimingsTracker term_tracker(worker_id);
 987       ShenandoahTerminatorTerminator tt(heap);
 988       if (terminator->offer_termination(&tt)) return;
 989     }
 990   }
 991 }
 992 
 993 bool ShenandoahConcurrentMark::claim_codecache() {
 994   assert(ShenandoahConcurrentScanCodeRoots, "must not be called otherwise");
 995   return _claimed_codecache.try_set();
 996 }
 997 
 998 void ShenandoahConcurrentMark::clear_claim_codecache() {
 999   assert(ShenandoahConcurrentScanCodeRoots, "must not be called otherwise");
1000   _claimed_codecache.unset();
1001 }


 139     ShenandoahHeap* heap = ShenandoahHeap::heap();
 140     ShenandoahUpdateRefsClosure cl;
 141     AlwaysTrueClosure always_true;
 142     _root_updater->roots_do<AlwaysTrueClosure, ShenandoahUpdateRefsClosure>(worker_id, &always_true, &cl);
 143   }
 144 };
 145 
 146 class ShenandoahConcurrentMarkingTask : public AbstractGangTask {
 147 private:
 148   ShenandoahConcurrentMark* _cm;
 149   ShenandoahTaskTerminator* _terminator;
 150 
 151 public:
 152   ShenandoahConcurrentMarkingTask(ShenandoahConcurrentMark* cm, ShenandoahTaskTerminator* terminator) :
 153     AbstractGangTask("Root Region Scan"), _cm(cm), _terminator(terminator) {
 154   }
 155 
 156   void work(uint worker_id) {
 157     ShenandoahHeap* heap = ShenandoahHeap::heap();
 158     ShenandoahConcurrentWorkerSession worker_session(worker_id);
 159     ShenandoahSuspendibleThreadSetJoiner stsj;
 160     ShenandoahObjToScanQueue* q = _cm->get_queue(worker_id);
 161     ReferenceProcessor* rp;
 162     if (heap->process_references()) {
 163       rp = heap->ref_processor();
 164       shenandoah_assert_rp_isalive_installed();
 165     } else {
 166       rp = NULL;
 167     }
 168 
 169     _cm->concurrent_scan_code_roots(worker_id, rp);
 170     _cm->mark_loop(worker_id, _terminator, rp,
 171                    true, // cancellable
 172                    ShenandoahStringDedup::is_enabled()); // perform string dedup
 173   }
 174 };
 175 
 176 class ShenandoahSATBThreadsClosure : public ThreadClosure {
 177 private:
 178   ShenandoahSATBBufferClosure* _satb_cl;
 179   uintx _claim_token;


 965     }
 966 
 967     while (satb_mq_set.completed_buffers_num() > 0) {
 968       satb_mq_set.apply_closure_to_completed_buffer(&drain_satb);
 969     }
 970 
 971     uint work = 0;
 972     for (uint i = 0; i < stride; i++) {
 973       if (q->pop(t) ||
 974           queues->steal(worker_id, t)) {
 975         do_task<T>(q, cl, live_data, &t);
 976         work++;
 977       } else {
 978         break;
 979       }
 980     }
 981 
 982     if (work == 0) {
 983       // No work encountered in current stride, try to terminate.
 984       // Need to leave the STS here otherwise it might block safepoints.
 985       ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE);
 986       ShenandoahTerminationTimingsTracker term_tracker(worker_id);
 987       ShenandoahTerminatorTerminator tt(heap);
 988       if (terminator->offer_termination(&tt)) return;
 989     }
 990   }
 991 }
 992 
 993 bool ShenandoahConcurrentMark::claim_codecache() {
 994   assert(ShenandoahConcurrentScanCodeRoots, "must not be called otherwise");
 995   return _claimed_codecache.try_set();
 996 }
 997 
 998 void ShenandoahConcurrentMark::clear_claim_codecache() {
 999   assert(ShenandoahConcurrentScanCodeRoots, "must not be called otherwise");
1000   _claimed_codecache.unset();
1001 }
< prev index next >