Mercurial > hg > truffle
comparison src/share/vm/runtime/sweeper.cpp @ 4945:cfdfbeac0a5b
7145345: Code cache sweeper must cooperate with safepoints
Summary: Safepoint in the sweeper loop in necessary
Reviewed-by: kvn, never
author | iveresov |
---|---|
date | Wed, 15 Feb 2012 12:32:03 -0800 |
parents | f52ed367b66d |
children | 33df1aeaebbf d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
4944:09d00c18e323 | 4945:cfdfbeac0a5b |
---|---|
264 { | 264 { |
265 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | 265 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
266 | 266 |
267 // The last invocation iterates until there are no more nmethods | 267 // The last invocation iterates until there are no more nmethods |
268 for (int i = 0; (i < todo || _invocations == 1) && _current != NULL; i++) { | 268 for (int i = 0; (i < todo || _invocations == 1) && _current != NULL; i++) { |
269 | 269 if (SafepointSynchronize::is_synchronizing()) { // Safepoint request |
270 if (PrintMethodFlushing && Verbose) { | |
271 tty->print_cr("### Sweep at %d out of %d, invocation: %d, yielding to safepoint", _seen, CodeCache::nof_nmethods(), _invocations); | |
272 } | |
273 MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
274 | |
275 assert(Thread::current()->is_Java_thread(), "should be java thread"); | |
276 JavaThread* thread = (JavaThread*)Thread::current(); | |
277 ThreadBlockInVM tbivm(thread); | |
278 thread->java_suspend_self(); | |
279 } | |
270 // Since we will give up the CodeCache_lock, always skip ahead | 280 // Since we will give up the CodeCache_lock, always skip ahead |
271 // to the next nmethod. Other blobs can be deleted by other | 281 // to the next nmethod. Other blobs can be deleted by other |
272 // threads but nmethods are only reclaimed by the sweeper. | 282 // threads but nmethods are only reclaimed by the sweeper. |
273 nmethod* next = CodeCache::next_nmethod(_current); | 283 nmethod* next = CodeCache::next_nmethod(_current); |
274 | 284 |