# HG changeset patch # User twisti # Date 1302788798 25200 # Node ID e9b9554f7fc31109d462b47a269c0c37bbfd483c # Parent 1fcd6e9c3965f4bf23f6a8f4fbb77fdf74de37a7# Parent dbccacb79c6369d8417ccf6539904cae913ed735 Merge diff -r 1fcd6e9c3965 -r e9b9554f7fc3 src/share/vm/code/codeCache.cpp --- a/src/share/vm/code/codeCache.cpp Thu Apr 14 01:53:12 2011 -0700 +++ b/src/share/vm/code/codeCache.cpp Thu Apr 14 06:46:38 2011 -0700 @@ -971,8 +971,6 @@ if (CodeCache_lock->owned_by_self()) { return _heap->largest_free_block(); } else { - // Avoid lock ordering problems with ttyLock. - ttyUnlocker ttyul; MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); return _heap->largest_free_block(); } diff -r 1fcd6e9c3965 -r e9b9554f7fc3 src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Thu Apr 14 01:53:12 2011 -0700 +++ b/src/share/vm/compiler/compileBroker.cpp Thu Apr 14 06:46:38 2011 -0700 @@ -1736,8 +1736,14 @@ UseInterpreter = true; if (UseCompiler || AlwaysCompileLoopMethods ) { if (xtty != NULL) { + stringStream s; + // Dump code cache state into a buffer before locking the tty, + // because log_state() will use locks causing lock conflicts. + CodeCache::log_state(&s); + // Lock to prevent tearing + ttyLocker ttyl; xtty->begin_elem("code_cache_full"); - CodeCache::log_state(xtty); + xtty->print(s.as_string()); xtty->stamp(); xtty->end_elem(); } diff -r 1fcd6e9c3965 -r e9b9554f7fc3 src/share/vm/runtime/sweeper.cpp --- a/src/share/vm/runtime/sweeper.cpp Thu Apr 14 01:53:12 2011 -0700 +++ b/src/share/vm/runtime/sweeper.cpp Thu Apr 14 06:46:38 2011 -0700 @@ -418,6 +418,11 @@ // state of the code cache if it's requested. void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { if (PrintMethodFlushing) { + stringStream s; + // Dump code cache state into a buffer before locking the tty, + // because log_state() will use locks causing lock conflicts. + CodeCache::log_state(&s); + ttyLocker ttyl; tty->print("### sweeper: %s ", msg); if (format != NULL) { @@ -426,10 +431,15 @@ tty->vprint(format, ap); va_end(ap); } - CodeCache::log_state(tty); tty->cr(); + tty->print_cr(s.as_string()); } if (LogCompilation && (xtty != NULL)) { + stringStream s; + // Dump code cache state into a buffer before locking the tty, + // because log_state() will use locks causing lock conflicts. + CodeCache::log_state(&s); + ttyLocker ttyl; xtty->begin_elem("sweeper state='%s' traversals='" INTX_FORMAT "' ", msg, (intx)traversal_count()); if (format != NULL) { @@ -438,7 +448,7 @@ xtty->vprint(format, ap); va_end(ap); } - CodeCache::log_state(xtty); + xtty->print(s.as_string()); xtty->stamp(); xtty->end_elem(); }