src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
changeset 59248 e92153ed8bdc
parent 58918 c727d5d4c22e
child 59249 29b0d0b61615
equal deleted inserted replaced
59247:56bf71d64d51 59248:e92153ed8bdc
   176 }
   176 }
   177 
   177 
   178 size_t ShenandoahPacer::update_and_get_progress_history() {
   178 size_t ShenandoahPacer::update_and_get_progress_history() {
   179   if (_progress == -1) {
   179   if (_progress == -1) {
   180     // First initialization, report some prior
   180     // First initialization, report some prior
   181     Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress);
   181     Atomic::store(&_progress, (intptr_t)PACING_PROGRESS_ZERO);
   182     return (size_t) (_heap->max_capacity() * 0.1);
   182     return (size_t) (_heap->max_capacity() * 0.1);
   183   } else {
   183   } else {
   184     // Record history, and reply historical data
   184     // Record history, and reply historical data
   185     _progress_history->add(_progress);
   185     _progress_history->add(_progress);
   186     Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress);
   186     Atomic::store(&_progress, (intptr_t)PACING_PROGRESS_ZERO);
   187     return (size_t) (_progress_history->avg() * HeapWordSize);
   187     return (size_t) (_progress_history->avg() * HeapWordSize);
   188   }
   188   }
   189 }
   189 }
   190 
   190 
   191 void ShenandoahPacer::restart_with(size_t non_taxable_bytes, double tax_rate) {
   191 void ShenandoahPacer::restart_with(size_t non_taxable_bytes, double tax_rate) {
   192   size_t initial = (size_t)(non_taxable_bytes * tax_rate) >> LogHeapWordSize;
   192   size_t initial = (size_t)(non_taxable_bytes * tax_rate) >> LogHeapWordSize;
   193   STATIC_ASSERT(sizeof(size_t) <= sizeof(intptr_t));
   193   STATIC_ASSERT(sizeof(size_t) <= sizeof(intptr_t));
   194   Atomic::xchg((intptr_t)initial, &_budget);
   194   Atomic::xchg((intptr_t)initial, &_budget);
   195   Atomic::store(tax_rate, &_tax_rate);
   195   Atomic::store(&_tax_rate, tax_rate);
   196   Atomic::inc(&_epoch);
   196   Atomic::inc(&_epoch);
   197 }
   197 }
   198 
   198 
   199 bool ShenandoahPacer::claim_for_alloc(size_t words, bool force) {
   199 bool ShenandoahPacer::claim_for_alloc(size_t words, bool force) {
   200   assert(ShenandoahPacing, "Only be here when pacing is enabled");
   200   assert(ShenandoahPacing, "Only be here when pacing is enabled");