< prev index next >

src/hotspot/share/runtime/synchronizer.hpp

Print this page
rev 54996 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.
rev 54997 : imported patch dcubed.monitor_deflate_conc.v2.01
rev 55000 : [mq]: dcubed.monitor_deflate_conc.v2.04


 145   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 146   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 147   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 148 
 149   // For a given monitor list: global or per-thread, deflate idle monitors
 150   static int deflate_monitor_list(ObjectMonitor** listheadp,
 151                                   ObjectMonitor** freeHeadp,
 152                                   ObjectMonitor** freeTailp);
 153   // For a given in-use monitor list: global or per-thread, deflate idle
 154   // monitors using a JavaThread.
 155   static int deflate_monitor_list_using_JT(ObjectMonitor** listHeadp,
 156                                            ObjectMonitor** freeHeadp,
 157                                            ObjectMonitor** freeTailp,
 158                                            ObjectMonitor** savedMidInUsep);
 159   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 160                               ObjectMonitor** freeHeadp,
 161                               ObjectMonitor** freeTailp);
 162   static bool deflate_monitor_using_JT(ObjectMonitor* mid,
 163                                        ObjectMonitor** freeHeadp,
 164                                        ObjectMonitor** freeTailp);
 165   static bool is_cleanup_needed();
 166   static bool is_cleanup_requested() { return _is_cleanup_requested; }
 167   static void set_is_cleanup_requested(bool new_value) { _is_cleanup_requested = new_value; }




 168   static void oops_do(OopClosure* f);
 169   // Process oops in thread local used monitors
 170   static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
 171 
 172   // debugging
 173   static void audit_and_print_stats(bool on_exit);
 174   static void chk_free_entry(JavaThread * jt, ObjectMonitor * n,
 175                              outputStream * out, int *error_cnt_p);
 176   static void chk_global_free_list_and_count(outputStream * out,
 177                                              int *error_cnt_p);
 178   static void chk_global_in_use_list_and_count(outputStream * out,
 179                                                int *error_cnt_p);
 180   static void chk_in_use_entry(JavaThread * jt, ObjectMonitor * n,
 181                                outputStream * out, int *error_cnt_p);
 182   static void chk_per_thread_in_use_list_and_count(JavaThread *jt,
 183                                                    outputStream * out,
 184                                                    int *error_cnt_p);
 185   static void chk_per_thread_free_list_and_count(JavaThread *jt,
 186                                                  outputStream * out,
 187                                                  int *error_cnt_p);
 188   static void log_in_use_monitor_details(outputStream * out, bool on_exit);
 189   static int  log_monitor_list_counts(outputStream * out);
 190   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 191 
 192   static bool gOmShouldDeflateIdleMonitors() { return _gOmShouldDeflateIdleMonitors; }
 193   static void do_safepoint_work(DeflateMonitorCounters* _counters);
 194 
 195  private:
 196   friend class SynchronizerTest;
 197 
 198   enum { _BLOCKSIZE = 128 };
 199   // global list of blocks of monitors
 200   static PaddedEnd<ObjectMonitor> * volatile gBlockList;
 201   // global monitor free list
 202   static ObjectMonitor * volatile gFreeList;
 203   // global monitor in-use list, for moribund threads,
 204   // monitors they inflated need to be scanned for deflation
 205   static ObjectMonitor * volatile gOmInUseList;
 206   // count of entries in gOmInUseList
 207   static int gOmInUseCount;
 208   static bool _gOmShouldDeflateIdleMonitors;
 209   static volatile bool _is_cleanup_requested;

 210 
 211   // Process oops in all global used monitors (i.e. moribund thread's monitors)
 212   static void global_used_oops_do(OopClosure* f);
 213   // Process oops in monitors on the given list
 214   static void list_oops_do(ObjectMonitor* list, OopClosure* f);
 215 
 216   // Support for SynchronizerTest access to GVars fields:
 217   static u_char* get_gvars_addr();
 218   static u_char* get_gvars_hcSequence_addr();
 219   static size_t get_gvars_size();
 220   static u_char* get_gvars_stwRandom_addr();
 221 };
 222 
 223 // ObjectLocker enforces balanced locking and can never throw an
 224 // IllegalMonitorStateException. However, a pending exception may
 225 // have to pass through, and we must also be able to deal with
 226 // asynchronous exceptions. The caller is responsible for checking
 227 // the thread's pending exception if needed.
 228 class ObjectLocker : public StackObj {
 229  private:


 145   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 146   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 147   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 148 
 149   // For a given monitor list: global or per-thread, deflate idle monitors
 150   static int deflate_monitor_list(ObjectMonitor** listheadp,
 151                                   ObjectMonitor** freeHeadp,
 152                                   ObjectMonitor** freeTailp);
 153   // For a given in-use monitor list: global or per-thread, deflate idle
 154   // monitors using a JavaThread.
 155   static int deflate_monitor_list_using_JT(ObjectMonitor** listHeadp,
 156                                            ObjectMonitor** freeHeadp,
 157                                            ObjectMonitor** freeTailp,
 158                                            ObjectMonitor** savedMidInUsep);
 159   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 160                               ObjectMonitor** freeHeadp,
 161                               ObjectMonitor** freeTailp);
 162   static bool deflate_monitor_using_JT(ObjectMonitor* mid,
 163                                        ObjectMonitor** freeHeadp,
 164                                        ObjectMonitor** freeTailp);
 165   static bool is_async_deflation_needed();
 166   static bool is_safepoint_deflation_needed();
 167   static bool is_async_deflation_requested() { return _is_async_deflation_requested; }
 168   static bool is_special_deflation_requested() { return _is_special_deflation_requested; }
 169   static void set_is_async_deflation_requested(bool new_value) { _is_async_deflation_requested = new_value; }
 170   static void set_is_special_deflation_requested(bool new_value) { _is_special_deflation_requested = new_value; }
 171   static jlong time_since_last_async_deflation_ms();
 172   static void oops_do(OopClosure* f);
 173   // Process oops in thread local used monitors
 174   static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
 175 
 176   // debugging
 177   static void audit_and_print_stats(bool on_exit);
 178   static void chk_free_entry(JavaThread * jt, ObjectMonitor * n,
 179                              outputStream * out, int *error_cnt_p);
 180   static void chk_global_free_list_and_count(outputStream * out,
 181                                              int *error_cnt_p);
 182   static void chk_global_in_use_list_and_count(outputStream * out,
 183                                                int *error_cnt_p);
 184   static void chk_in_use_entry(JavaThread * jt, ObjectMonitor * n,
 185                                outputStream * out, int *error_cnt_p);
 186   static void chk_per_thread_in_use_list_and_count(JavaThread *jt,
 187                                                    outputStream * out,
 188                                                    int *error_cnt_p);
 189   static void chk_per_thread_free_list_and_count(JavaThread *jt,
 190                                                  outputStream * out,
 191                                                  int *error_cnt_p);
 192   static void log_in_use_monitor_details(outputStream * out, bool on_exit);
 193   static int  log_monitor_list_counts(outputStream * out);
 194   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 195 

 196   static void do_safepoint_work(DeflateMonitorCounters* _counters);
 197 
 198  private:
 199   friend class SynchronizerTest;
 200 
 201   enum { _BLOCKSIZE = 128 };
 202   // global list of blocks of monitors
 203   static PaddedEnd<ObjectMonitor> * volatile gBlockList;
 204   // global monitor free list
 205   static ObjectMonitor * volatile gFreeList;
 206   // global monitor in-use list, for moribund threads,
 207   // monitors they inflated need to be scanned for deflation
 208   static ObjectMonitor * volatile gOmInUseList;
 209   // count of entries in gOmInUseList
 210   static int gOmInUseCount;
 211   static volatile bool _is_async_deflation_requested;
 212   static volatile bool _is_special_deflation_requested;
 213   static jlong         _last_async_deflation_time_ns;
 214 
 215   // Process oops in all global used monitors (i.e. moribund thread's monitors)
 216   static void global_used_oops_do(OopClosure* f);
 217   // Process oops in monitors on the given list
 218   static void list_oops_do(ObjectMonitor* list, OopClosure* f);
 219 
 220   // Support for SynchronizerTest access to GVars fields:
 221   static u_char* get_gvars_addr();
 222   static u_char* get_gvars_hcSequence_addr();
 223   static size_t get_gvars_size();
 224   static u_char* get_gvars_stwRandom_addr();
 225 };
 226 
 227 // ObjectLocker enforces balanced locking and can never throw an
 228 // IllegalMonitorStateException. However, a pending exception may
 229 // have to pass through, and we must also be able to deal with
 230 // asynchronous exceptions. The caller is responsible for checking
 231 // the thread's pending exception if needed.
 232 class ObjectLocker : public StackObj {
 233  private:
< prev index next >