Mercurial > hg > truffle
comparison src/share/vm/opto/callGenerator.cpp @ 4117:a04a201f0f5a
7108383: JSR 292: JRuby bench_define_method_methods.rb: assert(slow_jvms != NULL) failed: miss path must not
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Thu, 17 Nov 2011 04:07:30 -0800 |
parents | 83d0b5cd1438 |
children | 847da049d62f |
comparison
equal
deleted
inserted
replaced
4116:973293defacd | 4117:a04a201f0f5a |
---|---|
316 CallGenerator* CallGenerator::for_direct_call(ciMethod* m, bool separate_io_proj) { | 316 CallGenerator* CallGenerator::for_direct_call(ciMethod* m, bool separate_io_proj) { |
317 assert(!m->is_abstract(), "for_direct_call mismatch"); | 317 assert(!m->is_abstract(), "for_direct_call mismatch"); |
318 return new DirectCallGenerator(m, separate_io_proj); | 318 return new DirectCallGenerator(m, separate_io_proj); |
319 } | 319 } |
320 | 320 |
321 CallGenerator* CallGenerator::for_dynamic_call(ciMethod* m) { | |
322 assert(m->is_method_handle_invoke() || m->is_method_handle_adapter(), "for_dynamic_call mismatch"); | |
323 return new DynamicCallGenerator(m); | |
324 } | |
325 | |
326 CallGenerator* CallGenerator::for_virtual_call(ciMethod* m, int vtable_index) { | 321 CallGenerator* CallGenerator::for_virtual_call(ciMethod* m, int vtable_index) { |
327 assert(!m->is_static(), "for_virtual_call mismatch"); | 322 assert(!m->is_static(), "for_virtual_call mismatch"); |
328 assert(!m->is_method_handle_invoke(), "should be a direct call"); | 323 assert(!m->is_method_handle_invoke(), "should be a direct call"); |
329 return new VirtualCallGenerator(m, vtable_index); | 324 return new VirtualCallGenerator(m, vtable_index); |
325 } | |
326 | |
327 CallGenerator* CallGenerator::for_dynamic_call(ciMethod* m) { | |
328 assert(m->is_method_handle_invoke() || m->is_method_handle_adapter(), "for_dynamic_call mismatch"); | |
329 return new DynamicCallGenerator(m); | |
330 } | 330 } |
331 | 331 |
332 // Allow inlining decisions to be delayed | 332 // Allow inlining decisions to be delayed |
333 class LateInlineCallGenerator : public DirectCallGenerator { | 333 class LateInlineCallGenerator : public DirectCallGenerator { |
334 CallGenerator* _inline_cg; | 334 CallGenerator* _inline_cg; |
574 JVMState* slow_jvms; | 574 JVMState* slow_jvms; |
575 { PreserveJVMState pjvms(&kit); | 575 { PreserveJVMState pjvms(&kit); |
576 kit.set_control(slow_ctl); | 576 kit.set_control(slow_ctl); |
577 if (!kit.stopped()) { | 577 if (!kit.stopped()) { |
578 slow_jvms = _if_missed->generate(kit.sync_jvms()); | 578 slow_jvms = _if_missed->generate(kit.sync_jvms()); |
579 assert(slow_jvms != NULL, "miss path must not fail to generate"); | 579 if (kit.failing()) |
580 return NULL; // might happen because of NodeCountInliningCutoff | |
581 assert(slow_jvms != NULL, "must be"); | |
580 kit.add_exception_states_from(slow_jvms); | 582 kit.add_exception_states_from(slow_jvms); |
581 kit.set_map(slow_jvms->map()); | 583 kit.set_map(slow_jvms->map()); |
582 if (!kit.stopped()) | 584 if (!kit.stopped()) |
583 slow_map = kit.stop(); | 585 slow_map = kit.stop(); |
584 } | 586 } |
680 float hit_prob) { | 682 float hit_prob) { |
681 return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob); | 683 return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob); |
682 } | 684 } |
683 | 685 |
684 | 686 |
687 CallGenerator* CallGenerator::for_method_handle_call(Node* method_handle, JVMState* jvms, | |
688 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { | |
689 assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_method_handle_call mismatch"); | |
690 CallGenerator* cg = CallGenerator::for_method_handle_inline(method_handle, jvms, caller, callee, profile); | |
691 if (cg != NULL) | |
692 return cg; | |
693 return CallGenerator::for_direct_call(callee); | |
694 } | |
695 | |
685 CallGenerator* CallGenerator::for_method_handle_inline(Node* method_handle, JVMState* jvms, | 696 CallGenerator* CallGenerator::for_method_handle_inline(Node* method_handle, JVMState* jvms, |
686 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { | 697 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { |
687 if (method_handle->Opcode() == Op_ConP) { | 698 if (method_handle->Opcode() == Op_ConP) { |
688 const TypeOopPtr* oop_ptr = method_handle->bottom_type()->is_oopptr(); | 699 const TypeOopPtr* oop_ptr = method_handle->bottom_type()->is_oopptr(); |
689 ciObject* const_oop = oop_ptr->const_oop(); | 700 ciObject* const_oop = oop_ptr->const_oop(); |
719 | 730 |
720 // selectAlternative idiom merging two constant MethodHandles. | 731 // selectAlternative idiom merging two constant MethodHandles. |
721 // Generate a guard so that each can be inlined. We might want to | 732 // Generate a guard so that each can be inlined. We might want to |
722 // do more inputs at later point but this gets the most common | 733 // do more inputs at later point but this gets the most common |
723 // case. | 734 // case. |
724 CallGenerator* cg1 = for_method_handle_inline(method_handle->in(1), jvms, caller, callee, profile.rescale(1.0 - prob)); | 735 CallGenerator* cg1 = for_method_handle_call(method_handle->in(1), jvms, caller, callee, profile.rescale(1.0 - prob)); |
725 CallGenerator* cg2 = for_method_handle_inline(method_handle->in(2), jvms, caller, callee, profile.rescale(prob)); | 736 CallGenerator* cg2 = for_method_handle_call(method_handle->in(2), jvms, caller, callee, profile.rescale(prob)); |
726 if (cg1 != NULL && cg2 != NULL) { | 737 if (cg1 != NULL && cg2 != NULL) { |
727 const TypeOopPtr* oop_ptr = method_handle->in(1)->bottom_type()->is_oopptr(); | 738 const TypeOopPtr* oop_ptr = method_handle->in(1)->bottom_type()->is_oopptr(); |
728 ciObject* const_oop = oop_ptr->const_oop(); | 739 ciObject* const_oop = oop_ptr->const_oop(); |
729 ciMethodHandle* mh = const_oop->as_method_handle(); | 740 ciMethodHandle* mh = const_oop->as_method_handle(); |
730 return new PredictedDynamicCallGenerator(mh, cg2, cg1, prob); | 741 return new PredictedDynamicCallGenerator(mh, cg2, cg1, prob); |
731 } | 742 } |
732 } | 743 } |
733 return NULL; | 744 return NULL; |
734 } | 745 } |
735 | 746 |
747 CallGenerator* CallGenerator::for_invokedynamic_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, ciCallProfile profile) { | |
748 assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_invokedynamic_call mismatch"); | |
749 // Get the CallSite object. | |
750 ciBytecodeStream str(caller); | |
751 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. | |
752 ciCallSite* call_site = str.get_call_site(); | |
753 CallGenerator* cg = CallGenerator::for_invokedynamic_inline(call_site, jvms, caller, callee, profile); | |
754 if (cg != NULL) | |
755 return cg; | |
756 return CallGenerator::for_dynamic_call(callee); | |
757 } | |
736 | 758 |
737 CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms, | 759 CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms, |
738 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { | 760 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { |
739 ciMethodHandle* method_handle = call_site->get_target(); | 761 ciMethodHandle* method_handle = call_site->get_target(); |
740 | 762 |
817 JVMState* slow_jvms; | 839 JVMState* slow_jvms; |
818 { PreserveJVMState pjvms(&kit); | 840 { PreserveJVMState pjvms(&kit); |
819 kit.set_control(slow_ctl); | 841 kit.set_control(slow_ctl); |
820 if (!kit.stopped()) { | 842 if (!kit.stopped()) { |
821 slow_jvms = _if_missed->generate(kit.sync_jvms()); | 843 slow_jvms = _if_missed->generate(kit.sync_jvms()); |
822 assert(slow_jvms != NULL, "miss path must not fail to generate"); | 844 if (kit.failing()) |
845 return NULL; // might happen because of NodeCountInliningCutoff | |
846 assert(slow_jvms != NULL, "must be"); | |
823 kit.add_exception_states_from(slow_jvms); | 847 kit.add_exception_states_from(slow_jvms); |
824 kit.set_map(slow_jvms->map()); | 848 kit.set_map(slow_jvms->map()); |
825 if (!kit.stopped()) | 849 if (!kit.stopped()) |
826 slow_map = kit.stop(); | 850 slow_map = kit.stop(); |
827 } | 851 } |