879 ciCallProfile profile = caller->call_profile_at_bci(bci);
880 int call_site_count = caller->scale_count(profile.count());
881
882 if (IncrementalInline && (AlwaysIncrementalInline ||
883 (call_site_count > 0 && (input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())))) {
884 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
885 } else {
886 // Out-of-line call.
887 return CallGenerator::for_direct_call(callee);
888 }
889 }
890
891 static void cast_argument(int arg_nb, ciType* t, GraphKit& kit) {
892 PhaseGVN& gvn = kit.gvn();
893 Node* arg = kit.argument(arg_nb);
894 const Type* arg_type = arg->bottom_type();
895 const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
896 if (t->is_valuetype()) {
897 assert(!(arg_type->isa_valuetype() && t == kit.C->env()->___Value_klass()), "need a pointer to the value type");
898 if (arg_type->isa_valuetypeptr() && t != kit.C->env()->___Value_klass()) {
899 const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
900 Node* cast = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
901 Node* vt = ValueTypeNode::make(gvn, kit.merged_memory(), cast);
902 kit.set_argument(arg_nb, vt);
903 }
904 } else {
905 if (arg_type->isa_oopptr() && !arg_type->higher_equal(sig_type)) {
906 Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
907 kit.set_argument(arg_nb, cast_obj);
908 }
909 }
910 }
911
912 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const, bool delayed_forbidden) {
913 GraphKit kit(jvms);
914 PhaseGVN& gvn = kit.gvn();
915 Compile* C = kit.C;
916 vmIntrinsics::ID iid = callee->intrinsic_id();
917 input_not_const = true;
918 switch (iid) {
919 case vmIntrinsics::_invokeBasic:
920 {
921 // Get MethodHandle receiver:
922 Node* receiver = kit.argument(0);
|
879 ciCallProfile profile = caller->call_profile_at_bci(bci);
880 int call_site_count = caller->scale_count(profile.count());
881
882 if (IncrementalInline && (AlwaysIncrementalInline ||
883 (call_site_count > 0 && (input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())))) {
884 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
885 } else {
886 // Out-of-line call.
887 return CallGenerator::for_direct_call(callee);
888 }
889 }
890
891 static void cast_argument(int arg_nb, ciType* t, GraphKit& kit) {
892 PhaseGVN& gvn = kit.gvn();
893 Node* arg = kit.argument(arg_nb);
894 const Type* arg_type = arg->bottom_type();
895 const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
896 if (t->is_valuetype()) {
897 assert(!(arg_type->isa_valuetype() && t == kit.C->env()->___Value_klass()), "need a pointer to the value type");
898 if (arg_type->isa_valuetypeptr() && t != kit.C->env()->___Value_klass()) {
899 Node* cast = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
900 Node* vt = ValueTypeNode::make(gvn, kit.merged_memory(), cast);
901 kit.set_argument(arg_nb, vt);
902 } else {
903 assert(t == kit.C->env()->___Value_klass() || arg->is_ValueType(), "inconsistent argument");
904 }
905 } else {
906 if (arg_type->isa_oopptr() && !arg_type->higher_equal(sig_type)) {
907 Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
908 kit.set_argument(arg_nb, cast_obj);
909 }
910 }
911 }
912
913 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const, bool delayed_forbidden) {
914 GraphKit kit(jvms);
915 PhaseGVN& gvn = kit.gvn();
916 Compile* C = kit.C;
917 vmIntrinsics::ID iid = callee->intrinsic_id();
918 input_not_const = true;
919 switch (iid) {
920 case vmIntrinsics::_invokeBasic:
921 {
922 // Get MethodHandle receiver:
923 Node* receiver = kit.argument(0);
|