7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ..

Eliminate the race condition.

Reviewed-by: kvn
This commit is contained in:
Igor Veresov 2011-04-14 00:02:21 -07:00
parent aac4b1553e
commit 3344bbfb29
3 changed files with 19 additions and 5 deletions

View file

@ -1736,8 +1736,14 @@ void CompileBroker::handle_full_code_cache() {
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();
}