src/share/vm/interpreter/interpreterRuntime.cpp

changeset 2015
083fde3b838e
parent 1958
d93949c5bdcc
child 2103
3e8fbc61cee8
     1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Jul 15 08:54:48 2010 -0700
     1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Jul 15 18:40:45 2010 -0700
     1.3 @@ -702,10 +702,6 @@
     1.4  
     1.5    methodHandle caller_method(thread, method(thread));
     1.6  
     1.7 -  // first find the bootstrap method
     1.8 -  KlassHandle caller_klass(thread, caller_method->method_holder());
     1.9 -  Handle bootm = SystemDictionary::find_bootstrap_method(caller_klass, CHECK);
    1.10 -
    1.11    constantPoolHandle pool(thread, caller_method->constants());
    1.12    pool->set_invokedynamic();    // mark header to flag active call sites
    1.13  
    1.14 @@ -726,7 +722,7 @@
    1.15      CallInfo info;
    1.16      LinkResolver::resolve_invoke(info, Handle(), pool,
    1.17                                   site_index, bytecode, CHECK);
    1.18 -    // The main entry corresponds to a JVM_CONSTANT_NameAndType, and serves
    1.19 +    // The main entry corresponds to a JVM_CONSTANT_InvokeDynamic, and serves
    1.20      // as a common reference point for all invokedynamic call sites with
    1.21      // that exact call descriptor.  We will link it in the CP cache exactly
    1.22      // as if it were an invokevirtual of MethodHandle.invoke.
    1.23 @@ -734,23 +730,30 @@
    1.24        bytecode,
    1.25        info.resolved_method(),
    1.26        info.vtable_index());
    1.27 -    assert(pool->cache()->entry_at(main_index)->is_vfinal(), "f2 must be a methodOop");
    1.28    }
    1.29  
    1.30    // The method (f2 entry) of the main entry is the MH.invoke for the
    1.31    // invokedynamic target call signature.
    1.32 -  intptr_t f2_value = pool->cache()->entry_at(main_index)->f2();
    1.33 -  methodHandle signature_invoker(THREAD, (methodOop) f2_value);
    1.34 +  oop f1_value = pool->cache()->entry_at(main_index)->f1();
    1.35 +  methodHandle signature_invoker(THREAD, (methodOop) f1_value);
    1.36    assert(signature_invoker.not_null() && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
    1.37           "correct result from LinkResolver::resolve_invokedynamic");
    1.38  
    1.39 +  Handle bootm = SystemDictionary::find_bootstrap_method(caller_method, caller_bci,
    1.40 +                                                         main_index, CHECK);
    1.41 +  if (bootm.is_null()) {
    1.42 +    THROW_MSG(vmSymbols::java_lang_IllegalStateException(),
    1.43 +              "no bootstrap method found for invokedynamic");
    1.44 +  }
    1.45 +
    1.46 +  // Short circuit if CallSite has been bound already:
    1.47 +  if (!pool->cache()->secondary_entry_at(site_index)->is_f1_null())
    1.48 +    return;
    1.49 +
    1.50    symbolHandle call_site_name(THREAD, pool->name_ref_at(site_index));
    1.51  
    1.52    Handle info;  // NYI: Other metadata from a new kind of CP entry.  (Annotations?)
    1.53  
    1.54 -  // this is the index which gets stored on the CallSite object (as "callerPosition"):
    1.55 -  int call_site_position = constantPoolCacheOopDesc::decode_secondary_index(site_index);
    1.56 -
    1.57    Handle call_site
    1.58      = SystemDictionary::make_dynamic_call_site(bootm,
    1.59                                                 // Callee information:

mercurial