7034585: Adjust fillInStackTrace filtering to assist 6998871

Tue, 12 Apr 2011 02:53:06 -0400

author
dholmes
date
Tue, 12 Apr 2011 02:53:06 -0400
changeset 2758
6a615eae2f34
parent 2757
c49c3947b98a
child 2759
3449f5e02cc4
child 2774
c737922fd8bb

7034585: Adjust fillInStackTrace filtering to assist 6998871
Summary: Allow for one or more fillInStackTrace frames to be skipped
Reviewed-by: mchung, kvn

src/share/vm/classfile/javaClasses.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/vmSymbols.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/javaClasses.cpp	Mon Apr 11 11:12:41 2011 +0200
     1.2 +++ b/src/share/vm/classfile/javaClasses.cpp	Tue Apr 12 02:53:06 2011 -0400
     1.3 @@ -1444,32 +1444,41 @@
     1.4        }
     1.5      }
     1.6  #ifdef ASSERT
     1.7 -  assert(st_method() == method && st.bci() == bci,
     1.8 -         "Wrong stack trace");
     1.9 -  st.next();
    1.10 -  // vframeStream::method isn't GC-safe so store off a copy
    1.11 -  // of the methodOop in case we GC.
    1.12 -  if (!st.at_end()) {
    1.13 -    st_method = st.method();
    1.14 -  }
    1.15 +    assert(st_method() == method && st.bci() == bci,
    1.16 +           "Wrong stack trace");
    1.17 +    st.next();
    1.18 +    // vframeStream::method isn't GC-safe so store off a copy
    1.19 +    // of the methodOop in case we GC.
    1.20 +    if (!st.at_end()) {
    1.21 +      st_method = st.method();
    1.22 +    }
    1.23  #endif
    1.24 +
    1.25 +    // the format of the stacktrace will be:
    1.26 +    // - 1 or more fillInStackTrace frames for the exception class (skipped)
    1.27 +    // - 0 or more <init> methods for the exception class (skipped)
    1.28 +    // - rest of the stack
    1.29 +
    1.30      if (!skip_fillInStackTrace_check) {
    1.31 -      // check "fillInStackTrace" only once, so we negate the flag
    1.32 -      // after the first time check.
    1.33 -      skip_fillInStackTrace_check = true;
    1.34 -      if (method->name() == vmSymbols::fillInStackTrace_name()) {
    1.35 +      if ((method->name() == vmSymbols::fillInStackTrace_name() ||
    1.36 +           method->name() == vmSymbols::fillInStackTrace0_name()) &&
    1.37 +          throwable->is_a(method->method_holder())) {
    1.38          continue;
    1.39        }
    1.40 +      else {
    1.41 +        skip_fillInStackTrace_check = true; // gone past them all
    1.42 +      }
    1.43      }
    1.44 -    // skip <init> methods of the exceptions klass. If there is <init> methods
    1.45 -    // that belongs to a superclass of the exception  we are going to skipping
    1.46 -    // them in stack trace. This is simlar to classic VM.
    1.47      if (!skip_throwableInit_check) {
    1.48 +      assert(skip_fillInStackTrace_check, "logic error in backtrace filtering");
    1.49 +
    1.50 +      // skip <init> methods of the exception class and superclasses
    1.51 +      // This is simlar to classic VM.
    1.52        if (method->name() == vmSymbols::object_initializer_name() &&
    1.53            throwable->is_a(method->method_holder())) {
    1.54          continue;
    1.55        } else {
    1.56 -        // if no "Throwable.init()" method found, we stop checking it next time.
    1.57 +        // there are none or we've seen them all - either way stop checking
    1.58          skip_throwableInit_check = true;
    1.59        }
    1.60      }
     2.1 --- a/src/share/vm/classfile/vmSymbols.hpp	Mon Apr 11 11:12:41 2011 +0200
     2.2 +++ b/src/share/vm/classfile/vmSymbols.hpp	Tue Apr 12 02:53:06 2011 -0400
     2.3 @@ -330,6 +330,7 @@
     2.4    template(dispatch_name,                             "dispatch")                                 \
     2.5    template(getSystemClassLoader_name,                 "getSystemClassLoader")                     \
     2.6    template(fillInStackTrace_name,                     "fillInStackTrace")                         \
     2.7 +  template(fillInStackTrace0_name,                    "fillInStackTrace0")                        \
     2.8    template(getCause_name,                             "getCause")                                 \
     2.9    template(initCause_name,                            "initCause")                                \
    2.10    template(setProperty_name,                          "setProperty")                              \

mercurial