1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
442 #endif
443 }
444
445 do {
446 should_repeat = false;
447
448 // assertions
449 #ifdef ASSERT
450 assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
451 assert(h_exception->is_oop(), "just checking");
452 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
453 if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
454 if (ExitVMOnVerifyError) vm_exit(-1);
455 ShouldNotReachHere();
456 }
457 #endif
458
459 // tracing
460 if (log_is_enabled(Info, exceptions)) {
461 ResourceMark rm(thread);
462 Symbol* message = java_lang_Throwable::detail_message(h_exception());
463 stringStream tempst;
464 if (message != NULL) {
465 tempst.print("Exception <%s: %s> (" INTPTR_FORMAT ")\n",
466 h_exception->print_value_string(), message->as_C_string(),
467 p2i(h_exception()));
468 } else {
469 tempst.print("Exception <%s> (" INTPTR_FORMAT ")\n",
470 h_exception->print_value_string(),
471 p2i(h_exception()));
472 }
473 tempst.print(" thrown in interpreter method <%s>\n"
474 " at bci %d for thread " INTPTR_FORMAT,
475 h_method->print_value_string(), current_bci, p2i(thread));
476 LogHandle(exceptions)::info_stream()->print_raw_cr(tempst.as_string());
477 }
478 // Don't go paging in something which won't be used.
479 // else if (extable->length() == 0) {
480 // // disabled for now - interpreter is not using shortcut yet
481 // // (shortcut is not to call runtime if we have no exception handlers)
482 // // warning("performance bug: should not call runtime if method has no exception handlers");
483 // }
484 // for AbortVMOnException flag
485 Exceptions::debug_check_abort(h_exception);
486
487 // exception handler lookup
488 KlassHandle h_klass(THREAD, h_exception->klass());
489 handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
490 if (HAS_PENDING_EXCEPTION) {
491 // We threw an exception while trying to find the exception handler.
492 // Transfer the new exception to the exception handle which will
493 // be set into thread local storage, and do another lookup for an
494 // exception handler for this exception, this time starting at the
495 // BCI of the exception handler which caused the exception to be
496 // thrown (bug 4307310).
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
442 #endif
443 }
444
445 do {
446 should_repeat = false;
447
448 // assertions
449 #ifdef ASSERT
450 assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
451 assert(h_exception->is_oop(), "just checking");
452 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
453 if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
454 if (ExitVMOnVerifyError) vm_exit(-1);
455 ShouldNotReachHere();
456 }
457 #endif
458
459 // tracing
460 if (log_is_enabled(Info, exceptions)) {
461 ResourceMark rm(thread);
462 stringStream tempst;
463 tempst.print("interpreter method <%s>\n"
464 " at bci %d for thread " INTPTR_FORMAT,
465 h_method->print_value_string(), current_bci, p2i(thread));
466 Exceptions::log_exception(h_exception, tempst);
467 }
468 // Don't go paging in something which won't be used.
469 // else if (extable->length() == 0) {
470 // // disabled for now - interpreter is not using shortcut yet
471 // // (shortcut is not to call runtime if we have no exception handlers)
472 // // warning("performance bug: should not call runtime if method has no exception handlers");
473 // }
474 // for AbortVMOnException flag
475 Exceptions::debug_check_abort(h_exception);
476
477 // exception handler lookup
478 KlassHandle h_klass(THREAD, h_exception->klass());
479 handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
480 if (HAS_PENDING_EXCEPTION) {
481 // We threw an exception while trying to find the exception handler.
482 // Transfer the new exception to the exception handle which will
483 // be set into thread local storage, and do another lookup for an
484 // exception handler for this exception, this time starting at the
485 // BCI of the exception handler which caused the exception to be
486 // thrown (bug 4307310).
|