< prev index next >

src/hotspot/share/runtime/synchronizer.hpp

Print this page
rev 57560 : imported patch 8235795.patch.cr0


 115   // java.lang.Thread support
 116   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
 117   static LockOwnership query_lock_ownership(JavaThread* self, Handle h_obj);
 118 
 119   static JavaThread* get_lock_owner(ThreadsList * t_list, Handle h_obj);
 120 
 121   // JNI detach support
 122   static void release_monitors_owned_by_thread(TRAPS);
 123   static void monitors_iterate(MonitorClosure* m);
 124 
 125   // GC: we current use aggressive monitor deflation policy
 126   // Basically we deflate all monitors that are not busy.
 127   // An adaptive profile-based deflation policy could be used if needed
 128   static void deflate_idle_monitors(DeflateMonitorCounters* counters);
 129   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 130   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 131   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 132 
 133   // For a given monitor list: global or per-thread, deflate idle monitors
 134   static int deflate_monitor_list(ObjectMonitor** list_p,

 135                                   ObjectMonitor** free_head_p,
 136                                   ObjectMonitor** free_tail_p);
 137   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 138                               ObjectMonitor** free_head_p,
 139                               ObjectMonitor** free_tail_p);
 140   static bool is_cleanup_needed();
 141   static bool needs_monitor_scavenge();
 142   static void oops_do(OopClosure* f);
 143   // Process oops in thread local used monitors
 144   static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
 145 
 146   // debugging
 147   static void audit_and_print_stats(bool on_exit);
 148   static void chk_free_entry(JavaThread* jt, ObjectMonitor* n,
 149                              outputStream * out, int *error_cnt_p);
 150   static void chk_global_free_list_and_count(outputStream * out,
 151                                              int *error_cnt_p);
 152   static void chk_global_in_use_list_and_count(outputStream * out,
 153                                                int *error_cnt_p);
 154   static void chk_in_use_entry(JavaThread* jt, ObjectMonitor* n,
 155                                outputStream * out, int *error_cnt_p);
 156   static void chk_per_thread_in_use_list_and_count(JavaThread *jt,
 157                                                    outputStream * out,
 158                                                    int *error_cnt_p);
 159   static void chk_per_thread_free_list_and_count(JavaThread *jt,
 160                                                  outputStream * out,
 161                                                  int *error_cnt_p);
 162   static void log_in_use_monitor_details(outputStream * out, bool on_exit);
 163   static int  log_monitor_list_counts(outputStream * out);
 164   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 165 
 166  private:
 167   friend class SynchronizerTest;
 168 
 169   enum { _BLOCKSIZE = 128 };
 170   // global list of blocks of monitors
 171   static PaddedObjectMonitor* volatile g_block_list;
 172   // global monitor free list
 173   static ObjectMonitor* volatile g_free_list;
 174   // global monitor in-use list, for moribund threads,
 175   // monitors they inflated need to be scanned for deflation
 176   static ObjectMonitor* volatile g_om_in_use_list;
 177   // count of entries in g_om_in_use_list
 178   static int g_om_in_use_count;
 179 
 180   // Process oops in all global used monitors (i.e. moribund thread's monitors)
 181   static void global_used_oops_do(OopClosure* f);
 182   // Process oops in monitors on the given list
 183   static void list_oops_do(ObjectMonitor* list, OopClosure* f);
 184 
 185   // Support for SynchronizerTest access to GVars fields:
 186   static u_char* get_gvars_addr();
 187   static u_char* get_gvars_hc_sequence_addr();
 188   static size_t get_gvars_size();
 189   static u_char* get_gvars_stw_random_addr();
 190 };
 191 
 192 // ObjectLocker enforces balanced locking and can never throw an
 193 // IllegalMonitorStateException. However, a pending exception may
 194 // have to pass through, and we must also be able to deal with
 195 // asynchronous exceptions. The caller is responsible for checking
 196 // the thread's pending exception if needed.
 197 class ObjectLocker : public StackObj {
 198  private:


 115   // java.lang.Thread support
 116   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
 117   static LockOwnership query_lock_ownership(JavaThread* self, Handle h_obj);
 118 
 119   static JavaThread* get_lock_owner(ThreadsList * t_list, Handle h_obj);
 120 
 121   // JNI detach support
 122   static void release_monitors_owned_by_thread(TRAPS);
 123   static void monitors_iterate(MonitorClosure* m);
 124 
 125   // GC: we current use aggressive monitor deflation policy
 126   // Basically we deflate all monitors that are not busy.
 127   // An adaptive profile-based deflation policy could be used if needed
 128   static void deflate_idle_monitors(DeflateMonitorCounters* counters);
 129   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 130   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 131   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 132 
 133   // For a given monitor list: global or per-thread, deflate idle monitors
 134   static int deflate_monitor_list(ObjectMonitor** list_p,
 135                                   int* count_p,
 136                                   ObjectMonitor** free_head_p,
 137                                   ObjectMonitor** free_tail_p);
 138   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 139                               ObjectMonitor** free_head_p,
 140                               ObjectMonitor** free_tail_p);
 141   static bool is_cleanup_needed();
 142   static bool needs_monitor_scavenge();
 143   static void oops_do(OopClosure* f);
 144   // Process oops in thread local used monitors
 145   static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
 146 
 147   // debugging
 148   static void audit_and_print_stats(bool on_exit);
 149   static void chk_free_entry(JavaThread* jt, ObjectMonitor* n,
 150                              outputStream * out, int *error_cnt_p);
 151   static void chk_global_free_list_and_count(outputStream * out,
 152                                              int *error_cnt_p);
 153   static void chk_global_in_use_list_and_count(outputStream * out,
 154                                                int *error_cnt_p);
 155   static void chk_in_use_entry(JavaThread* jt, ObjectMonitor* n,
 156                                outputStream * out, int *error_cnt_p);
 157   static void chk_per_thread_in_use_list_and_count(JavaThread *jt,
 158                                                    outputStream * out,
 159                                                    int *error_cnt_p);
 160   static void chk_per_thread_free_list_and_count(JavaThread *jt,
 161                                                  outputStream * out,
 162                                                  int *error_cnt_p);
 163   static void log_in_use_monitor_details(outputStream * out);
 164   static int  log_monitor_list_counts(outputStream * out);
 165   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 166 
 167  private:
 168   friend class SynchronizerTest;
 169 
 170   enum { _BLOCKSIZE = 128 };
 171   // global list of blocks of monitors
 172   static PaddedObjectMonitor* g_block_list;
 173 
 174   // Function to prepend new blocks to the appropriate lists:
 175   static void prepend_block_to_lists(PaddedObjectMonitor* new_blk);




 176 
 177   // Process oops in all global used monitors (i.e. moribund thread's monitors)
 178   static void global_used_oops_do(OopClosure* f);
 179   // Process oops in monitors on the given list
 180   static void list_oops_do(ObjectMonitor* list, OopClosure* f);
 181 
 182   // Support for SynchronizerTest access to GVars fields:
 183   static u_char* get_gvars_addr();
 184   static u_char* get_gvars_hc_sequence_addr();
 185   static size_t get_gvars_size();
 186   static u_char* get_gvars_stw_random_addr();
 187 };
 188 
 189 // ObjectLocker enforces balanced locking and can never throw an
 190 // IllegalMonitorStateException. However, a pending exception may
 191 // have to pass through, and we must also be able to deal with
 192 // asynchronous exceptions. The caller is responsible for checking
 193 // the thread's pending exception if needed.
 194 class ObjectLocker : public StackObj {
 195  private:
< prev index next >