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

Thu, 14 Apr 2011 00:02:21 -0700

author
iveresov
date
Thu, 14 Apr 2011 00:02:21 -0700
changeset 2764
dbccacb79c63
parent 2763
3a808be061ff
child 2766
e9b9554f7fc3

7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
Summary: Eliminate the race condition.
Reviewed-by: kvn

src/share/vm/code/codeCache.cpp file | annotate | diff | comparison | revisions
src/share/vm/compiler/compileBroker.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/sweeper.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/code/codeCache.cpp	Wed Apr 13 14:33:03 2011 -0700
     1.2 +++ b/src/share/vm/code/codeCache.cpp	Thu Apr 14 00:02:21 2011 -0700
     1.3 @@ -971,8 +971,6 @@
     1.4    if (CodeCache_lock->owned_by_self()) {
     1.5      return _heap->largest_free_block();
     1.6    } else {
     1.7 -    // Avoid lock ordering problems with ttyLock.
     1.8 -    ttyUnlocker ttyul;
     1.9      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
    1.10      return _heap->largest_free_block();
    1.11    }
     2.1 --- a/src/share/vm/compiler/compileBroker.cpp	Wed Apr 13 14:33:03 2011 -0700
     2.2 +++ b/src/share/vm/compiler/compileBroker.cpp	Thu Apr 14 00:02:21 2011 -0700
     2.3 @@ -1736,8 +1736,14 @@
     2.4    UseInterpreter = true;
     2.5    if (UseCompiler || AlwaysCompileLoopMethods ) {
     2.6      if (xtty != NULL) {
     2.7 +      stringStream s;
     2.8 +      // Dump code cache state into a buffer before locking the tty,
     2.9 +      // because log_state() will use locks causing lock conflicts.
    2.10 +      CodeCache::log_state(&s);
    2.11 +      // Lock to prevent tearing
    2.12 +      ttyLocker ttyl;
    2.13        xtty->begin_elem("code_cache_full");
    2.14 -      CodeCache::log_state(xtty);
    2.15 +      xtty->print(s.as_string());
    2.16        xtty->stamp();
    2.17        xtty->end_elem();
    2.18      }
     3.1 --- a/src/share/vm/runtime/sweeper.cpp	Wed Apr 13 14:33:03 2011 -0700
     3.2 +++ b/src/share/vm/runtime/sweeper.cpp	Thu Apr 14 00:02:21 2011 -0700
     3.3 @@ -418,6 +418,11 @@
     3.4  // state of the code cache if it's requested.
     3.5  void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
     3.6    if (PrintMethodFlushing) {
     3.7 +    stringStream s;
     3.8 +    // Dump code cache state into a buffer before locking the tty,
     3.9 +    // because log_state() will use locks causing lock conflicts.
    3.10 +    CodeCache::log_state(&s);
    3.11 +
    3.12      ttyLocker ttyl;
    3.13      tty->print("### sweeper: %s ", msg);
    3.14      if (format != NULL) {
    3.15 @@ -426,10 +431,15 @@
    3.16        tty->vprint(format, ap);
    3.17        va_end(ap);
    3.18      }
    3.19 -    CodeCache::log_state(tty); tty->cr();
    3.20 +    tty->print_cr(s.as_string());
    3.21    }
    3.22  
    3.23    if (LogCompilation && (xtty != NULL)) {
    3.24 +    stringStream s;
    3.25 +    // Dump code cache state into a buffer before locking the tty,
    3.26 +    // because log_state() will use locks causing lock conflicts.
    3.27 +    CodeCache::log_state(&s);
    3.28 +
    3.29      ttyLocker ttyl;
    3.30      xtty->begin_elem("sweeper state='%s' traversals='" INTX_FORMAT "' ", msg, (intx)traversal_count());
    3.31      if (format != NULL) {
    3.32 @@ -438,7 +448,7 @@
    3.33        xtty->vprint(format, ap);
    3.34        va_end(ap);
    3.35      }
    3.36 -    CodeCache::log_state(xtty);
    3.37 +    xtty->print(s.as_string());
    3.38      xtty->stamp();
    3.39      xtty->end_elem();
    3.40    }

mercurial