src/share/vm/opto/callGenerator.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/callGenerator.cpp

Print this page




 808     // Out-of-line call.
 809     return CallGenerator::for_direct_call(callee);
 810   }
 811 }
 812 
 813 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
 814   GraphKit kit(jvms);
 815   PhaseGVN& gvn = kit.gvn();
 816   Compile* C = kit.C;
 817   vmIntrinsics::ID iid = callee->intrinsic_id();
 818   input_not_const = true;
 819   switch (iid) {
 820   case vmIntrinsics::_invokeBasic:
 821     {
 822       // Get MethodHandle receiver:
 823       Node* receiver = kit.argument(0);
 824       if (receiver->Opcode() == Op_ConP) {
 825         input_not_const = false;
 826         const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
 827         ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget();
 828         guarantee(!target->is_method_handle_intrinsic(), "should not happen");  // XXX remove
 829         const int vtable_index = Method::invalid_vtable_index;
 830         CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true);
 831         assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");



 832         return cg;
 833       } else {
 834         const char* msg = "receiver not constant";
 835         if (PrintInlining)  C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg);
 836         C->log_inline_failure(msg);
 837       }
 838     }
 839     break;
 840 
 841   case vmIntrinsics::_linkToVirtual:
 842   case vmIntrinsics::_linkToStatic:
 843   case vmIntrinsics::_linkToSpecial:
 844   case vmIntrinsics::_linkToInterface:
 845     {
 846       // Get MemberName argument:
 847       Node* member_name = kit.argument(callee->arg_size() - 1);
 848       if (member_name->Opcode() == Op_ConP) {
 849         input_not_const = false;
 850         const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
 851         ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();


 881         }
 882 
 883         // Try to get the most accurate receiver type
 884         const bool is_virtual              = (iid == vmIntrinsics::_linkToVirtual);
 885         const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
 886         int  vtable_index       = Method::invalid_vtable_index;
 887         bool call_does_dispatch = false;
 888 
 889         ciKlass* speculative_receiver_type = NULL;
 890         if (is_virtual_or_interface) {
 891           ciInstanceKlass* klass = target->holder();
 892           Node*             receiver_node = kit.argument(0);
 893           const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
 894           // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
 895           // optimize_virtual_call() takes 2 different holder
 896           // arguments for a corner case that doesn't apply here (see
 897           // Parse::do_call())
 898           target = C->optimize_virtual_call(caller, jvms->bci(), klass, klass,
 899                                             target, receiver_type, is_virtual,
 900                                             call_does_dispatch, vtable_index, // out-parameters
 901                                             /*check_access=*/false);
 902           // We lack profiling at this call but type speculation may
 903           // provide us with a type
 904           speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
 905         }
 906         CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, /*allow_inline=*/true, PROB_ALWAYS, speculative_receiver_type, true, true);
 907         assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");


 908         return cg;
 909       } else {
 910         const char* msg = "member_name not constant";
 911         if (PrintInlining)  C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg);
 912         C->log_inline_failure(msg);
 913       }
 914     }
 915     break;
 916 
 917   default:
 918     fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
 919     break;
 920   }
 921   return NULL;
 922 }
 923 
 924 
 925 //------------------------PredicatedIntrinsicGenerator------------------------------
 926 // Internal class which handles all predicated Intrinsic calls.
 927 class PredicatedIntrinsicGenerator : public CallGenerator {




 808     // Out-of-line call.
 809     return CallGenerator::for_direct_call(callee);
 810   }
 811 }
 812 
 813 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
 814   GraphKit kit(jvms);
 815   PhaseGVN& gvn = kit.gvn();
 816   Compile* C = kit.C;
 817   vmIntrinsics::ID iid = callee->intrinsic_id();
 818   input_not_const = true;
 819   switch (iid) {
 820   case vmIntrinsics::_invokeBasic:
 821     {
 822       // Get MethodHandle receiver:
 823       Node* receiver = kit.argument(0);
 824       if (receiver->Opcode() == Op_ConP) {
 825         input_not_const = false;
 826         const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
 827         ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget();

 828         const int vtable_index = Method::invalid_vtable_index;
 829         CallGenerator* cg = C->call_generator(target, vtable_index,
 830                                               false /* call_does_dispatch */,
 831                                               jvms,
 832                                               true /* allow_inline */,
 833                                               PROB_ALWAYS);
 834         return cg;
 835       } else {
 836         const char* msg = "receiver not constant";
 837         if (PrintInlining)  C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg);
 838         C->log_inline_failure(msg);
 839       }
 840     }
 841     break;
 842 
 843   case vmIntrinsics::_linkToVirtual:
 844   case vmIntrinsics::_linkToStatic:
 845   case vmIntrinsics::_linkToSpecial:
 846   case vmIntrinsics::_linkToInterface:
 847     {
 848       // Get MemberName argument:
 849       Node* member_name = kit.argument(callee->arg_size() - 1);
 850       if (member_name->Opcode() == Op_ConP) {
 851         input_not_const = false;
 852         const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
 853         ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();


 883         }
 884 
 885         // Try to get the most accurate receiver type
 886         const bool is_virtual              = (iid == vmIntrinsics::_linkToVirtual);
 887         const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
 888         int  vtable_index       = Method::invalid_vtable_index;
 889         bool call_does_dispatch = false;
 890 
 891         ciKlass* speculative_receiver_type = NULL;
 892         if (is_virtual_or_interface) {
 893           ciInstanceKlass* klass = target->holder();
 894           Node*             receiver_node = kit.argument(0);
 895           const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
 896           // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
 897           // optimize_virtual_call() takes 2 different holder
 898           // arguments for a corner case that doesn't apply here (see
 899           // Parse::do_call())
 900           target = C->optimize_virtual_call(caller, jvms->bci(), klass, klass,
 901                                             target, receiver_type, is_virtual,
 902                                             call_does_dispatch, vtable_index, // out-parameters
 903                                             false /* check_access */);
 904           // We lack profiling at this call but type speculation may
 905           // provide us with a type
 906           speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
 907         }
 908         CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms,
 909                                               true /* allow_inline */,
 910                                               PROB_ALWAYS,
 911                                               speculative_receiver_type);
 912         return cg;
 913       } else {
 914         const char* msg = "member_name not constant";
 915         if (PrintInlining)  C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg);
 916         C->log_inline_failure(msg);
 917       }
 918     }
 919     break;
 920 
 921   default:
 922     fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
 923     break;
 924   }
 925   return NULL;
 926 }
 927 
 928 
 929 //------------------------PredicatedIntrinsicGenerator------------------------------
 930 // Internal class which handles all predicated Intrinsic calls.
 931 class PredicatedIntrinsicGenerator : public CallGenerator {


src/share/vm/opto/callGenerator.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File