hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
changeset 24470 2291d267ff97
parent 24424 2658d7834c6e
parent 24469 33e039f8ee55
child 24489 de383df95d5c
equal deleted inserted replaced
24447:97e9abb0864b 24470:2291d267ff97
   817   } else {
   817   } else {
   818     // We currently assume that the concurrent flag has been set to
   818     // We currently assume that the concurrent flag has been set to
   819     // false before we start remark. At this point we should also be
   819     // false before we start remark. At this point we should also be
   820     // in a STW phase.
   820     // in a STW phase.
   821     assert(!concurrent_marking_in_progress(), "invariant");
   821     assert(!concurrent_marking_in_progress(), "invariant");
   822     assert(_finger == _heap_end,
   822     assert(out_of_regions(),
   823            err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT,
   823            err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT,
   824                    p2i(_finger), p2i(_heap_end)));
   824                    p2i(_finger), p2i(_heap_end)));
   825     update_g1_committed(true);
   825     update_g1_committed(true);
   826   }
   826   }
   827 }
   827 }
   976   }
   976   }
   977 
   977 
   978   if (concurrent()) {
   978   if (concurrent()) {
   979     SuspendibleThreadSet::leave();
   979     SuspendibleThreadSet::leave();
   980   }
   980   }
   981   _first_overflow_barrier_sync.enter();
   981 
       
   982   bool barrier_aborted = !_first_overflow_barrier_sync.enter();
       
   983 
   982   if (concurrent()) {
   984   if (concurrent()) {
   983     SuspendibleThreadSet::join();
   985     SuspendibleThreadSet::join();
   984   }
   986   }
   985   // at this point everyone should have synced up and not be doing any
   987   // at this point everyone should have synced up and not be doing any
   986   // more work
   988   // more work
   987 
   989 
   988   if (verbose_low()) {
   990   if (verbose_low()) {
   989     gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id);
   991     if (barrier_aborted) {
       
   992       gclog_or_tty->print_cr("[%u] aborted first barrier", worker_id);
       
   993     } else {
       
   994       gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id);
       
   995     }
       
   996   }
       
   997 
       
   998   if (barrier_aborted) {
       
   999     // If the barrier aborted we ignore the overflow condition and
       
  1000     // just abort the whole marking phase as quickly as possible.
       
  1001     return;
   990   }
  1002   }
   991 
  1003 
   992   // If we're executing the concurrent phase of marking, reset the marking
  1004   // If we're executing the concurrent phase of marking, reset the marking
   993   // state; otherwise the marking state is reset after reference processing,
  1005   // state; otherwise the marking state is reset after reference processing,
   994   // during the remark pause.
  1006   // during the remark pause.
  1024   }
  1036   }
  1025 
  1037 
  1026   if (concurrent()) {
  1038   if (concurrent()) {
  1027     SuspendibleThreadSet::leave();
  1039     SuspendibleThreadSet::leave();
  1028   }
  1040   }
  1029   _second_overflow_barrier_sync.enter();
  1041 
       
  1042   bool barrier_aborted = !_second_overflow_barrier_sync.enter();
       
  1043 
  1030   if (concurrent()) {
  1044   if (concurrent()) {
  1031     SuspendibleThreadSet::join();
  1045     SuspendibleThreadSet::join();
  1032   }
  1046   }
  1033   // at this point everything should be re-initialized and ready to go
  1047   // at this point everything should be re-initialized and ready to go
  1034 
  1048 
  1035   if (verbose_low()) {
  1049   if (verbose_low()) {
  1036     gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id);
  1050     if (barrier_aborted) {
       
  1051       gclog_or_tty->print_cr("[%u] aborted second barrier", worker_id);
       
  1052     } else {
       
  1053       gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id);
       
  1054     }
  1037   }
  1055   }
  1038 }
  1056 }
  1039 
  1057 
  1040 #ifndef PRODUCT
  1058 #ifndef PRODUCT
  1041 void ForceOverflowSettings::init() {
  1059 void ForceOverflowSettings::init() {
  3238   // Empty mark stack
  3256   // Empty mark stack
  3239   reset_marking_state();
  3257   reset_marking_state();
  3240   for (uint i = 0; i < _max_worker_id; ++i) {
  3258   for (uint i = 0; i < _max_worker_id; ++i) {
  3241     _tasks[i]->clear_region_fields();
  3259     _tasks[i]->clear_region_fields();
  3242   }
  3260   }
       
  3261   _first_overflow_barrier_sync.abort();
       
  3262   _second_overflow_barrier_sync.abort();
  3243   _has_aborted = true;
  3263   _has_aborted = true;
  3244 
  3264 
  3245   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
  3265   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
  3246   satb_mq_set.abandon_partial_marking();
  3266   satb_mq_set.abandon_partial_marking();
  3247   // This can be called either during or outside marking, we'll read
  3267   // This can be called either during or outside marking, we'll read