< prev index next > src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp
Print this page
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHPACER_HPP
#define SHARE_GC_SHENANDOAH_SHENANDOAHPACER_HPP
#include "gc/shenandoah/shenandoahNumberSeq.hpp"
#include "gc/shenandoah/shenandoahPadding.hpp"
+ #include "gc/shenandoah/shenandoahSharedVariables.hpp"
#include "memory/allocation.hpp"
+ #include "runtime/task.hpp"
class ShenandoahHeap;
+ class ShenandoahPacer;
+
+
+ // Periodic task to notify blocked paced waiters.
+ class ShenandoahPeriodicPacerNotifyTask : public PeriodicTask {
+ private:
+ ShenandoahPacer* const _pacer;
+ public:
+ explicit ShenandoahPeriodicPacerNotifyTask(ShenandoahPacer* pacer) :
+ PeriodicTask(PeriodicTask::min_interval),
+ _pacer(pacer) { }
+
+ void task() override;
+ };
+
#define PACING_PROGRESS_UNINIT (-1)
#define PACING_PROGRESS_ZERO ( 0)
/**
ShenandoahHeap* _heap;
double _last_time;
TruncatedSeq* _progress_history;
Monitor* _wait_monitor;
ShenandoahSharedFlag _need_notify_waiters;
+ ShenandoahPeriodicPacerNotifyTask _notify_waiters_task;
// Set once per phase
volatile intptr_t _epoch;
volatile double _tax_rate;
shenandoah_padding(2);
volatile intptr_t _progress;
shenandoah_padding(3);
public:
! ShenandoahPacer(ShenandoahHeap* heap) :
_heap(heap),
_last_time(os::elapsedTime()),
_progress_history(new TruncatedSeq(5)),
_wait_monitor(new Monitor(Mutex::safepoint-1, "ShenandoahWaitMonitor_lock", true)),
_epoch(0),
_tax_rate(1),
_budget(0),
! _progress(PACING_PROGRESS_UNINIT) {}
void setup_for_idle();
void setup_for_mark();
void setup_for_evac();
void setup_for_updaterefs();
shenandoah_padding(2);
volatile intptr_t _progress;
shenandoah_padding(3);
public:
! explicit ShenandoahPacer(ShenandoahHeap* heap) :
_heap(heap),
_last_time(os::elapsedTime()),
_progress_history(new TruncatedSeq(5)),
_wait_monitor(new Monitor(Mutex::safepoint-1, "ShenandoahWaitMonitor_lock", true)),
+ _notify_waiters_task(this),
_epoch(0),
_tax_rate(1),
_budget(0),
! _progress(PACING_PROGRESS_UNINIT) {
+ _notify_waiters_task.enroll();
+ }
void setup_for_idle();
void setup_for_mark();
void setup_for_evac();
void setup_for_updaterefs();
inline void report_evac(size_t words);
inline void report_updaterefs(size_t words);
inline void report_alloc(size_t words);
! bool claim_for_alloc(size_t words, bool force);
void pace_for_alloc(size_t words);
void unpace_for_alloc(intptr_t epoch, size_t words);
void notify_waiters();
inline void report_evac(size_t words);
inline void report_updaterefs(size_t words);
inline void report_alloc(size_t words);
! template<bool FORCE>
+ bool claim_for_alloc(size_t words);
+
void pace_for_alloc(size_t words);
void unpace_for_alloc(intptr_t epoch, size_t words);
void notify_waiters();
< prev index next >