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 bool terminate = false;
886 while (! terminate) {
887 if (heap->cancelled_concgc()) {
888 clear_queue(q);
889 break;
890 }
891 for (uint i = 0; i < 10000 && ! terminate; i++) {
892 if (!try_queue(q, cl) &&
893 !try_draining_an_satb_buffer(q) &&
894 !try_to_steal(worker_id, cl, &seed)
895 ) {
896 if (terminator->offer_termination()) terminate = true;
897 }
898 }
899 }
900 }
901
902 template <class T, bool CL>
903 void ShenandoahConcurrentMark::final_mark_loop(ShenandoahMarkObjsClosure<T, CL>* cl,
904 uint worker_id,
905 SCMObjToScanQueue* q,
906 ParallelTaskTerminator* terminator) {
907 int seed = 17;
908 while (true) {
909 if (!try_queue(q, cl) &&
910 !try_to_steal(worker_id, cl, &seed)) {
911 if (terminator->offer_termination()) break;
912 }
913 }
914 }
915
916 void ShenandoahConcurrentMark::set_process_references(bool pr) {
917 _process_references = pr;
|