< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahPacer.hpp

Print this page
rev 10543 : [backport] Application pacing precision fixes
rev 10566 : [backport] Pacer should account actual size for elastic TLABs
rev 10598 : [backport] Shenandoah changes to allow enabling -Wreorder

@@ -27,10 +27,13 @@
 #include "memory/allocation.hpp"
 #include "utilities/numberSeq.hpp"
 
 class ShenandoahHeap;
 
+#define PACING_PROGRESS_UNINIT (-1)
+#define PACING_PROGRESS_ZERO   ( 0)
+
 /**
  * ShenandoahPacer provides allocation pacing mechanism.
  *
  * Currently it implements simple tax-and-spend pacing policy: GC threads provide
  * credit, allocating thread spend the credit, or stall when credit is not available.

@@ -40,13 +43,21 @@
   ShenandoahHeap* _heap;
   volatile intptr_t _budget;
   volatile jdouble _tax_rate;
   BinaryMagnitudeSeq _delays;
 
+  volatile intptr_t _progress;
+  TruncatedSeq* _progress_history;
+  volatile intptr_t _epoch;
+
 public:
   ShenandoahPacer(ShenandoahHeap* heap) :
-          _heap(heap), _budget(0), _tax_rate(1) {}
+          _heap(heap), _budget(0), _tax_rate(1),
+          _progress(PACING_PROGRESS_UNINIT),
+          _progress_history(new TruncatedSeq(5)),
+          _epoch(0) {
+  }
 
   void setup_for_idle();
   void setup_for_mark();
   void setup_for_evac();
   void setup_for_updaterefs();

@@ -57,14 +68,21 @@
 
   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);
+
+  intptr_t epoch();
 
   void print_on(outputStream* out) const;
 
 private:
   inline void report_internal(size_t words);
+  inline void report_progress_internal(size_t words);
+
   void restart_with(jlong non_taxable_bytes, jdouble tax_rate);
+
+  size_t update_and_get_progress_history();
 };
 
 #endif //SHARE_VM_GC_SHENANDOAH_SHENANDOAHPACER_HPP
< prev index next >