--- old/src/share/vm/compiler/compileBroker.cpp 2011-04-13 18:50:23.032443000 -0700 +++ new/src/share/vm/compiler/compileBroker.cpp 2011-04-13 18:50:22.854926000 -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(); }