< prev index next >

src/share/vm/runtime/safepoint.hpp

Print this page
rev 13053 : 8180932: Parallelize safepoint cleanup
Summary: Provide infrastructure to do safepoint cleanup tasks using parallel worker threads
Reviewed-by: dholmes, rehn


  58 class SafepointSynchronize : AllStatic {
  59  public:
  60   enum SynchronizeState {
  61       _not_synchronized = 0,                   // Threads not synchronized at a safepoint
  62                                                // Keep this value 0. See the comment in do_call_back()
  63       _synchronizing    = 1,                   // Synchronizing in progress
  64       _synchronized     = 2                    // All Java threads are stopped at a safepoint. Only VM thread is running
  65   };
  66 
  67   enum SafepointingThread {
  68       _null_thread  = 0,
  69       _vm_thread    = 1,
  70       _other_thread = 2
  71   };
  72 
  73   enum SafepointTimeoutReason {
  74     _spinning_timeout = 0,
  75     _blocking_timeout = 1
  76   };
  77 











  78   typedef struct {
  79     float  _time_stamp;                        // record when the current safepoint occurs in seconds
  80     int    _vmop_type;                         // type of VM operation triggers the safepoint
  81     int    _nof_total_threads;                 // total number of Java threads
  82     int    _nof_initial_running_threads;       // total number of initially seen running threads
  83     int    _nof_threads_wait_to_block;         // total number of threads waiting for to block
  84     bool   _page_armed;                        // true if polling page is armed, false otherwise
  85     int    _nof_threads_hit_page_trap;         // total number of threads hitting the page trap
  86     jlong  _time_to_spin;                      // total time in millis spent in spinning
  87     jlong  _time_to_wait_to_block;             // total time in millis spent in waiting for to block
  88     jlong  _time_to_do_cleanups;               // total time in millis spent in performing cleanups
  89     jlong  _time_to_sync;                      // total time in millis spent in getting to _synchronized
  90     jlong  _time_to_exec_vmop;                 // total time in millis spent in vm operation itself
  91   } SafepointStats;
  92 
  93  private:
  94   static volatile SynchronizeState _state;     // Threads might read this flag directly, without acquiring the Threads_lock
  95   static volatile int _waiting_to_block;       // number of threads we are waiting for to block
  96   static int _current_jni_active_count;        // Counts the number of active critical natives during the safepoint
  97 




  58 class SafepointSynchronize : AllStatic {
  59  public:
  60   enum SynchronizeState {
  61       _not_synchronized = 0,                   // Threads not synchronized at a safepoint
  62                                                // Keep this value 0. See the comment in do_call_back()
  63       _synchronizing    = 1,                   // Synchronizing in progress
  64       _synchronized     = 2                    // All Java threads are stopped at a safepoint. Only VM thread is running
  65   };
  66 
  67   enum SafepointingThread {
  68       _null_thread  = 0,
  69       _vm_thread    = 1,
  70       _other_thread = 2
  71   };
  72 
  73   enum SafepointTimeoutReason {
  74     _spinning_timeout = 0,
  75     _blocking_timeout = 1
  76   };
  77 
  78   enum SafepointCleanupTasks {
  79     SAFEPOINT_CLEANUP_DEFLATE_MONITORS,
  80     SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES,
  81     SAFEPOINT_CLEANUP_COMPILATION_POLICY,
  82     SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH,
  83     SAFEPOINT_CLEANUP_STRING_TABLE_REHASH,
  84     SAFEPOINT_CLEANUP_CLD_PURGE,
  85     // Leave this one last.
  86     SAFEPOINT_CLEANUP_NUM_TASKS
  87   };
  88 
  89   typedef struct {
  90     float  _time_stamp;                        // record when the current safepoint occurs in seconds
  91     int    _vmop_type;                         // type of VM operation triggers the safepoint
  92     int    _nof_total_threads;                 // total number of Java threads
  93     int    _nof_initial_running_threads;       // total number of initially seen running threads
  94     int    _nof_threads_wait_to_block;         // total number of threads waiting for to block
  95     bool   _page_armed;                        // true if polling page is armed, false otherwise
  96     int    _nof_threads_hit_page_trap;         // total number of threads hitting the page trap
  97     jlong  _time_to_spin;                      // total time in millis spent in spinning
  98     jlong  _time_to_wait_to_block;             // total time in millis spent in waiting for to block
  99     jlong  _time_to_do_cleanups;               // total time in millis spent in performing cleanups
 100     jlong  _time_to_sync;                      // total time in millis spent in getting to _synchronized
 101     jlong  _time_to_exec_vmop;                 // total time in millis spent in vm operation itself
 102   } SafepointStats;
 103 
 104  private:
 105   static volatile SynchronizeState _state;     // Threads might read this flag directly, without acquiring the Threads_lock
 106   static volatile int _waiting_to_block;       // number of threads we are waiting for to block
 107   static int _current_jni_active_count;        // Counts the number of active critical natives during the safepoint
 108 


< prev index next >