src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp
changeset 53015 632c4baddbb8
parent 52925 9c18c9d839d3
child 53383 5dc89efc08f0
equal deleted inserted replaced
53014:339d2fbe8675 53015:632c4baddbb8
   937          "Need to reserve proper number of queues: reserved: %u, active: %u", queues->get_reserved(), heap->workers()->active_workers());
   937          "Need to reserve proper number of queues: reserved: %u, active: %u", queues->get_reserved(), heap->workers()->active_workers());
   938 
   938 
   939   q = queues->claim_next();
   939   q = queues->claim_next();
   940   while (q != NULL) {
   940   while (q != NULL) {
   941     if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
   941     if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
   942       ShenandoahCancelledTerminatorTerminator tt;
       
   943       ShenandoahSuspendibleThreadSetLeaver stsl(ShenandoahSuspendibleWorkers);
       
   944       while (!terminator->offer_termination(&tt));
       
   945       return;
   942       return;
   946     }
   943     }
   947 
   944 
   948     for (uint i = 0; i < stride; i++) {
   945     for (uint i = 0; i < stride; i++) {
   949       if (q->pop(t)) {
   946       if (q->pop(t)) {
   963   /*
   960   /*
   964    * Normal marking loop:
   961    * Normal marking loop:
   965    */
   962    */
   966   while (true) {
   963   while (true) {
   967     if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
   964     if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
   968       ShenandoahCancelledTerminatorTerminator tt;
       
   969       ShenandoahSuspendibleThreadSetLeaver stsl(ShenandoahSuspendibleWorkers);
       
   970       while (!terminator->offer_termination(&tt));
       
   971       return;
   965       return;
   972     }
   966     }
   973 
   967 
   974     while (satb_mq_set.completed_buffers_num() > 0) {
   968     while (satb_mq_set.completed_buffers_num() > 0) {
   975       satb_mq_set.apply_closure_to_completed_buffer(&drain_satb);
   969       satb_mq_set.apply_closure_to_completed_buffer(&drain_satb);
   989     if (work == 0) {
   983     if (work == 0) {
   990       // No work encountered in current stride, try to terminate.
   984       // No work encountered in current stride, try to terminate.
   991       // Need to leave the STS here otherwise it might block safepoints.
   985       // Need to leave the STS here otherwise it might block safepoints.
   992       ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers);
   986       ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers);
   993       ShenandoahTerminationTimingsTracker term_tracker(worker_id);
   987       ShenandoahTerminationTimingsTracker term_tracker(worker_id);
   994       if (terminator->offer_termination()) return;
   988       ShenandoahTerminatorTerminator tt(heap);
       
   989       if (terminator->offer_termination(&tt)) return;
   995     }
   990     }
   996   }
   991   }
   997 }
   992 }
   998 
   993 
   999 bool ShenandoahConcurrentMark::claim_codecache() {
   994 bool ShenandoahConcurrentMark::claim_codecache() {