< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahControlThread.hpp

Print this page
*** 55,66 ***
  
  class ShenandoahControlThread: public ConcurrentGCThread {
    friend class VMStructs;
  
  private:
-   typedef enum {
-     none,
-     concurrent_normal,
-     stw_degenerated,
-     stw_full
-   } GCMode;
- 
    // While we could have a single lock for these, it may risk unblocking
    // GC waiters when alloc failure GC cycle finishes. We want instead
    // to make complete explicit cycle for for demanding customers.
    Monitor _alloc_failure_waiters_lock;
    Monitor _gc_waiters_lock;
    ShenandoahPeriodicTask _periodic_task;
    ShenandoahPeriodicPacerNotify _periodic_pacer_notify_task;
  
  public:
    void run_service();
    void stop_service();
  
  private:
    ShenandoahSharedFlag _gc_requested;
    ShenandoahSharedFlag _alloc_failure_gc;
    ShenandoahSharedFlag _graceful_shutdown;
-   ShenandoahSharedFlag _heap_changed;
    ShenandoahSharedFlag _do_counters_update;
    ShenandoahSharedFlag _force_counters_update;
    GCCause::Cause       _requested_gc_cause;
    ShenandoahGC::ShenandoahDegenPoint _degen_point;
  
    shenandoah_padding(0);
    volatile size_t _allocs_seen;
    shenandoah_padding(1);
    volatile size_t _gc_id;
    shenandoah_padding(2);
  
    bool check_cancellation_or_degen(ShenandoahGC::ShenandoahDegenPoint point);
!   void service_concurrent_normal_cycle(GCCause::Cause cause);
    void service_stw_full_cycle(GCCause::Cause cause);
!   void service_stw_degenerated_cycle(GCCause::Cause cause, ShenandoahGC::ShenandoahDegenPoint point);
    void service_uncommit(double shrink_before, size_t shrink_until);
  
    bool try_set_alloc_failure_gc();
    void notify_alloc_failure_waiters();
    bool is_alloc_failure_gc();
  
    void reset_gc_id();
    void update_gc_id();
-   size_t get_gc_id();
  
    void notify_gc_waiters();
  
    // Handle GC request.
    // Blocks until GC is over.
    void handle_requested_gc(GCCause::Cause cause);
  
    bool is_explicit_gc(GCCause::Cause cause) const;
  
    bool check_soft_max_changed() const;
  
  public:
    // Constructor
--- 55,81 ---
  
  class ShenandoahControlThread: public ConcurrentGCThread {
    friend class VMStructs;
  
  private:
    // While we could have a single lock for these, it may risk unblocking
    // GC waiters when alloc failure GC cycle finishes. We want instead
    // to make complete explicit cycle for for demanding customers.
    Monitor _alloc_failure_waiters_lock;
    Monitor _gc_waiters_lock;
+   Monitor _control_lock;
    ShenandoahPeriodicTask _periodic_task;
    ShenandoahPeriodicPacerNotify _periodic_pacer_notify_task;
  
  public:
+   typedef enum {
+     none,
+     concurrent_normal,
+     stw_degenerated,
+     stw_full,
+     marking_old
+   } GCMode;
+ 
    void run_service();
    void stop_service();
  
+   size_t get_gc_id();
+ 
  private:
+   ShenandoahSharedFlag _allow_old_preemption;
+   ShenandoahSharedFlag _preemption_requested;
    ShenandoahSharedFlag _gc_requested;
    ShenandoahSharedFlag _alloc_failure_gc;
    ShenandoahSharedFlag _graceful_shutdown;
    ShenandoahSharedFlag _do_counters_update;
    ShenandoahSharedFlag _force_counters_update;
    GCCause::Cause       _requested_gc_cause;
+   GenerationMode       _requested_generation;
    ShenandoahGC::ShenandoahDegenPoint _degen_point;
+   ShenandoahGeneration* _degen_generation;
  
    shenandoah_padding(0);
    volatile size_t _allocs_seen;
    shenandoah_padding(1);
    volatile size_t _gc_id;
    shenandoah_padding(2);
+   volatile GCMode _mode;
+   shenandoah_padding(3);
  
    bool check_cancellation_or_degen(ShenandoahGC::ShenandoahDegenPoint point);
!   void resume_concurrent_old_cycle(ShenandoahGeneration* generation, GCCause::Cause cause);
+   void service_concurrent_cycle(ShenandoahGeneration* generation, GCCause::Cause cause, bool reset_old_bitmap_specially);
    void service_stw_full_cycle(GCCause::Cause cause);
! 
+   // Return true if degenerated cycle finishes normally.  Return false if the degenerated cycle transformed itself
+   // into a full GC.
+   bool service_stw_degenerated_cycle(GCCause::Cause cause, ShenandoahGC::ShenandoahDegenPoint point);
    void service_uncommit(double shrink_before, size_t shrink_until);
  
    bool try_set_alloc_failure_gc();
    void notify_alloc_failure_waiters();
    bool is_alloc_failure_gc();
  
    void reset_gc_id();
    void update_gc_id();
  
    void notify_gc_waiters();
  
    // Handle GC request.
    // Blocks until GC is over.
    void handle_requested_gc(GCCause::Cause cause);
  
    bool is_explicit_gc(GCCause::Cause cause) const;
+   bool is_implicit_gc(GCCause::Cause cause) const;
+ 
+   bool preempt_old_marking(GenerationMode generation);
  
    bool check_soft_max_changed() const;
  
  public:
    // Constructor

*** 128,10 ***
--- 143,11 ---
    // Handle allocation failure from evacuation path.
    // Optionally blocks while collector is handling the failure.
    void handle_alloc_failure_evac(size_t words);
  
    void request_gc(GCCause::Cause cause);
+   bool request_concurrent_gc(GenerationMode generation);
  
    void handle_counters_update();
    void handle_force_counters_update();
    void set_forced_counters_update(bool value);
  

*** 146,8 ***
--- 162,24 ---
    const char* name() const { return "ShenandoahControlThread";}
  
    // Printing
    void print_on(outputStream* st) const;
    void print() const;
+ 
+   void service_concurrent_normal_cycle(const ShenandoahHeap* heap,
+                                        const GenerationMode generation,
+                                        GCCause::Cause cause);
+ 
+   void service_concurrent_old_cycle(const ShenandoahHeap* heap,
+                                     GCCause::Cause &cause);
+ 
+   void set_gc_mode(GCMode new_mode);
+   GCMode gc_mode() {
+     return _mode;
+   }
+ 
+  private:
+   static const char* gc_mode_name(GCMode mode);
+   void notify_control_thread();
  };
  
  #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONTROLTHREAD_HPP
< prev index next >