< prev index next >

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

Print this page
rev 11463 : Backport Traversal GC


  41   ShenandoahControlThread* _thread;
  42 public:
  43   ShenandoahPeriodicTask(ShenandoahControlThread* thread) :
  44           PeriodicTask(100), _thread(thread) {}
  45   virtual void task();
  46 };
  47 
  48 // Periodic task to flush SATB buffers periodically.
  49 class ShenandoahPeriodicSATBFlushTask : public PeriodicTask {
  50 public:
  51   ShenandoahPeriodicSATBFlushTask() : PeriodicTask(ShenandoahSATBBufferFlushInterval) {}
  52   virtual void task();
  53 };
  54 
  55 class ShenandoahControlThread: public ConcurrentGCThread {
  56   friend class VMStructs;
  57 
  58 private:
  59   typedef enum {
  60     none,

  61     concurrent_normal,
  62     stw_degenerated,
  63     stw_full
  64   } GCMode;
  65 
  66   // While we could have a single lock for these, it may risk unblocking
  67   // GC waiters when alloc failure GC cycle finishes. We want instead
  68   // to make complete explicit cycle for for demanding customers.
  69   Monitor _alloc_failure_waiters_lock;
  70   Monitor _gc_waiters_lock;
  71   ShenandoahPeriodicTask _periodic_task;
  72   ShenandoahPeriodicSATBFlushTask _periodic_satb_flush_task;
  73 
  74  private:
  75   static SurrogateLockerThread* _slt;
  76 
  77 public:
  78   void run();
  79   void stop();
  80 
  81 private:
  82   ShenandoahSharedFlag _gc_requested;
  83   ShenandoahSharedFlag _alloc_failure_gc;
  84   ShenandoahSharedFlag _graceful_shutdown;
  85   ShenandoahSharedFlag _heap_changed;
  86   ShenandoahSharedFlag _do_counters_update;
  87   ShenandoahSharedFlag _force_counters_update;
  88   GCCause::Cause       _requested_gc_cause;
  89   ShenandoahHeap::ShenandoahDegenPoint _degen_point;
  90 
  91   char _pad0[DEFAULT_CACHE_LINE_SIZE];
  92   volatile intptr_t _allocs_seen;
  93   char _pad1[DEFAULT_CACHE_LINE_SIZE];
  94 
  95   bool check_cancellation_or_degen(ShenandoahHeap::ShenandoahDegenPoint point);
  96   void service_concurrent_normal_cycle(GCCause::Cause cause);
  97   void service_stw_full_cycle(GCCause::Cause cause);
  98   void service_stw_degenerated_cycle(GCCause::Cause cause, ShenandoahHeap::ShenandoahDegenPoint point);

  99   void service_uncommit(double shrink_before);
 100 
 101   bool try_set_alloc_failure_gc();
 102   void notify_alloc_failure_waiters();
 103   bool is_alloc_failure_gc();
 104 
 105   void notify_gc_waiters();
 106 
 107   // Handle GC request.
 108   // Blocks until GC is over.
 109   void handle_requested_gc(GCCause::Cause cause);
 110 
 111   bool is_explicit_gc(GCCause::Cause cause) const;
 112 public:
 113   // Constructor
 114   ShenandoahControlThread();
 115   ~ShenandoahControlThread();
 116 
 117   static void makeSurrogateLockerThread(TRAPS);
 118   static SurrogateLockerThread* slt() { return _slt; }




  41   ShenandoahControlThread* _thread;
  42 public:
  43   ShenandoahPeriodicTask(ShenandoahControlThread* thread) :
  44           PeriodicTask(100), _thread(thread) {}
  45   virtual void task();
  46 };
  47 
  48 // Periodic task to flush SATB buffers periodically.
  49 class ShenandoahPeriodicSATBFlushTask : public PeriodicTask {
  50 public:
  51   ShenandoahPeriodicSATBFlushTask() : PeriodicTask(ShenandoahSATBBufferFlushInterval) {}
  52   virtual void task();
  53 };
  54 
  55 class ShenandoahControlThread: public ConcurrentGCThread {
  56   friend class VMStructs;
  57 
  58 private:
  59   typedef enum {
  60     none,
  61     concurrent_traversal,
  62     concurrent_normal,
  63     stw_degenerated,
  64     stw_full
  65   } GCMode;
  66 
  67   // While we could have a single lock for these, it may risk unblocking
  68   // GC waiters when alloc failure GC cycle finishes. We want instead
  69   // to make complete explicit cycle for for demanding customers.
  70   Monitor _alloc_failure_waiters_lock;
  71   Monitor _gc_waiters_lock;
  72   ShenandoahPeriodicTask _periodic_task;
  73   ShenandoahPeriodicSATBFlushTask _periodic_satb_flush_task;
  74 
  75  private:
  76   static SurrogateLockerThread* _slt;
  77 
  78 public:
  79   void run();
  80   void stop();
  81 
  82 private:
  83   ShenandoahSharedFlag _gc_requested;
  84   ShenandoahSharedFlag _alloc_failure_gc;
  85   ShenandoahSharedFlag _graceful_shutdown;
  86   ShenandoahSharedFlag _heap_changed;
  87   ShenandoahSharedFlag _do_counters_update;
  88   ShenandoahSharedFlag _force_counters_update;
  89   GCCause::Cause       _requested_gc_cause;
  90   ShenandoahHeap::ShenandoahDegenPoint _degen_point;
  91 
  92   char _pad0[DEFAULT_CACHE_LINE_SIZE];
  93   volatile intptr_t _allocs_seen;
  94   char _pad1[DEFAULT_CACHE_LINE_SIZE];
  95 
  96   bool check_cancellation_or_degen(ShenandoahHeap::ShenandoahDegenPoint point);
  97   void service_concurrent_normal_cycle(GCCause::Cause cause);
  98   void service_stw_full_cycle(GCCause::Cause cause);
  99   void service_stw_degenerated_cycle(GCCause::Cause cause, ShenandoahHeap::ShenandoahDegenPoint point);
 100   void service_concurrent_traversal_cycle(GCCause::Cause cause);
 101   void service_uncommit(double shrink_before);
 102 
 103   bool try_set_alloc_failure_gc();
 104   void notify_alloc_failure_waiters();
 105   bool is_alloc_failure_gc();
 106 
 107   void notify_gc_waiters();
 108 
 109   // Handle GC request.
 110   // Blocks until GC is over.
 111   void handle_requested_gc(GCCause::Cause cause);
 112 
 113   bool is_explicit_gc(GCCause::Cause cause) const;
 114 public:
 115   // Constructor
 116   ShenandoahControlThread();
 117   ~ShenandoahControlThread();
 118 
 119   static void makeSurrogateLockerThread(TRAPS);
 120   static SurrogateLockerThread* slt() { return _slt; }


< prev index next >