Mercurial > hg > truffle
diff src/share/vm/opto/callGenerator.cpp @ 3852:fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
Reviewed-by: kvn, never, bdelsart
author | twisti |
---|---|
date | Tue, 16 Aug 2011 04:14:05 -0700 |
parents | f918d6096e23 |
children | b27c72d69fd1 |
line wrap: on
line diff
--- a/src/share/vm/opto/callGenerator.cpp Thu Aug 11 12:08:11 2011 -0700 +++ b/src/share/vm/opto/callGenerator.cpp Tue Aug 16 04:14:05 2011 -0700 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "ci/bcEscapeAnalyzer.hpp" +#include "ci/ciCallSite.hpp" #include "ci/ciCPCache.hpp" #include "ci/ciMethodHandle.hpp" #include "classfile/javaClasses.hpp" @@ -738,6 +739,34 @@ } +CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms, + ciMethod* caller, ciMethod* callee, ciCallProfile profile) { + assert(call_site->is_constant_call_site() || call_site->is_mutable_call_site(), "must be"); + ciMethodHandle* method_handle = call_site->get_target(); + + // Set the callee to have access to the class and signature in the + // MethodHandleCompiler. + method_handle->set_callee(callee); + method_handle->set_caller(caller); + method_handle->set_call_profile(profile); + + // Get an adapter for the MethodHandle. + ciMethod* target_method = method_handle->get_invokedynamic_adapter(); + if (target_method != NULL) { + Compile *C = Compile::current(); + CallGenerator* hit_cg = C->call_generator(target_method, -1, false, jvms, true, PROB_ALWAYS); + if (hit_cg != NULL && hit_cg->is_inline()) { + // Add a dependence for invalidation of the optimization. + if (call_site->is_mutable_call_site()) { + C->dependencies()->assert_call_site_target_value(C->env()->CallSite_klass(), call_site, method_handle); + } + return hit_cg; + } + } + return NULL; +} + + JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) { GraphKit kit(jvms); PhaseGVN& gvn = kit.gvn();