hotspot/src/share/vm/interpreter/linkResolver.cpp
changeset 24322 c2978d1578e3
parent 23999 22eb7be3d99d
child 24424 2658d7834c6e
equal deleted inserted replaced
24320:394d55c783dc 24322:c2978d1578e3
   268     if (default_methods != NULL) {
   268     if (default_methods != NULL) {
   269       result_oop = InstanceKlass::find_method(default_methods, name, signature);
   269       result_oop = InstanceKlass::find_method(default_methods, name, signature);
   270     }
   270     }
   271   }
   271   }
   272 
   272 
   273   if (checkpolymorphism && EnableInvokeDynamic && result_oop != NULL) {
   273   if (checkpolymorphism && result_oop != NULL) {
   274     vmIntrinsics::ID iid = result_oop->intrinsic_id();
   274     vmIntrinsics::ID iid = result_oop->intrinsic_id();
   275     if (MethodHandles::is_signature_polymorphic(iid)) {
   275     if (MethodHandles::is_signature_polymorphic(iid)) {
   276       // Do not link directly to these.  The VM must produce a synthetic one using lookup_polymorphic_method.
   276       // Do not link directly to these.  The VM must produce a synthetic one using lookup_polymorphic_method.
   277       return;
   277       return;
   278     }
   278     }
   343     ResourceMark rm(THREAD);
   343     ResourceMark rm(THREAD);
   344     tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s",
   344     tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s",
   345                   vmIntrinsics::name_at(iid), klass->external_name(),
   345                   vmIntrinsics::name_at(iid), klass->external_name(),
   346                   name->as_C_string(), full_signature->as_C_string());
   346                   name->as_C_string(), full_signature->as_C_string());
   347   }
   347   }
   348   if (EnableInvokeDynamic &&
   348   if (klass() == SystemDictionary::MethodHandle_klass() &&
   349       klass() == SystemDictionary::MethodHandle_klass() &&
       
   350       iid != vmIntrinsics::_none) {
   349       iid != vmIntrinsics::_none) {
   351     if (MethodHandles::is_signature_polymorphic_intrinsic(iid)) {
   350     if (MethodHandles::is_signature_polymorphic_intrinsic(iid)) {
   352       // Most of these do not need an up-call to Java to resolve, so can be done anywhere.
   351       // Most of these do not need an up-call to Java to resolve, so can be done anywhere.
   353       // Do not erase last argument type (MemberName) if it is a static linkTo method.
   352       // Do not erase last argument type (MemberName) if it is a static linkTo method.
   354       bool keep_last_arg = MethodHandles::is_signature_polymorphic_static(iid);
   353       bool keep_last_arg = MethodHandles::is_signature_polymorphic_static(iid);
  1541   resolve_interface_call(result, recv, recvrKlass, resolved_klass, method_name, method_signature, current_klass, true, true, CHECK);
  1540   resolve_interface_call(result, recv, recvrKlass, resolved_klass, method_name, method_signature, current_klass, true, true, CHECK);
  1542 }
  1541 }
  1543 
  1542 
  1544 
  1543 
  1545 void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
  1544 void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
  1546   assert(EnableInvokeDynamic, "");
       
  1547   // This guy is reached from InterpreterRuntime::resolve_invokehandle.
  1545   // This guy is reached from InterpreterRuntime::resolve_invokehandle.
  1548   KlassHandle  resolved_klass;
  1546   KlassHandle  resolved_klass;
  1549   Symbol* method_name = NULL;
  1547   Symbol* method_name = NULL;
  1550   Symbol* method_signature = NULL;
  1548   Symbol* method_signature = NULL;
  1551   KlassHandle  current_klass;
  1549   KlassHandle  current_klass;
  1573   result.set_handle(resolved_method, resolved_appendix, resolved_method_type, CHECK);
  1571   result.set_handle(resolved_method, resolved_appendix, resolved_method_type, CHECK);
  1574 }
  1572 }
  1575 
  1573 
  1576 
  1574 
  1577 void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
  1575 void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
  1578   assert(EnableInvokeDynamic, "");
       
  1579 
       
  1580   //resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK);
  1576   //resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK);
  1581   Symbol* method_name       = pool->name_ref_at(index);
  1577   Symbol* method_name       = pool->name_ref_at(index);
  1582   Symbol* method_signature  = pool->signature_ref_at(index);
  1578   Symbol* method_signature  = pool->signature_ref_at(index);
  1583   KlassHandle current_klass = KlassHandle(THREAD, pool->pool_holder());
  1579   KlassHandle current_klass = KlassHandle(THREAD, pool->pool_holder());
  1584 
  1580