29 #include "runtime/basicLock.hpp" |
29 #include "runtime/basicLock.hpp" |
30 #include "runtime/handles.hpp" |
30 #include "runtime/handles.hpp" |
31 #include "runtime/perfData.hpp" |
31 #include "runtime/perfData.hpp" |
32 |
32 |
33 class ObjectMonitor; |
33 class ObjectMonitor; |
|
34 |
|
35 struct DeflateMonitorCounters { |
|
36 int nInuse; // currently associated with objects |
|
37 int nInCirculation; // extant |
|
38 int nScavenged; // reclaimed |
|
39 }; |
34 |
40 |
35 class ObjectSynchronizer : AllStatic { |
41 class ObjectSynchronizer : AllStatic { |
36 friend class VMStructs; |
42 friend class VMStructs; |
37 public: |
43 public: |
38 typedef enum { |
44 typedef enum { |
125 static void monitors_iterate(MonitorClosure* m); |
131 static void monitors_iterate(MonitorClosure* m); |
126 |
132 |
127 // GC: we current use aggressive monitor deflation policy |
133 // GC: we current use aggressive monitor deflation policy |
128 // Basically we deflate all monitors that are not busy. |
134 // Basically we deflate all monitors that are not busy. |
129 // An adaptive profile-based deflation policy could be used if needed |
135 // An adaptive profile-based deflation policy could be used if needed |
130 static void deflate_idle_monitors(); |
136 static void deflate_idle_monitors(DeflateMonitorCounters* counters); |
|
137 static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters); |
|
138 static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters); |
|
139 static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters); |
|
140 |
131 // For a given monitor list: global or per-thread, deflate idle monitors |
141 // For a given monitor list: global or per-thread, deflate idle monitors |
132 static int deflate_monitor_list(ObjectMonitor** listheadp, |
142 static int deflate_monitor_list(ObjectMonitor** listheadp, |
133 ObjectMonitor** freeHeadp, |
143 ObjectMonitor** freeHeadp, |
134 ObjectMonitor** freeTailp); |
144 ObjectMonitor** freeTailp); |
135 static bool deflate_monitor(ObjectMonitor* mid, oop obj, |
145 static bool deflate_monitor(ObjectMonitor* mid, oop obj, |