1625 result.set_handle(resolved_klass, resolved_method, resolved_appendix, resolved_method_type, CHECK); |
1625 result.set_handle(resolved_klass, resolved_method, resolved_appendix, resolved_method_type, CHECK); |
1626 } |
1626 } |
1627 |
1627 |
1628 static void wrap_invokedynamic_exception(TRAPS) { |
1628 static void wrap_invokedynamic_exception(TRAPS) { |
1629 if (HAS_PENDING_EXCEPTION) { |
1629 if (HAS_PENDING_EXCEPTION) { |
|
1630 // See the "Linking Exceptions" section for the invokedynamic instruction |
|
1631 // in JVMS 6.5. |
|
1632 if (PENDING_EXCEPTION->is_a(SystemDictionary::Error_klass())) { |
|
1633 // Pass through an Error, including BootstrapMethodError, any other form |
|
1634 // of linkage error, or say ThreadDeath/OutOfMemoryError |
|
1635 if (TraceMethodHandles) { |
|
1636 tty->print_cr("invokedynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); |
|
1637 PENDING_EXCEPTION->print(); |
|
1638 } |
|
1639 return; |
|
1640 } |
|
1641 |
|
1642 // Otherwise wrap the exception in a BootstrapMethodError |
1630 if (TraceMethodHandles) { |
1643 if (TraceMethodHandles) { |
1631 tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); |
1644 tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); |
1632 PENDING_EXCEPTION->print(); |
1645 PENDING_EXCEPTION->print(); |
1633 } |
1646 } |
1634 if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) { |
|
1635 // throw these guys, since they are already wrapped |
|
1636 return; |
|
1637 } |
|
1638 if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) { |
|
1639 // intercept only LinkageErrors which might have failed to wrap |
|
1640 return; |
|
1641 } |
|
1642 // See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS. |
|
1643 Handle nested_exception(THREAD, PENDING_EXCEPTION); |
1647 Handle nested_exception(THREAD, PENDING_EXCEPTION); |
1644 CLEAR_PENDING_EXCEPTION; |
1648 CLEAR_PENDING_EXCEPTION; |
1645 THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception) |
1649 THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception) |
1646 } |
1650 } |
1647 } |
1651 } |