22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "ci/bcEscapeAnalyzer.hpp" |
26 #include "ci/bcEscapeAnalyzer.hpp" |
|
27 #include "ci/ciCallSite.hpp" |
27 #include "ci/ciCPCache.hpp" |
28 #include "ci/ciCPCache.hpp" |
28 #include "ci/ciMethodHandle.hpp" |
29 #include "ci/ciMethodHandle.hpp" |
29 #include "classfile/javaClasses.hpp" |
30 #include "classfile/javaClasses.hpp" |
30 #include "compiler/compileLog.hpp" |
31 #include "compiler/compileLog.hpp" |
31 #include "opto/addnode.hpp" |
32 #include "opto/addnode.hpp" |
736 } |
737 } |
737 return NULL; |
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 JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) { |
770 JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) { |
742 GraphKit kit(jvms); |
771 GraphKit kit(jvms); |
743 PhaseGVN& gvn = kit.gvn(); |
772 PhaseGVN& gvn = kit.gvn(); |
744 |
773 |
745 CompileLog* log = kit.C->log(); |
774 CompileLog* log = kit.C->log(); |