Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/opto/callGenerator.cpp
          +++ new/src/share/vm/opto/callGenerator.cpp
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18   18   *
  19   19   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20   20   * or visit www.oracle.com if you need additional information or have any
  21   21   * questions.
  22   22   *
  23   23   */
  24   24  
  25   25  #include "precompiled.hpp"
  26   26  #include "ci/bcEscapeAnalyzer.hpp"
       27 +#include "ci/ciCallSite.hpp"
  27   28  #include "ci/ciCPCache.hpp"
  28   29  #include "ci/ciMethodHandle.hpp"
  29   30  #include "classfile/javaClasses.hpp"
  30   31  #include "compiler/compileLog.hpp"
  31   32  #include "opto/addnode.hpp"
  32   33  #include "opto/callGenerator.hpp"
  33   34  #include "opto/callnode.hpp"
  34   35  #include "opto/cfgnode.hpp"
  35   36  #include "opto/connode.hpp"
  36   37  #include "opto/parse.hpp"
↓ open down ↓ 694 lines elided ↑ open up ↑
 731  732      CallGenerator* cg1 = for_method_handle_inline(method_handle->in(1), jvms, caller, callee, profile);
 732  733      CallGenerator* cg2 = for_method_handle_inline(method_handle->in(2), jvms, caller, callee, profile);
 733  734      if (cg1 != NULL && cg2 != NULL) {
 734  735        return new PredictedDynamicCallGenerator(mh, cg2, cg1, PROB_FAIR);
 735  736      }
 736  737    }
 737  738    return NULL;
 738  739  }
 739  740  
 740  741  
      742 +CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms,
      743 +                                                       ciMethod* caller, ciMethod* callee, ciCallProfile profile) {
      744 +  assert(call_site->is_constant_call_site() || call_site->is_mutable_call_site(), "must be");
      745 +  ciMethodHandle* method_handle = call_site->get_target();
      746 +
      747 +  // Set the callee to have access to the class and signature in the
      748 +  // MethodHandleCompiler.
      749 +  method_handle->set_callee(callee);
      750 +  method_handle->set_caller(caller);
      751 +  method_handle->set_call_profile(profile);
      752 +
      753 +  // Get an adapter for the MethodHandle.
      754 +  ciMethod* target_method = method_handle->get_invokedynamic_adapter();
      755 +  if (target_method != NULL) {
      756 +    Compile *C = Compile::current();
      757 +    CallGenerator* hit_cg = C->call_generator(target_method, -1, false, jvms, true, PROB_ALWAYS);
      758 +    if (hit_cg != NULL && hit_cg->is_inline()) {
      759 +      // Add a dependence for invalidation of the optimization.
      760 +      if (call_site->is_mutable_call_site()) {
      761 +        C->dependencies()->assert_call_site_target_value(C->env()->CallSite_klass(), call_site, method_handle);
      762 +      }
      763 +      return hit_cg;
      764 +    }
      765 +  }
      766 +  return NULL;
      767 +}
      768 +
      769 +
 741  770  JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) {
 742  771    GraphKit kit(jvms);
 743  772    PhaseGVN& gvn = kit.gvn();
 744  773  
 745  774    CompileLog* log = kit.C->log();
 746  775    if (log != NULL) {
 747  776      log->elem("predicted_dynamic_call bci='%d'", jvms->bci());
 748  777    }
 749  778  
 750  779    const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true);
↓ open down ↓ 325 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX