< prev index next >

src/share/vm/runtime/safepoint.hpp

Print this page
rev 13265 : 8180932: Parallelize safepoint cleanup
Summary: Provide infrastructure to do safepoint cleanup tasks using parallel worker threads
Reviewed-by: dholmes, rehn, dcubed, thartmann
   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  56 // Implements roll-forward to safepoint (safepoint synchronization)
  57 //
  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


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  56 // Implements roll-forward to safepoint (safepoint synchronization)
  57 //
  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   // The enums are listed in the order of the tasks when done serially.
  79   enum SafepointCleanupTasks {
  80     SAFEPOINT_CLEANUP_DEFLATE_MONITORS,
  81     SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES,
  82     SAFEPOINT_CLEANUP_COMPILATION_POLICY,
  83     SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH,
  84     SAFEPOINT_CLEANUP_STRING_TABLE_REHASH,
  85     SAFEPOINT_CLEANUP_CLD_PURGE,
  86     // Leave this one last.
  87     SAFEPOINT_CLEANUP_NUM_TASKS
  88   };
  89 
  90   typedef struct {
  91     float  _time_stamp;                        // record when the current safepoint occurs in seconds
  92     int    _vmop_type;                         // type of VM operation triggers the safepoint
  93     int    _nof_total_threads;                 // total number of Java threads
  94     int    _nof_initial_running_threads;       // total number of initially seen running threads
  95     int    _nof_threads_wait_to_block;         // total number of threads waiting for to block
  96     bool   _page_armed;                        // true if polling page is armed, false otherwise
  97     int    _nof_threads_hit_page_trap;         // total number of threads hitting the page trap
  98     jlong  _time_to_spin;                      // total time in millis spent in spinning
  99     jlong  _time_to_wait_to_block;             // total time in millis spent in waiting for to block
 100     jlong  _time_to_do_cleanups;               // total time in millis spent in performing cleanups
 101     jlong  _time_to_sync;                      // total time in millis spent in getting to _synchronized
 102     jlong  _time_to_exec_vmop;                 // total time in millis spent in vm operation itself
 103   } SafepointStats;
 104 
 105  private:
 106   static volatile SynchronizeState _state;     // Threads might read this flag directly, without acquiring the Threads_lock
 107   static volatile int _waiting_to_block;       // number of threads we are waiting for to block


< prev index next >