comparison src/share/vm/runtime/synchronizer.hpp @ 1640:bfc89697cccb

6964164: MonitorInUseLists leak of contended objects Summary: fix MonitorInUseLists memory leak and MonitorBound now works Reviewed-by: chrisphi, dice
author acorn
date Fri, 02 Jul 2010 17:23:43 -0400
parents 3a9de63b2209
children fa83ab460c54
comparison
equal deleted inserted replaced
1627:c5f1ea9e15e8 1640:bfc89697cccb
120 // with original recursion count 120 // with original recursion count
121 static intptr_t complete_exit (Handle obj, TRAPS); 121 static intptr_t complete_exit (Handle obj, TRAPS);
122 static void reenter (Handle obj, intptr_t recursion, TRAPS); 122 static void reenter (Handle obj, intptr_t recursion, TRAPS);
123 123
124 // thread-specific and global objectMonitor free list accessors 124 // thread-specific and global objectMonitor free list accessors
125 // static void verifyInUse (Thread * Self) ; too slow for general assert/debug
125 static ObjectMonitor * omAlloc (Thread * Self) ; 126 static ObjectMonitor * omAlloc (Thread * Self) ;
126 static void omRelease (Thread * Self, ObjectMonitor * m) ; 127 static void omRelease (Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc) ;
127 static void omFlush (Thread * Self) ; 128 static void omFlush (Thread * Self) ;
128 129
129 // Inflate light weight monitor to heavy weight monitor 130 // Inflate light weight monitor to heavy weight monitor
130 static ObjectMonitor* inflate(Thread * Self, oop obj); 131 static ObjectMonitor* inflate(Thread * Self, oop obj);
131 // This version is only for internal use 132 // This version is only for internal use
148 149
149 // GC: we current use aggressive monitor deflation policy 150 // GC: we current use aggressive monitor deflation policy
150 // Basically we deflate all monitors that are not busy. 151 // Basically we deflate all monitors that are not busy.
151 // An adaptive profile-based deflation policy could be used if needed 152 // An adaptive profile-based deflation policy could be used if needed
152 static void deflate_idle_monitors(); 153 static void deflate_idle_monitors();
154 static int walk_monitor_list(ObjectMonitor** listheadp,
155 ObjectMonitor** FreeHeadp,
156 ObjectMonitor** FreeTailp);
153 static bool deflate_monitor(ObjectMonitor* mid, oop obj, ObjectMonitor** FreeHeadp, 157 static bool deflate_monitor(ObjectMonitor* mid, oop obj, ObjectMonitor** FreeHeadp,
154 ObjectMonitor** FreeTailp); 158 ObjectMonitor** FreeTailp);
155 static void oops_do(OopClosure* f); 159 static void oops_do(OopClosure* f);
156 160
157 // debugging 161 // debugging
161 165
162 private: 166 private:
163 enum { _BLOCKSIZE = 128 }; 167 enum { _BLOCKSIZE = 128 };
164 static ObjectMonitor* gBlockList; 168 static ObjectMonitor* gBlockList;
165 static ObjectMonitor * volatile gFreeList; 169 static ObjectMonitor * volatile gFreeList;
170 static ObjectMonitor * volatile gOmInUseList; // for moribund thread, so monitors they inflated still get scanned
171 static int gOmInUseCount;
166 172
167 public: 173 public:
168 static void Initialize () ; 174 static void Initialize () ;
169 static PerfCounter * _sync_ContendedLockAttempts ; 175 static PerfCounter * _sync_ContendedLockAttempts ;
170 static PerfCounter * _sync_FutileWakeups ; 176 static PerfCounter * _sync_FutileWakeups ;