401 Handle h_cause(thread, NULL); |
401 Handle h_cause(thread, NULL); |
402 return Exceptions::new_exception(thread, name, message, h_cause, h_loader, |
402 return Exceptions::new_exception(thread, name, message, h_cause, h_loader, |
403 h_prot, to_utf8_safe); |
403 h_prot, to_utf8_safe); |
404 } |
404 } |
405 |
405 |
|
406 // invokedynamic uses wrap_dynamic_exception for: |
|
407 // - bootstrap method resolution |
|
408 // - post call to MethodHandleNatives::linkCallSite |
|
409 // dynamically computed constant uses wrap_dynamic_exception for: |
|
410 // - bootstrap method resolution |
|
411 // - post call to MethodHandleNatives::linkDynamicConstant |
|
412 void Exceptions::wrap_dynamic_exception(Thread* THREAD) { |
|
413 if (THREAD->has_pending_exception()) { |
|
414 oop exception = THREAD->pending_exception(); |
|
415 // See the "Linking Exceptions" section for the invokedynamic instruction |
|
416 // in JVMS 6.5. |
|
417 if (exception->is_a(SystemDictionary::Error_klass())) { |
|
418 // Pass through an Error, including BootstrapMethodError, any other form |
|
419 // of linkage error, or say ThreadDeath/OutOfMemoryError |
|
420 if (TraceMethodHandles) { |
|
421 tty->print_cr("[constant/invoke]dynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)exception)); |
|
422 exception->print(); |
|
423 } |
|
424 return; |
|
425 } |
|
426 |
|
427 // Otherwise wrap the exception in a BootstrapMethodError |
|
428 if (TraceMethodHandles) { |
|
429 tty->print_cr("[constant/invoke]dynamic throws BSME for " INTPTR_FORMAT, p2i((void *)exception)); |
|
430 exception->print(); |
|
431 } |
|
432 Handle nested_exception(THREAD, exception); |
|
433 THREAD->clear_pending_exception(); |
|
434 THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception) |
|
435 } |
|
436 } |
406 |
437 |
407 // Exception counting for hs_err file |
438 // Exception counting for hs_err file |
408 volatile int Exceptions::_stack_overflow_errors = 0; |
439 volatile int Exceptions::_stack_overflow_errors = 0; |
409 volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0; |
440 volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0; |
410 volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0; |
441 volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0; |