src/share/vm/gc_implementation/shared/concurrentGCThread.hpp

changeset 6906
581e70386ec9
parent 6198
55fb97c4c58d
child 7360
4e4ebe50c8e3
     1.1 --- a/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp	Mon Jun 23 16:43:41 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp	Fri Apr 11 12:29:24 2014 +0200
     1.3 @@ -26,55 +26,8 @@
     1.4  #define SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP
     1.5  
     1.6  #include "utilities/macros.hpp"
     1.7 -#if INCLUDE_ALL_GCS
     1.8 +#include "gc_implementation/shared/suspendibleThreadSet.hpp"
     1.9  #include "runtime/thread.hpp"
    1.10 -#endif // INCLUDE_ALL_GCS
    1.11 -
    1.12 -class VoidClosure;
    1.13 -
    1.14 -// A SuspendibleThreadSet is (obviously) a set of threads that can be
    1.15 -// suspended.  A thread can join and later leave the set, and periodically
    1.16 -// yield.  If some thread (not in the set) requests, via suspend_all, that
    1.17 -// the threads be suspended, then the requesting thread is blocked until
    1.18 -// all the threads in the set have yielded or left the set.  (Threads may
    1.19 -// not enter the set when an attempted suspension is in progress.)  The
    1.20 -// suspending thread later calls resume_all, allowing the suspended threads
    1.21 -// to continue.
    1.22 -
    1.23 -class SuspendibleThreadSet {
    1.24 -  Monitor* _m;
    1.25 -  int      _async;
    1.26 -  bool     _async_stop;
    1.27 -  int      _async_stopped;
    1.28 -  bool     _initialized;
    1.29 -  double   _suspend_all_start;
    1.30 -
    1.31 -  void initialize_work();
    1.32 -
    1.33 - public:
    1.34 -  SuspendibleThreadSet() : _initialized(false) {}
    1.35 -
    1.36 -  // Add the current thread to the set.  May block if a suspension
    1.37 -  // is in progress.
    1.38 -  void join();
    1.39 -  // Removes the current thread from the set.
    1.40 -  void leave();
    1.41 -  // Returns "true" iff an suspension is in progress.
    1.42 -  bool should_yield() { return _async_stop; }
    1.43 -  // Suspends the current thread if a suspension is in progress (for
    1.44 -  // the duration of the suspension.)
    1.45 -  void yield(const char* id);
    1.46 -  // Return when all threads in the set are suspended.
    1.47 -  void suspend_all();
    1.48 -  // Allow suspended threads to resume.
    1.49 -  void resume_all();
    1.50 -  // Redundant initializations okay.
    1.51 -  void initialize() {
    1.52 -    // Double-check dirty read idiom.
    1.53 -    if (!_initialized) initialize_work();
    1.54 -  }
    1.55 -};
    1.56 -
    1.57  
    1.58  class ConcurrentGCThread: public NamedThread {
    1.59    friend class VMStructs;
    1.60 @@ -96,9 +49,6 @@
    1.61    static int set_CGC_flag(int b)           { return _CGC_flag |= b; }
    1.62    static int reset_CGC_flag(int b)         { return _CGC_flag &= ~b; }
    1.63  
    1.64 -  // All instances share this one set.
    1.65 -  static SuspendibleThreadSet _sts;
    1.66 -
    1.67    // Create and start the thread (setting it's priority high.)
    1.68    void create_and_start();
    1.69  
    1.70 @@ -121,25 +71,6 @@
    1.71  
    1.72    // Tester
    1.73    bool is_ConcurrentGC_thread() const          { return true;       }
    1.74 -
    1.75 -  static void safepoint_synchronize();
    1.76 -  static void safepoint_desynchronize();
    1.77 -
    1.78 -  // All overridings should probably do _sts::yield, but we allow
    1.79 -  // overriding for distinguished debugging messages.  Default is to do
    1.80 -  // nothing.
    1.81 -  virtual void yield() {}
    1.82 -
    1.83 -  bool should_yield() { return _sts.should_yield(); }
    1.84 -
    1.85 -  // they are prefixed by sts since there are already yield() and
    1.86 -  // should_yield() (non-static) methods in this class and it was an
    1.87 -  // easy way to differentiate them.
    1.88 -  static void stsYield(const char* id);
    1.89 -  static bool stsShouldYield();
    1.90 -  static void stsJoin();
    1.91 -  static void stsLeave();
    1.92 -
    1.93  };
    1.94  
    1.95  // The SurrogateLockerThread is used by concurrent GC threads for

mercurial