Mercurial > hg > truffle
diff src/share/vm/code/codeCache.cpp @ 1538:bfe29ec02863
6950075: nmethod sweeper should operate concurrently
Reviewed-by: never, kvn
Contributed-by: eric.caspole@amd.com
author | never |
---|---|
date | Mon, 17 May 2010 16:50:07 -0700 |
parents | ed4f78aa9282 |
children | c18cbe5936b8 1a5913bf5e19 |
line wrap: on
line diff
--- a/src/share/vm/code/codeCache.cpp Mon May 17 11:32:56 2010 -0700 +++ b/src/share/vm/code/codeCache.cpp Mon May 17 16:50:07 2010 -0700 @@ -124,6 +124,23 @@ return (nmethod*)cb; } +nmethod* CodeCache::first_nmethod() { + assert_locked_or_safepoint(CodeCache_lock); + CodeBlob* cb = first(); + while (cb != NULL && !cb->is_nmethod()) { + cb = next(cb); + } + return (nmethod*)cb; +} + +nmethod* CodeCache::next_nmethod (CodeBlob* cb) { + assert_locked_or_safepoint(CodeCache_lock); + cb = next(cb); + while (cb != NULL && !cb->is_nmethod()) { + cb = next(cb); + } + return (nmethod*)cb; +} CodeBlob* CodeCache::allocate(int size) { // Do not seize the CodeCache lock here--if the caller has not @@ -414,7 +431,7 @@ saved->set_speculatively_disconnected(false); saved->set_saved_nmethod_link(NULL); if (PrintMethodFlushing) { - saved->print_on(tty, " ### nmethod is reconnected"); + saved->print_on(tty, " ### nmethod is reconnected\n"); } if (LogCompilation && (xtty != NULL)) { ttyLocker ttyl; @@ -432,7 +449,8 @@ } void CodeCache::remove_saved_code(nmethod* nm) { - MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + // For conc swpr this will be called with CodeCache_lock taken by caller + assert_locked_or_safepoint(CodeCache_lock); assert(nm->is_speculatively_disconnected(), "shouldn't call for other nmethods"); nmethod* saved = _saved_nmethods; nmethod* prev = NULL; @@ -463,7 +481,7 @@ nm->set_saved_nmethod_link(_saved_nmethods); _saved_nmethods = nm; if (PrintMethodFlushing) { - nm->print_on(tty, " ### nmethod is speculatively disconnected"); + nm->print_on(tty, " ### nmethod is speculatively disconnected\n"); } if (LogCompilation && (xtty != NULL)) { ttyLocker ttyl;