469 }
470
471 do {
472 should_repeat = false;
473
474 // assertions
475 #ifdef ASSERT
476 assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
477 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
478 if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
479 if (ExitVMOnVerifyError) vm_exit(-1);
480 ShouldNotReachHere();
481 }
482 #endif
483
484 // tracing
485 if (log_is_enabled(Info, exceptions)) {
486 ResourceMark rm(thread);
487 stringStream tempst;
488 tempst.print("interpreter method <%s>\n"
489 " at bci %d for thread " INTPTR_FORMAT,
490 h_method->print_value_string(), current_bci, p2i(thread));
491 Exceptions::log_exception(h_exception, tempst);
492 }
493 // Don't go paging in something which won't be used.
494 // else if (extable->length() == 0) {
495 // // disabled for now - interpreter is not using shortcut yet
496 // // (shortcut is not to call runtime if we have no exception handlers)
497 // // warning("performance bug: should not call runtime if method has no exception handlers");
498 // }
499 // for AbortVMOnException flag
500 Exceptions::debug_check_abort(h_exception);
501
502 // exception handler lookup
503 Klass* klass = h_exception->klass();
504 handler_bci = Method::fast_exception_handler_bci_for(h_method, klass, current_bci, THREAD);
505 if (HAS_PENDING_EXCEPTION) {
506 // We threw an exception while trying to find the exception handler.
507 // Transfer the new exception to the exception handle which will
508 // be set into thread local storage, and do another lookup for an
509 // exception handler for this exception, this time starting at the
510 // BCI of the exception handler which caused the exception to be
564 // (this is good for exceptions caught in native methods as well)
565 if (JvmtiExport::can_post_on_exceptions()) {
566 JvmtiExport::notice_unwind_due_to_exception(thread, h_method(), handler_pc, h_exception(), (handler_pc != NULL));
567 }
568
569 thread->set_vm_result(h_exception());
570 return continuation;
571 IRT_END
572
573
574 IRT_ENTRY(void, InterpreterRuntime::throw_pending_exception(JavaThread* thread))
575 assert(thread->has_pending_exception(), "must only ne called if there's an exception pending");
576 // nothing to do - eventually we should remove this code entirely (see comments @ call sites)
577 IRT_END
578
579
580 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodError(JavaThread* thread))
581 THROW(vmSymbols::java_lang_AbstractMethodError());
582 IRT_END
583
584
585 IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeError(JavaThread* thread))
586 THROW(vmSymbols::java_lang_IncompatibleClassChangeError());
587 IRT_END
588
589
590 //------------------------------------------------------------------------------------------------------------------------
591 // Fields
592 //
593
594 void InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode) {
595 Thread* THREAD = thread;
596 // resolve field
597 fieldDescriptor info;
598 LastFrameAccessor last_frame(thread);
599 constantPoolHandle pool(thread, last_frame.method()->constants());
600 methodHandle m(thread, last_frame.method());
601 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield ||
602 bytecode == Bytecodes::_putstatic);
603 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
604
605 {
606 JvmtiHideSingleStepping jhss(thread);
607 LinkResolver::resolve_field_access(info, pool, last_frame.get_index_u2_cpcache(bytecode),
608 m, bytecode, CHECK);
|
469 }
470
471 do {
472 should_repeat = false;
473
474 // assertions
475 #ifdef ASSERT
476 assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
477 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
478 if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
479 if (ExitVMOnVerifyError) vm_exit(-1);
480 ShouldNotReachHere();
481 }
482 #endif
483
484 // tracing
485 if (log_is_enabled(Info, exceptions)) {
486 ResourceMark rm(thread);
487 stringStream tempst;
488 tempst.print("interpreter method <%s>\n"
489 " at bci %d for thread " INTPTR_FORMAT " (%s)",
490 h_method->print_value_string(), current_bci, p2i(thread), thread->name());
491 Exceptions::log_exception(h_exception, tempst);
492 }
493 // Don't go paging in something which won't be used.
494 // else if (extable->length() == 0) {
495 // // disabled for now - interpreter is not using shortcut yet
496 // // (shortcut is not to call runtime if we have no exception handlers)
497 // // warning("performance bug: should not call runtime if method has no exception handlers");
498 // }
499 // for AbortVMOnException flag
500 Exceptions::debug_check_abort(h_exception);
501
502 // exception handler lookup
503 Klass* klass = h_exception->klass();
504 handler_bci = Method::fast_exception_handler_bci_for(h_method, klass, current_bci, THREAD);
505 if (HAS_PENDING_EXCEPTION) {
506 // We threw an exception while trying to find the exception handler.
507 // Transfer the new exception to the exception handle which will
508 // be set into thread local storage, and do another lookup for an
509 // exception handler for this exception, this time starting at the
510 // BCI of the exception handler which caused the exception to be
564 // (this is good for exceptions caught in native methods as well)
565 if (JvmtiExport::can_post_on_exceptions()) {
566 JvmtiExport::notice_unwind_due_to_exception(thread, h_method(), handler_pc, h_exception(), (handler_pc != NULL));
567 }
568
569 thread->set_vm_result(h_exception());
570 return continuation;
571 IRT_END
572
573
574 IRT_ENTRY(void, InterpreterRuntime::throw_pending_exception(JavaThread* thread))
575 assert(thread->has_pending_exception(), "must only ne called if there's an exception pending");
576 // nothing to do - eventually we should remove this code entirely (see comments @ call sites)
577 IRT_END
578
579
580 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodError(JavaThread* thread))
581 THROW(vmSymbols::java_lang_AbstractMethodError());
582 IRT_END
583
584 // This method is called from the "abstract_entry" of the interpreter.
585 // At that point, the arguments have already been removed from the stack
586 // and therefore we don't have the receiver object at our fingertips. (Though,
587 // on some platforms the receiver still resides in a register...). Thus,
588 // we have no choice but print an error message not containing the receiver
589 // type.
590 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorWithMethod(JavaThread* thread, Method* missingMethod))
591 ResourceMark rm(thread);
592 char buf[1000];
593 buf[0] = '\0';
594 if (missingMethod != NULL) {
595 methodHandle m(thread, missingMethod);
596 if (!m.is_null() && m->is_abstract()) {
597 jio_snprintf(buf, sizeof(buf),
598 "Missing implementation of interface method %s",
599 m->name_and_sig_as_C_string());
600 }
601 }
602 THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), buf);
603 IRT_END
604
605 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorVerbose(JavaThread* thread, Klass* recvKlass,
606 Method* missingMethod))
607 ResourceMark rm(thread);
608 methodHandle mh = methodHandle(thread, missingMethod);
609 LinkResolver::throw_abstract_method_error(mh, recvKlass, THREAD);
610 IRT_END
611
612
613 IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeError(JavaThread* thread))
614 THROW(vmSymbols::java_lang_IncompatibleClassChangeError());
615 IRT_END
616
617 IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose(JavaThread* thread, Klass* recvKlass,
618 Klass* interfaceKlass))
619 ResourceMark rm(thread);
620 char buf[1000];
621 buf[0] = '\0';
622 jio_snprintf(buf, sizeof(buf),
623 "Class %s does not implement the requested interface %s",
624 recvKlass ? recvKlass->external_name() : "NULL",
625 interfaceKlass ? interfaceKlass->external_name() : "NULL");
626 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
627 IRT_END
628
629 //------------------------------------------------------------------------------------------------------------------------
630 // Fields
631 //
632
633 void InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode) {
634 Thread* THREAD = thread;
635 // resolve field
636 fieldDescriptor info;
637 LastFrameAccessor last_frame(thread);
638 constantPoolHandle pool(thread, last_frame.method()->constants());
639 methodHandle m(thread, last_frame.method());
640 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield ||
641 bytecode == Bytecodes::_putstatic);
642 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
643
644 {
645 JvmtiHideSingleStepping jhss(thread);
646 LinkResolver::resolve_field_access(info, pool, last_frame.get_index_u2_cpcache(bytecode),
647 m, bytecode, CHECK);
|