< prev index next >

src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp

Print this page




4177     FreelistLocker x(this);
4178     MutexLockerEx y(bitMapLock(),
4179                     Mutex::_no_safepoint_check_flag);
4180     checkpointRootsFinalWork();
4181   }
4182   verify_work_stacks_empty();
4183   verify_overflow_empty();
4184 }
4185 
4186 void CMSCollector::checkpointRootsFinalWork() {
4187   GCTraceTime(Trace, gc, phases) tm("checkpointRootsFinalWork", _gc_timer_cm);
4188 
4189   assert(haveFreelistLocks(), "must have free list locks");
4190   assert_lock_strong(bitMapLock());
4191 
4192   ResourceMark rm;
4193   HandleMark   hm;
4194 
4195   CMSHeap* heap = CMSHeap::heap();
4196 
4197   if (should_unload_classes()) {
4198     CodeCache::gc_prologue();
4199   }
4200   assert(haveFreelistLocks(), "must have free list locks");
4201   assert_lock_strong(bitMapLock());
4202 
4203   // We might assume that we need not fill TLAB's when
4204   // CMSScavengeBeforeRemark is set, because we may have just done
4205   // a scavenge which would have filled all TLAB's -- and besides
4206   // Eden would be empty. This however may not always be the case --
4207   // for instance although we asked for a scavenge, it may not have
4208   // happened because of a JNI critical section. We probably need
4209   // a policy for deciding whether we can in that case wait until
4210   // the critical section releases and then do the remark following
4211   // the scavenge, and skip it here. In the absence of that policy,
4212   // or of an indication of whether the scavenge did indeed occur,
4213   // we cannot rely on TLAB's having been filled and must do
4214   // so here just in case a scavenge did not happen.
4215   heap->ensure_parsability(false);  // fill TLAB's, but no need to retire them
4216   // Update the saved marks which may affect the root scans.
4217   heap->save_marks();
4218 
4219   print_eden_and_survivor_chunk_arrays();


4235     // concurrent precleaning.
4236     if (CMSParallelRemarkEnabled) {
4237       GCTraceTime(Debug, gc, phases) t("Rescan (parallel)", _gc_timer_cm);
4238       do_remark_parallel();
4239     } else {
4240       GCTraceTime(Debug, gc, phases) t("Rescan (non-parallel)", _gc_timer_cm);
4241       do_remark_non_parallel();
4242     }
4243   }
4244   verify_work_stacks_empty();
4245   verify_overflow_empty();
4246 
4247   {
4248     GCTraceTime(Trace, gc, phases) ts("refProcessingWork", _gc_timer_cm);
4249     refProcessingWork();
4250   }
4251   verify_work_stacks_empty();
4252   verify_overflow_empty();
4253 
4254   if (should_unload_classes()) {
4255     CodeCache::gc_epilogue();
4256   }
4257   JvmtiExport::gc_epilogue();
4258 
4259   // If we encountered any (marking stack / work queue) overflow
4260   // events during the current CMS cycle, take appropriate
4261   // remedial measures, where possible, so as to try and avoid
4262   // recurrence of that condition.
4263   assert(_markStack.isEmpty(), "No grey objects");
4264   size_t ser_ovflw = _ser_pmc_remark_ovflw + _ser_pmc_preclean_ovflw +
4265                      _ser_kac_ovflw        + _ser_kac_preclean_ovflw;
4266   if (ser_ovflw > 0) {
4267     log_trace(gc)("Marking stack overflow (benign) (pmc_pc=" SIZE_FORMAT ", pmc_rm=" SIZE_FORMAT ", kac=" SIZE_FORMAT ", kac_preclean=" SIZE_FORMAT ")",
4268                          _ser_pmc_preclean_ovflw, _ser_pmc_remark_ovflw, _ser_kac_ovflw, _ser_kac_preclean_ovflw);
4269     _markStack.expand();
4270     _ser_pmc_remark_ovflw = 0;
4271     _ser_pmc_preclean_ovflw = 0;
4272     _ser_kac_preclean_ovflw = 0;
4273     _ser_kac_ovflw = 0;
4274   }
4275   if (_par_pmc_remark_ovflw > 0 || _par_kac_ovflw > 0) {




4177     FreelistLocker x(this);
4178     MutexLockerEx y(bitMapLock(),
4179                     Mutex::_no_safepoint_check_flag);
4180     checkpointRootsFinalWork();
4181   }
4182   verify_work_stacks_empty();
4183   verify_overflow_empty();
4184 }
4185 
4186 void CMSCollector::checkpointRootsFinalWork() {
4187   GCTraceTime(Trace, gc, phases) tm("checkpointRootsFinalWork", _gc_timer_cm);
4188 
4189   assert(haveFreelistLocks(), "must have free list locks");
4190   assert_lock_strong(bitMapLock());
4191 
4192   ResourceMark rm;
4193   HandleMark   hm;
4194 
4195   CMSHeap* heap = CMSHeap::heap();
4196 



4197   assert(haveFreelistLocks(), "must have free list locks");
4198   assert_lock_strong(bitMapLock());
4199 
4200   // We might assume that we need not fill TLAB's when
4201   // CMSScavengeBeforeRemark is set, because we may have just done
4202   // a scavenge which would have filled all TLAB's -- and besides
4203   // Eden would be empty. This however may not always be the case --
4204   // for instance although we asked for a scavenge, it may not have
4205   // happened because of a JNI critical section. We probably need
4206   // a policy for deciding whether we can in that case wait until
4207   // the critical section releases and then do the remark following
4208   // the scavenge, and skip it here. In the absence of that policy,
4209   // or of an indication of whether the scavenge did indeed occur,
4210   // we cannot rely on TLAB's having been filled and must do
4211   // so here just in case a scavenge did not happen.
4212   heap->ensure_parsability(false);  // fill TLAB's, but no need to retire them
4213   // Update the saved marks which may affect the root scans.
4214   heap->save_marks();
4215 
4216   print_eden_and_survivor_chunk_arrays();


4232     // concurrent precleaning.
4233     if (CMSParallelRemarkEnabled) {
4234       GCTraceTime(Debug, gc, phases) t("Rescan (parallel)", _gc_timer_cm);
4235       do_remark_parallel();
4236     } else {
4237       GCTraceTime(Debug, gc, phases) t("Rescan (non-parallel)", _gc_timer_cm);
4238       do_remark_non_parallel();
4239     }
4240   }
4241   verify_work_stacks_empty();
4242   verify_overflow_empty();
4243 
4244   {
4245     GCTraceTime(Trace, gc, phases) ts("refProcessingWork", _gc_timer_cm);
4246     refProcessingWork();
4247   }
4248   verify_work_stacks_empty();
4249   verify_overflow_empty();
4250 
4251   if (should_unload_classes()) {
4252     heap->prune_nmethods();
4253   }
4254   JvmtiExport::gc_epilogue();
4255 
4256   // If we encountered any (marking stack / work queue) overflow
4257   // events during the current CMS cycle, take appropriate
4258   // remedial measures, where possible, so as to try and avoid
4259   // recurrence of that condition.
4260   assert(_markStack.isEmpty(), "No grey objects");
4261   size_t ser_ovflw = _ser_pmc_remark_ovflw + _ser_pmc_preclean_ovflw +
4262                      _ser_kac_ovflw        + _ser_kac_preclean_ovflw;
4263   if (ser_ovflw > 0) {
4264     log_trace(gc)("Marking stack overflow (benign) (pmc_pc=" SIZE_FORMAT ", pmc_rm=" SIZE_FORMAT ", kac=" SIZE_FORMAT ", kac_preclean=" SIZE_FORMAT ")",
4265                          _ser_pmc_preclean_ovflw, _ser_pmc_remark_ovflw, _ser_kac_ovflw, _ser_kac_preclean_ovflw);
4266     _markStack.expand();
4267     _ser_pmc_remark_ovflw = 0;
4268     _ser_pmc_preclean_ovflw = 0;
4269     _ser_kac_preclean_ovflw = 0;
4270     _ser_kac_ovflw = 0;
4271   }
4272   if (_par_pmc_remark_ovflw > 0 || _par_kac_ovflw > 0) {


< prev index next >