--- old/src/hotspot/share/runtime/synchronizer.hpp 2019-08-28 15:04:02.778957288 -0400 +++ new/src/hotspot/share/runtime/synchronizer.hpp 2019-08-28 15:04:02.590957295 -0400 @@ -44,11 +44,11 @@ typedef PaddedEnd PaddedObjectMonitor; struct DeflateMonitorCounters { - int n_in_use; // currently associated with objects - int n_in_circulation; // extant - int n_scavenged; // reclaimed (global and per-thread) - int per_thread_scavenged; // per-thread scavenge total - double per_thread_times; // per-thread scavenge times + volatile int n_in_use; // currently associated with objects + volatile int n_in_circulation; // extant + volatile int n_scavenged; // reclaimed (global and per-thread) + volatile int per_thread_scavenged; // per-thread scavenge total + double per_thread_times; // per-thread scavenge times }; class ObjectSynchronizer : AllStatic { @@ -155,14 +155,14 @@ static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters); // For a given monitor list: global or per-thread, deflate idle monitors - static int deflate_monitor_list(ObjectMonitor** list_p, - int* count_p, + static int deflate_monitor_list(ObjectMonitor* volatile * list_p, + int volatile * count_p, ObjectMonitor** free_head_p, ObjectMonitor** free_tail_p); // For a given in-use monitor list: global or per-thread, deflate idle // monitors using a JavaThread. - static int deflate_monitor_list_using_JT(ObjectMonitor** list_p, - int* count_p, + static int deflate_monitor_list_using_JT(ObjectMonitor* volatile * list_p, + int volatile * count_p, ObjectMonitor** free_head_p, ObjectMonitor** free_tail_p, ObjectMonitor** saved_mid_in_use_p); @@ -199,11 +199,11 @@ static void chk_per_thread_free_list_and_count(JavaThread *jt, outputStream * out, int *error_cnt_p); - static void log_in_use_monitor_details(outputStream * out, bool on_exit); + static void log_in_use_monitor_details(outputStream * out); static int log_monitor_list_counts(outputStream * out); static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0; - static void do_safepoint_work(DeflateMonitorCounters* _counters); + static void do_safepoint_work(DeflateMonitorCounters* counters); private: friend class SynchronizerTest; @@ -215,10 +215,13 @@ static volatile bool _is_special_deflation_requested; static jlong _last_async_deflation_time_ns; + // Function to prepend new blocks to the appropriate lists: + static void prepend_block_to_lists(PaddedObjectMonitor* new_blk); + // Process oops in all global used monitors (i.e. moribund thread's monitors) static void global_used_oops_do(OopClosure* f); // Process oops in monitors on the given list - static void list_oops_do(ObjectMonitor* list, OopClosure* f); + static void list_oops_do(ObjectMonitor* list, int count, OopClosure* f); // Support for SynchronizerTest access to GVars fields: static u_char* get_gvars_addr();