comparison src/share/vm/opto/callGenerator.cpp @ 12966:b2ee5dc63353

8024070: C2 needs some form of type speculation Summary: record unused type profile information with type system, propagate and use it. Reviewed-by: kvn, twisti
author roland
date Wed, 23 Oct 2013 12:40:23 +0200
parents 3213ba4d3dff
children e74074c34312
comparison
equal deleted inserted replaced
12965:8b4bbba322d3 12966:b2ee5dc63353
484 C->add_string_late_inline(this); 484 C->add_string_late_inline(this);
485 485
486 JVMState* new_jvms = DirectCallGenerator::generate(jvms, parent_parser); 486 JVMState* new_jvms = DirectCallGenerator::generate(jvms, parent_parser);
487 return new_jvms; 487 return new_jvms;
488 } 488 }
489
490 virtual bool is_string_late_inline() const { return true; }
489 }; 491 };
490 492
491 CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGenerator* inline_cg) { 493 CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGenerator* inline_cg) {
492 return new LateInlineStringCallGenerator(method, inline_cg); 494 return new LateInlineStringCallGenerator(method, inline_cg);
493 } 495 }
771 input_not_const = false; 773 input_not_const = false;
772 const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr(); 774 const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
773 ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget(); 775 ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget();
774 guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove 776 guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove
775 const int vtable_index = Method::invalid_vtable_index; 777 const int vtable_index = Method::invalid_vtable_index;
776 CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, true, true); 778 CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true);
777 assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 779 assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
778 if (cg != NULL && cg->is_inline()) 780 if (cg != NULL && cg->is_inline())
779 return cg; 781 return cg;
780 } 782 }
781 } 783 }
827 const bool is_virtual = (iid == vmIntrinsics::_linkToVirtual); 829 const bool is_virtual = (iid == vmIntrinsics::_linkToVirtual);
828 const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface); 830 const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
829 int vtable_index = Method::invalid_vtable_index; 831 int vtable_index = Method::invalid_vtable_index;
830 bool call_does_dispatch = false; 832 bool call_does_dispatch = false;
831 833
834 ciKlass* speculative_receiver_type = NULL;
832 if (is_virtual_or_interface) { 835 if (is_virtual_or_interface) {
833 ciInstanceKlass* klass = target->holder(); 836 ciInstanceKlass* klass = target->holder();
834 Node* receiver_node = kit.argument(0); 837 Node* receiver_node = kit.argument(0);
835 const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr(); 838 const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
836 // call_does_dispatch and vtable_index are out-parameters. They might be changed. 839 // call_does_dispatch and vtable_index are out-parameters. They might be changed.
837 target = C->optimize_virtual_call(caller, jvms->bci(), klass, target, receiver_type, 840 target = C->optimize_virtual_call(caller, jvms->bci(), klass, target, receiver_type,
838 is_virtual, 841 is_virtual,
839 call_does_dispatch, vtable_index); // out-parameters 842 call_does_dispatch, vtable_index); // out-parameters
843 // We lack profiling at this call but type speculation may
844 // provide us with a type
845 speculative_receiver_type = receiver_type->speculative_type();
840 } 846 }
841 847
842 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, true, true); 848 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
843 assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 849 assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
844 if (cg != NULL && cg->is_inline()) 850 if (cg != NULL && cg->is_inline())
845 return cg; 851 return cg;
846 } 852 }
847 } 853 }