< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp

Print this page

        

*** 176,200 **** } size_t ShenandoahPacer::update_and_get_progress_history() { if (_progress == -1) { // First initialization, report some prior ! Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress); return (size_t) (_heap->max_capacity() * 0.1); } else { // Record history, and reply historical data _progress_history->add(_progress); ! Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress); return (size_t) (_progress_history->avg() * HeapWordSize); } } void ShenandoahPacer::restart_with(size_t non_taxable_bytes, double tax_rate) { size_t initial = (size_t)(non_taxable_bytes * tax_rate) >> LogHeapWordSize; STATIC_ASSERT(sizeof(size_t) <= sizeof(intptr_t)); ! Atomic::xchg((intptr_t)initial, &_budget); ! Atomic::store(tax_rate, &_tax_rate); Atomic::inc(&_epoch); } bool ShenandoahPacer::claim_for_alloc(size_t words, bool force) { assert(ShenandoahPacing, "Only be here when pacing is enabled"); --- 176,200 ---- } size_t ShenandoahPacer::update_and_get_progress_history() { if (_progress == -1) { // First initialization, report some prior ! Atomic::store(&_progress, (intptr_t)PACING_PROGRESS_ZERO); return (size_t) (_heap->max_capacity() * 0.1); } else { // Record history, and reply historical data _progress_history->add(_progress); ! Atomic::store(&_progress, (intptr_t)PACING_PROGRESS_ZERO); return (size_t) (_progress_history->avg() * HeapWordSize); } } void ShenandoahPacer::restart_with(size_t non_taxable_bytes, double tax_rate) { size_t initial = (size_t)(non_taxable_bytes * tax_rate) >> LogHeapWordSize; STATIC_ASSERT(sizeof(size_t) <= sizeof(intptr_t)); ! Atomic::xchg(&_budget, (intptr_t)initial); ! Atomic::store(&_tax_rate, tax_rate); Atomic::inc(&_epoch); } bool ShenandoahPacer::claim_for_alloc(size_t words, bool force) { assert(ShenandoahPacing, "Only be here when pacing is enabled");
*** 208,218 **** if (cur < tax && !force) { // Progress depleted, alas. return false; } new_val = cur - tax; ! } while (Atomic::cmpxchg(new_val, &_budget, cur) != cur); return true; } void ShenandoahPacer::unpace_for_alloc(intptr_t epoch, size_t words) { assert(ShenandoahPacing, "Only be here when pacing is enabled"); --- 208,218 ---- if (cur < tax && !force) { // Progress depleted, alas. return false; } new_val = cur - tax; ! } while (Atomic::cmpxchg(&_budget, cur, new_val) != cur); return true; } void ShenandoahPacer::unpace_for_alloc(intptr_t epoch, size_t words) { assert(ShenandoahPacing, "Only be here when pacing is enabled");
*** 221,231 **** // Stale ticket, no need to unpace. return; } intptr_t tax = MAX2<intptr_t>(1, words * Atomic::load(&_tax_rate)); ! Atomic::add(tax, &_budget); } intptr_t ShenandoahPacer::epoch() { return Atomic::load(&_epoch); } --- 221,231 ---- // Stale ticket, no need to unpace. return; } intptr_t tax = MAX2<intptr_t>(1, words * Atomic::load(&_tax_rate)); ! Atomic::add(&_budget, tax); } intptr_t ShenandoahPacer::epoch() { return Atomic::load(&_epoch); }
< prev index next >