114 |
114 |
115 // GC: we current use aggressive monitor deflation policy |
115 // GC: we current use aggressive monitor deflation policy |
116 // Basically we deflate all monitors that are not busy. |
116 // Basically we deflate all monitors that are not busy. |
117 // An adaptive profile-based deflation policy could be used if needed |
117 // An adaptive profile-based deflation policy could be used if needed |
118 static void deflate_idle_monitors(); |
118 static void deflate_idle_monitors(); |
119 static int walk_monitor_list(ObjectMonitor** listheadp, |
119 // For a given monitor list: global or per-thread, deflate idle monitors |
120 ObjectMonitor** freeHeadp, |
120 static int deflate_monitor_list(ObjectMonitor** listheadp, |
121 ObjectMonitor** freeTailp); |
121 ObjectMonitor** freeHeadp, |
|
122 ObjectMonitor** freeTailp); |
122 static bool deflate_monitor(ObjectMonitor* mid, oop obj, |
123 static bool deflate_monitor(ObjectMonitor* mid, oop obj, |
123 ObjectMonitor** freeHeadp, |
124 ObjectMonitor** freeHeadp, |
124 ObjectMonitor** freeTailp); |
125 ObjectMonitor** freeTailp); |
125 static void oops_do(OopClosure* f); |
126 static void oops_do(OopClosure* f); |
126 |
127 |
133 |
134 |
134 static void RegisterSpinCallback(int(*)(intptr_t, int), intptr_t); |
135 static void RegisterSpinCallback(int(*)(intptr_t, int), intptr_t); |
135 |
136 |
136 private: |
137 private: |
137 enum { _BLOCKSIZE = 128 }; |
138 enum { _BLOCKSIZE = 128 }; |
|
139 // global list of blocks of monitors |
138 // gBlockList is really PaddedEnd<ObjectMonitor> *, but we don't |
140 // gBlockList is really PaddedEnd<ObjectMonitor> *, but we don't |
139 // want to expose the PaddedEnd template more than necessary. |
141 // want to expose the PaddedEnd template more than necessary. |
140 static ObjectMonitor* gBlockList; |
142 static ObjectMonitor * gBlockList; |
|
143 // global monitor free list |
141 static ObjectMonitor * volatile gFreeList; |
144 static ObjectMonitor * volatile gFreeList; |
142 // global monitor in use list, for moribund threads, |
145 // global monitor in-use list, for moribund threads, |
143 // monitors they inflated need to be scanned for deflation |
146 // monitors they inflated need to be scanned for deflation |
144 static ObjectMonitor * volatile gOmInUseList; |
147 static ObjectMonitor * volatile gOmInUseList; |
145 // count of entries in gOmInUseList |
148 // count of entries in gOmInUseList |
146 static int gOmInUseCount; |
149 static int gOmInUseCount; |
147 |
|
148 }; |
150 }; |
149 |
151 |
150 // ObjectLocker enforced balanced locking and can never thrown an |
152 // ObjectLocker enforced balanced locking and can never thrown an |
151 // IllegalMonitorStateException. However, a pending exception may |
153 // IllegalMonitorStateException. However, a pending exception may |
152 // have to pass through, and we must also be able to deal with |
154 // have to pass through, and we must also be able to deal with |