src/share/vm/interpreter/linkResolver.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7196120 Sdiff src/share/vm/interpreter

src/share/vm/interpreter/linkResolver.cpp

Print this page




1248                   method_name->as_C_string(), method_signature->as_C_string());
1249     tty->print("  BSM info: "); bootstrap_specifier->print();
1250   }
1251 
1252   resolve_dynamic_call(result, bootstrap_specifier, method_name, method_signature, current_klass, CHECK);
1253 }
1254 
1255 void LinkResolver::resolve_dynamic_call(CallInfo& result,
1256                                         Handle bootstrap_specifier,
1257                                         Symbol* method_name, Symbol* method_signature,
1258                                         KlassHandle current_klass,
1259                                         TRAPS) {
1260   // JSR 292:  this must resolve to an implicitly generated method MH.linkToCallSite(*...)
1261   // The appendix argument is likely to be a freshly-created CallSite.
1262   Handle       resolved_appendix;
1263   methodHandle resolved_method =
1264     SystemDictionary::find_dynamic_call_site_invoker(current_klass,
1265                                                      bootstrap_specifier,
1266                                                      method_name, method_signature,
1267                                                      &resolved_appendix,
1268                                                      CHECK);
1269   if (HAS_PENDING_EXCEPTION) {
1270     if (TraceMethodHandles) {
1271       tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, PENDING_EXCEPTION);
1272       PENDING_EXCEPTION->print();
1273     }
1274     if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
1275       // throw these guys, since they are already wrapped
1276       return;
1277     }
1278     if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) {
1279       // intercept only LinkageErrors which might have failed to wrap
1280       return;
1281     }
1282     // See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS.
1283     Handle nested_exception(THREAD, PENDING_EXCEPTION);
1284     CLEAR_PENDING_EXCEPTION;
1285     THROW_MSG_CAUSE(vmSymbols::java_lang_BootstrapMethodError(),
1286                     "BootstrapMethodError", nested_exception)
1287   }
1288   result.set_handle(resolved_method, resolved_appendix, CHECK);
1289 }
1290 
1291 //------------------------------------------------------------------------------------------------------------------------
1292 #ifndef PRODUCT
1293 
1294 void FieldAccessInfo::print() {
1295   ResourceMark rm;
1296   tty->print_cr("Field %s@%d", name()->as_C_string(), field_offset());
1297 }
1298 
1299 #endif


1248                   method_name->as_C_string(), method_signature->as_C_string());
1249     tty->print("  BSM info: "); bootstrap_specifier->print();
1250   }
1251 
1252   resolve_dynamic_call(result, bootstrap_specifier, method_name, method_signature, current_klass, CHECK);
1253 }
1254 
1255 void LinkResolver::resolve_dynamic_call(CallInfo& result,
1256                                         Handle bootstrap_specifier,
1257                                         Symbol* method_name, Symbol* method_signature,
1258                                         KlassHandle current_klass,
1259                                         TRAPS) {
1260   // JSR 292:  this must resolve to an implicitly generated method MH.linkToCallSite(*...)
1261   // The appendix argument is likely to be a freshly-created CallSite.
1262   Handle       resolved_appendix;
1263   methodHandle resolved_method =
1264     SystemDictionary::find_dynamic_call_site_invoker(current_klass,
1265                                                      bootstrap_specifier,
1266                                                      method_name, method_signature,
1267                                                      &resolved_appendix,
1268                                                      THREAD);
1269   if (HAS_PENDING_EXCEPTION) {
1270     if (TraceMethodHandles) {
1271       tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, PENDING_EXCEPTION);
1272       PENDING_EXCEPTION->print();
1273     }
1274     if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
1275       // throw these guys, since they are already wrapped
1276       return;
1277     }
1278     if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) {
1279       // intercept only LinkageErrors which might have failed to wrap
1280       return;
1281     }
1282     // See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS.
1283     Handle nested_exception(THREAD, PENDING_EXCEPTION);
1284     CLEAR_PENDING_EXCEPTION;
1285     THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception)

1286   }
1287   result.set_handle(resolved_method, resolved_appendix, CHECK);
1288 }
1289 
1290 //------------------------------------------------------------------------------------------------------------------------
1291 #ifndef PRODUCT
1292 
1293 void FieldAccessInfo::print() {
1294   ResourceMark rm;
1295   tty->print_cr("Field %s@%d", name()->as_C_string(), field_offset());
1296 }
1297 
1298 #endif
src/share/vm/interpreter/linkResolver.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File