8186209: Tool support for ConstantDynamic

8186046: Minimal ConstantDynamic support
8190972: Ensure that AOT/Graal filters out class files containing CONSTANT_Dynamic ahead of full AOT support

Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: John Rose <john.r.rose@oracle.com>
Reviewed-by: acorn, coleenp, kvn
This commit is contained in:
Paul Sandoz 2017-09-08 10:46:46 -07:00
parent 52d3bf29b2
commit e55a05957d
114 changed files with 11762 additions and 404 deletions

View file

@ -403,6 +403,37 @@ Handle Exceptions::new_exception(Thread* thread, Symbol* name,
h_prot, to_utf8_safe);
}
// invokedynamic uses wrap_dynamic_exception for:
// - bootstrap method resolution
// - post call to MethodHandleNatives::linkCallSite
// dynamically computed constant uses wrap_dynamic_exception for:
// - bootstrap method resolution
// - post call to MethodHandleNatives::linkDynamicConstant
void Exceptions::wrap_dynamic_exception(Thread* THREAD) {
if (THREAD->has_pending_exception()) {
oop exception = THREAD->pending_exception();
// See the "Linking Exceptions" section for the invokedynamic instruction
// in JVMS 6.5.
if (exception->is_a(SystemDictionary::Error_klass())) {
// Pass through an Error, including BootstrapMethodError, any other form
// of linkage error, or say ThreadDeath/OutOfMemoryError
if (TraceMethodHandles) {
tty->print_cr("[constant/invoke]dynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)exception));
exception->print();
}
return;
}
// Otherwise wrap the exception in a BootstrapMethodError
if (TraceMethodHandles) {
tty->print_cr("[constant/invoke]dynamic throws BSME for " INTPTR_FORMAT, p2i((void *)exception));
exception->print();
}
Handle nested_exception(THREAD, exception);
THREAD->clear_pending_exception();
THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception)
}
}
// Exception counting for hs_err file
volatile int Exceptions::_stack_overflow_errors = 0;