1.1 --- a/src/share/vm/code/codeCache.cpp Mon May 17 11:32:56 2010 -0700 1.2 +++ b/src/share/vm/code/codeCache.cpp Mon May 17 16:50:07 2010 -0700 1.3 @@ -124,6 +124,23 @@ 1.4 return (nmethod*)cb; 1.5 } 1.6 1.7 +nmethod* CodeCache::first_nmethod() { 1.8 + assert_locked_or_safepoint(CodeCache_lock); 1.9 + CodeBlob* cb = first(); 1.10 + while (cb != NULL && !cb->is_nmethod()) { 1.11 + cb = next(cb); 1.12 + } 1.13 + return (nmethod*)cb; 1.14 +} 1.15 + 1.16 +nmethod* CodeCache::next_nmethod (CodeBlob* cb) { 1.17 + assert_locked_or_safepoint(CodeCache_lock); 1.18 + cb = next(cb); 1.19 + while (cb != NULL && !cb->is_nmethod()) { 1.20 + cb = next(cb); 1.21 + } 1.22 + return (nmethod*)cb; 1.23 +} 1.24 1.25 CodeBlob* CodeCache::allocate(int size) { 1.26 // Do not seize the CodeCache lock here--if the caller has not 1.27 @@ -414,7 +431,7 @@ 1.28 saved->set_speculatively_disconnected(false); 1.29 saved->set_saved_nmethod_link(NULL); 1.30 if (PrintMethodFlushing) { 1.31 - saved->print_on(tty, " ### nmethod is reconnected"); 1.32 + saved->print_on(tty, " ### nmethod is reconnected\n"); 1.33 } 1.34 if (LogCompilation && (xtty != NULL)) { 1.35 ttyLocker ttyl; 1.36 @@ -432,7 +449,8 @@ 1.37 } 1.38 1.39 void CodeCache::remove_saved_code(nmethod* nm) { 1.40 - MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 1.41 + // For conc swpr this will be called with CodeCache_lock taken by caller 1.42 + assert_locked_or_safepoint(CodeCache_lock); 1.43 assert(nm->is_speculatively_disconnected(), "shouldn't call for other nmethods"); 1.44 nmethod* saved = _saved_nmethods; 1.45 nmethod* prev = NULL; 1.46 @@ -463,7 +481,7 @@ 1.47 nm->set_saved_nmethod_link(_saved_nmethods); 1.48 _saved_nmethods = nm; 1.49 if (PrintMethodFlushing) { 1.50 - nm->print_on(tty, " ### nmethod is speculatively disconnected"); 1.51 + nm->print_on(tty, " ### nmethod is speculatively disconnected\n"); 1.52 } 1.53 if (LogCompilation && (xtty != NULL)) { 1.54 ttyLocker ttyl;