comparison src/share/vm/classfile/javaClasses.cpp @ 2476:6a615eae2f34

7034585: Adjust fillInStackTrace filtering to assist 6998871 Summary: Allow for one or more fillInStackTrace frames to be skipped Reviewed-by: mchung, kvn
author dholmes
date Tue, 12 Apr 2011 02:53:06 -0400
parents b099aaf51bf8
children 3449f5e02cc4
comparison
equal deleted inserted replaced
2475:c49c3947b98a 2476:6a615eae2f34
1442 continue; 1442 continue;
1443 } 1443 }
1444 } 1444 }
1445 } 1445 }
1446 #ifdef ASSERT 1446 #ifdef ASSERT
1447 assert(st_method() == method && st.bci() == bci, 1447 assert(st_method() == method && st.bci() == bci,
1448 "Wrong stack trace"); 1448 "Wrong stack trace");
1449 st.next(); 1449 st.next();
1450 // vframeStream::method isn't GC-safe so store off a copy 1450 // vframeStream::method isn't GC-safe so store off a copy
1451 // of the methodOop in case we GC. 1451 // of the methodOop in case we GC.
1452 if (!st.at_end()) { 1452 if (!st.at_end()) {
1453 st_method = st.method(); 1453 st_method = st.method();
1454 } 1454 }
1455 #endif 1455 #endif
1456
1457 // the format of the stacktrace will be:
1458 // - 1 or more fillInStackTrace frames for the exception class (skipped)
1459 // - 0 or more <init> methods for the exception class (skipped)
1460 // - rest of the stack
1461
1456 if (!skip_fillInStackTrace_check) { 1462 if (!skip_fillInStackTrace_check) {
1457 // check "fillInStackTrace" only once, so we negate the flag 1463 if ((method->name() == vmSymbols::fillInStackTrace_name() ||
1458 // after the first time check. 1464 method->name() == vmSymbols::fillInStackTrace0_name()) &&
1459 skip_fillInStackTrace_check = true; 1465 throwable->is_a(method->method_holder())) {
1460 if (method->name() == vmSymbols::fillInStackTrace_name()) {
1461 continue; 1466 continue;
1462 } 1467 }
1468 else {
1469 skip_fillInStackTrace_check = true; // gone past them all
1470 }
1463 } 1471 }
1464 // skip <init> methods of the exceptions klass. If there is <init> methods
1465 // that belongs to a superclass of the exception we are going to skipping
1466 // them in stack trace. This is simlar to classic VM.
1467 if (!skip_throwableInit_check) { 1472 if (!skip_throwableInit_check) {
1473 assert(skip_fillInStackTrace_check, "logic error in backtrace filtering");
1474
1475 // skip <init> methods of the exception class and superclasses
1476 // This is simlar to classic VM.
1468 if (method->name() == vmSymbols::object_initializer_name() && 1477 if (method->name() == vmSymbols::object_initializer_name() &&
1469 throwable->is_a(method->method_holder())) { 1478 throwable->is_a(method->method_holder())) {
1470 continue; 1479 continue;
1471 } else { 1480 } else {
1472 // if no "Throwable.init()" method found, we stop checking it next time. 1481 // there are none or we've seen them all - either way stop checking
1473 skip_throwableInit_check = true; 1482 skip_throwableInit_check = true;
1474 } 1483 }
1475 } 1484 }
1476 bt.push(method, bci, CHECK); 1485 bt.push(method, bci, CHECK);
1477 total_count++; 1486 total_count++;