src/share/vm/opto/doCall.cpp

changeset 1572
97125851f396
parent 1570
e66fd840cb6b
child 1573
dd57230ba8fe
     1.1 --- a/src/share/vm/opto/doCall.cpp	Mon Jan 04 15:21:09 2010 -0800
     1.2 +++ b/src/share/vm/opto/doCall.cpp	Tue Jan 05 13:05:58 2010 +0100
     1.3 @@ -228,6 +228,12 @@
     1.4    // Use a more generic tactic, like a simple call.
     1.5    if (call_is_virtual) {
     1.6      return CallGenerator::for_virtual_call(call_method, vtable_index);
     1.7 +  } else if (call_method->is_method_handle_invoke()) {
     1.8 +    if (jvms->method()->java_code_at_bci(jvms->bci()) == Bytecodes::_invokedynamic)
     1.9 +      return CallGenerator::for_dynamic_call(call_method);
    1.10 +    else
    1.11 +      // %%% if the target MH is a compile-time constant, we should try to inline it
    1.12 +      return CallGenerator::for_direct_call(call_method);
    1.13    } else {
    1.14      // Class Hierarchy Analysis or Type Profile reveals a unique target,
    1.15      // or it is a static or special call.
    1.16 @@ -299,7 +305,7 @@
    1.17    // Interface classes can be loaded & linked and never get around to
    1.18    // being initialized.  Uncommon-trap for not-initialized static or
    1.19    // v-calls.  Let interface calls happen.
    1.20 -  ciInstanceKlass* holder_klass  = dest_method->holder();
    1.21 +  ciInstanceKlass* holder_klass = dest_method->holder();
    1.22    if (!holder_klass->is_initialized() &&
    1.23        !holder_klass->is_interface()) {
    1.24      uncommon_trap(Deoptimization::Reason_uninitialized,
    1.25 @@ -307,14 +313,6 @@
    1.26                    holder_klass);
    1.27      return true;
    1.28    }
    1.29 -  if (dest_method->is_method_handle_invoke()
    1.30 -      && holder_klass->name() == ciSymbol::java_dyn_InvokeDynamic()) {
    1.31 -    // FIXME: NYI
    1.32 -    uncommon_trap(Deoptimization::Reason_unhandled,
    1.33 -                  Deoptimization::Action_none,
    1.34 -                  holder_klass);
    1.35 -    return true;
    1.36 -  }
    1.37  
    1.38    assert(dest_method->will_link(method()->holder(), klass, bc()), "dest_method: typeflow responsibility");
    1.39    return false;
    1.40 @@ -333,6 +331,7 @@
    1.41    bool is_virtual = bc() == Bytecodes::_invokevirtual;
    1.42    bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface;
    1.43    bool has_receiver = is_virtual_or_interface || bc() == Bytecodes::_invokespecial;
    1.44 +  bool is_invokedynamic = bc() == Bytecodes::_invokedynamic;
    1.45  
    1.46    // Find target being called
    1.47    bool             will_link;
    1.48 @@ -341,7 +340,8 @@
    1.49    ciKlass* holder = iter().get_declared_method_holder();
    1.50    ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
    1.51  
    1.52 -  int   nargs    = dest_method->arg_size();
    1.53 +  int nargs = dest_method->arg_size();
    1.54 +  if (is_invokedynamic)  nargs -= 1;
    1.55  
    1.56    // uncommon-trap when callee is unloaded, uninitialized or will not link
    1.57    // bailout when too many arguments for register representation
    1.58 @@ -355,7 +355,7 @@
    1.59      return;
    1.60    }
    1.61    assert(holder_klass->is_loaded(), "");
    1.62 -  assert(dest_method->is_static() == !has_receiver, "must match bc");
    1.63 +  assert((dest_method->is_static() || is_invokedynamic) == !has_receiver , "must match bc");
    1.64    // Note: this takes into account invokeinterface of methods declared in java/lang/Object,
    1.65    // which should be invokevirtuals but according to the VM spec may be invokeinterfaces
    1.66    assert(holder_klass->is_interface() || holder_klass->super() == NULL || (bc() != Bytecodes::_invokeinterface), "must match bc");

mercurial