865 }
866
867 SCMObjToScanQueue* ShenandoahConcurrentMark::get_queue(uint worker_id) {
868 assert (worker_id < _max_conc_worker_id, "valid worker id: %d", worker_id);
869 return _task_queues->queue(worker_id);
870 }
871
872 void ShenandoahConcurrentMark::clear_queue(SCMObjToScanQueue *q) {
873 q->set_empty();
874 q->overflow_stack()->clear();
875 q->clear_buffer();
876 }
877
878 template <class T, bool CL>
879 void ShenandoahConcurrentMark::concurrent_mark_loop(ShenandoahMarkObjsClosure<T, CL>* cl,
880 uint worker_id,
881 SCMObjToScanQueue* q,
882 ParallelTaskTerminator* terminator) {
883 ShenandoahHeap* heap = ShenandoahHeap::heap();
884 int seed = 17;
885 while (true) {
886 if (heap->cancelled_concgc()) clear_queue(q);
887 if (heap->cancelled_concgc() ||
888 (!try_queue(q, cl) &&
889 !try_draining_an_satb_buffer(q) &&
890 !try_to_steal(worker_id, cl, &seed))
891 ) {
892 if (terminator->offer_termination()) break;
893 }
894 }
895 }
896
897 template <class T, bool CL>
898 void ShenandoahConcurrentMark::final_mark_loop(ShenandoahMarkObjsClosure<T, CL>* cl,
899 uint worker_id,
900 SCMObjToScanQueue* q,
901 ParallelTaskTerminator* terminator) {
902 int seed = 17;
903 while (true) {
904 if (!try_queue(q, cl) &&
905 !try_to_steal(worker_id, cl, &seed)) {
906 if (terminator->offer_termination()) break;
907 }
908 }
909 }
910
911 void ShenandoahConcurrentMark::set_process_references(bool pr) {
912 _process_references = pr;
|
865 }
866
867 SCMObjToScanQueue* ShenandoahConcurrentMark::get_queue(uint worker_id) {
868 assert (worker_id < _max_conc_worker_id, "valid worker id: %d", worker_id);
869 return _task_queues->queue(worker_id);
870 }
871
872 void ShenandoahConcurrentMark::clear_queue(SCMObjToScanQueue *q) {
873 q->set_empty();
874 q->overflow_stack()->clear();
875 q->clear_buffer();
876 }
877
878 template <class T, bool CL>
879 void ShenandoahConcurrentMark::concurrent_mark_loop(ShenandoahMarkObjsClosure<T, CL>* cl,
880 uint worker_id,
881 SCMObjToScanQueue* q,
882 ParallelTaskTerminator* terminator) {
883 ShenandoahHeap* heap = ShenandoahHeap::heap();
884 int seed = 17;
885 uint stride = ShenandoahMarkLoopStride;
886 while (true) {
887 if (heap->cancelled_concgc()) {
888 clear_queue(q);
889 while (! terminator->offer_termination());
890 return;
891 }
892 for (uint i = 0; i < stride; i++) {
893 if (!try_queue(q, cl) &&
894 !try_draining_an_satb_buffer(q) &&
895 !try_to_steal(worker_id, cl, &seed)
896 ) {
897 if (terminator->offer_termination()) return;
898 }
899 }
900 }
901 }
902
903 template <class T, bool CL>
904 void ShenandoahConcurrentMark::final_mark_loop(ShenandoahMarkObjsClosure<T, CL>* cl,
905 uint worker_id,
906 SCMObjToScanQueue* q,
907 ParallelTaskTerminator* terminator) {
908 int seed = 17;
909 while (true) {
910 if (!try_queue(q, cl) &&
911 !try_to_steal(worker_id, cl, &seed)) {
912 if (terminator->offer_termination()) break;
913 }
914 }
915 }
916
917 void ShenandoahConcurrentMark::set_process_references(bool pr) {
918 _process_references = pr;
|