Mercurial > hg > truffle
comparison src/share/vm/opto/callGenerator.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | e74074c34312 |
children | de6a9e811145 b0133e4187d3 |
comparison
equal
deleted
inserted
replaced
12782:92b7ec34ddfa | 13086:096c224171c4 |
---|---|
61 _expected_uses = expected_uses; | 61 _expected_uses = expected_uses; |
62 assert(InlineTree::check_can_parse(method) == NULL, "parse must be possible"); | 62 assert(InlineTree::check_can_parse(method) == NULL, "parse must be possible"); |
63 } | 63 } |
64 | 64 |
65 virtual bool is_parse() const { return true; } | 65 virtual bool is_parse() const { return true; } |
66 virtual JVMState* generate(JVMState* jvms); | 66 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
67 int is_osr() { return _is_osr; } | 67 int is_osr() { return _is_osr; } |
68 | 68 |
69 }; | 69 }; |
70 | 70 |
71 JVMState* ParseGenerator::generate(JVMState* jvms) { | 71 JVMState* ParseGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
72 Compile* C = Compile::current(); | 72 Compile* C = Compile::current(); |
73 | 73 |
74 if (is_osr()) { | 74 if (is_osr()) { |
75 // The JVMS for a OSR has a single argument (see its TypeFunc). | 75 // The JVMS for a OSR has a single argument (see its TypeFunc). |
76 assert(jvms->depth() == 1, "no inline OSR"); | 76 assert(jvms->depth() == 1, "no inline OSR"); |
78 | 78 |
79 if (C->failing()) { | 79 if (C->failing()) { |
80 return NULL; // bailing out of the compile; do not try to parse | 80 return NULL; // bailing out of the compile; do not try to parse |
81 } | 81 } |
82 | 82 |
83 Parse parser(jvms, method(), _expected_uses); | 83 Parse parser(jvms, method(), _expected_uses, parent_parser); |
84 // Grab signature for matching/allocation | 84 // Grab signature for matching/allocation |
85 #ifdef ASSERT | 85 #ifdef ASSERT |
86 if (parser.tf() != (parser.depth() == 1 ? C->tf() : tf())) { | 86 if (parser.tf() != (parser.depth() == 1 ? C->tf() : tf())) { |
87 MutexLockerEx ml(Compile_lock, Mutex::_no_safepoint_check_flag); | 87 MutexLockerEx ml(Compile_lock, Mutex::_no_safepoint_check_flag); |
88 assert(C->env()->system_dictionary_modification_counter_changed(), | 88 assert(C->env()->system_dictionary_modification_counter_changed(), |
117 DirectCallGenerator(ciMethod* method, bool separate_io_proj) | 117 DirectCallGenerator(ciMethod* method, bool separate_io_proj) |
118 : CallGenerator(method), | 118 : CallGenerator(method), |
119 _separate_io_proj(separate_io_proj) | 119 _separate_io_proj(separate_io_proj) |
120 { | 120 { |
121 } | 121 } |
122 virtual JVMState* generate(JVMState* jvms); | 122 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
123 | 123 |
124 CallStaticJavaNode* call_node() const { return _call_node; } | 124 CallStaticJavaNode* call_node() const { return _call_node; } |
125 }; | 125 }; |
126 | 126 |
127 JVMState* DirectCallGenerator::generate(JVMState* jvms) { | 127 JVMState* DirectCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
128 GraphKit kit(jvms); | 128 GraphKit kit(jvms); |
129 bool is_static = method()->is_static(); | 129 bool is_static = method()->is_static(); |
130 address target = is_static ? SharedRuntime::get_resolve_static_call_stub() | 130 address target = is_static ? SharedRuntime::get_resolve_static_call_stub() |
131 : SharedRuntime::get_resolve_opt_virtual_call_stub(); | 131 : SharedRuntime::get_resolve_opt_virtual_call_stub(); |
132 | 132 |
169 { | 169 { |
170 assert(vtable_index == Method::invalid_vtable_index || | 170 assert(vtable_index == Method::invalid_vtable_index || |
171 vtable_index >= 0, "either invalid or usable"); | 171 vtable_index >= 0, "either invalid or usable"); |
172 } | 172 } |
173 virtual bool is_virtual() const { return true; } | 173 virtual bool is_virtual() const { return true; } |
174 virtual JVMState* generate(JVMState* jvms); | 174 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
175 }; | 175 }; |
176 | 176 |
177 JVMState* VirtualCallGenerator::generate(JVMState* jvms) { | 177 JVMState* VirtualCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
178 GraphKit kit(jvms); | 178 GraphKit kit(jvms); |
179 Node* receiver = kit.argument(0); | 179 Node* receiver = kit.argument(0); |
180 | 180 |
181 if (kit.C->log() != NULL) { | 181 if (kit.C->log() != NULL) { |
182 kit.C->log()->elem("virtual_call bci='%d'", jvms->bci()); | 182 kit.C->log()->elem("virtual_call bci='%d'", jvms->bci()); |
274 virtual bool is_late_inline() const { return true; } | 274 virtual bool is_late_inline() const { return true; } |
275 | 275 |
276 // Convert the CallStaticJava into an inline | 276 // Convert the CallStaticJava into an inline |
277 virtual void do_late_inline(); | 277 virtual void do_late_inline(); |
278 | 278 |
279 virtual JVMState* generate(JVMState* jvms) { | 279 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { |
280 Compile *C = Compile::current(); | 280 Compile *C = Compile::current(); |
281 C->print_inlining_skip(this); | 281 C->print_inlining_skip(this); |
282 | 282 |
283 // Record that this call site should be revisited once the main | 283 // Record that this call site should be revisited once the main |
284 // parse is finished. | 284 // parse is finished. |
288 | 288 |
289 // Emit the CallStaticJava and request separate projections so | 289 // Emit the CallStaticJava and request separate projections so |
290 // that the late inlining logic can distinguish between fall | 290 // that the late inlining logic can distinguish between fall |
291 // through and exceptional uses of the memory and io projections | 291 // through and exceptional uses of the memory and io projections |
292 // as is done for allocations and macro expansion. | 292 // as is done for allocations and macro expansion. |
293 return DirectCallGenerator::generate(jvms); | 293 return DirectCallGenerator::generate(jvms, parent_parser); |
294 } | 294 } |
295 | 295 |
296 virtual void print_inlining_late(const char* msg) { | 296 virtual void print_inlining_late(const char* msg) { |
297 CallNode* call = call_node(); | 297 CallNode* call = call_node(); |
298 Compile* C = Compile::current(); | 298 Compile* C = Compile::current(); |
387 entry_nn->set_jvms(jvms); | 387 entry_nn->set_jvms(jvms); |
388 C->set_default_node_notes(entry_nn); | 388 C->set_default_node_notes(entry_nn); |
389 } | 389 } |
390 | 390 |
391 // Now perform the inling using the synthesized JVMState | 391 // Now perform the inling using the synthesized JVMState |
392 JVMState* new_jvms = _inline_cg->generate(jvms); | 392 JVMState* new_jvms = _inline_cg->generate(jvms, NULL); |
393 if (new_jvms == NULL) return; // no change | 393 if (new_jvms == NULL) return; // no change |
394 if (C->failing()) return; | 394 if (C->failing()) return; |
395 | 395 |
396 // Capture any exceptional control flow | 396 // Capture any exceptional control flow |
397 GraphKit kit(new_jvms); | 397 GraphKit kit(new_jvms); |
427 LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) : | 427 LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) : |
428 LateInlineCallGenerator(callee, NULL), _caller(caller), _attempt(0), _input_not_const(input_not_const) {} | 428 LateInlineCallGenerator(callee, NULL), _caller(caller), _attempt(0), _input_not_const(input_not_const) {} |
429 | 429 |
430 virtual bool is_mh_late_inline() const { return true; } | 430 virtual bool is_mh_late_inline() const { return true; } |
431 | 431 |
432 virtual JVMState* generate(JVMState* jvms) { | 432 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { |
433 JVMState* new_jvms = LateInlineCallGenerator::generate(jvms); | 433 JVMState* new_jvms = LateInlineCallGenerator::generate(jvms, parent_parser); |
434 if (_input_not_const) { | 434 if (_input_not_const) { |
435 // inlining won't be possible so no need to enqueue right now. | 435 // inlining won't be possible so no need to enqueue right now. |
436 call_node()->set_generator(this); | 436 call_node()->set_generator(this); |
437 } else { | 437 } else { |
438 Compile::current()->add_late_inline(this); | 438 Compile::current()->add_late_inline(this); |
475 | 475 |
476 public: | 476 public: |
477 LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) : | 477 LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) : |
478 LateInlineCallGenerator(method, inline_cg) {} | 478 LateInlineCallGenerator(method, inline_cg) {} |
479 | 479 |
480 virtual JVMState* generate(JVMState* jvms) { | 480 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { |
481 Compile *C = Compile::current(); | 481 Compile *C = Compile::current(); |
482 C->print_inlining_skip(this); | 482 C->print_inlining_skip(this); |
483 | 483 |
484 C->add_string_late_inline(this); | 484 C->add_string_late_inline(this); |
485 | 485 |
486 JVMState* new_jvms = DirectCallGenerator::generate(jvms); | 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 } |
496 | 498 |
497 public: | 499 public: |
498 LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) : | 500 LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) : |
499 LateInlineCallGenerator(method, inline_cg) {} | 501 LateInlineCallGenerator(method, inline_cg) {} |
500 | 502 |
501 virtual JVMState* generate(JVMState* jvms) { | 503 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { |
502 Compile *C = Compile::current(); | 504 Compile *C = Compile::current(); |
503 C->print_inlining_skip(this); | 505 C->print_inlining_skip(this); |
504 | 506 |
505 C->add_boxing_late_inline(this); | 507 C->add_boxing_late_inline(this); |
506 | 508 |
507 JVMState* new_jvms = DirectCallGenerator::generate(jvms); | 509 JVMState* new_jvms = DirectCallGenerator::generate(jvms, parent_parser); |
508 return new_jvms; | 510 return new_jvms; |
509 } | 511 } |
510 }; | 512 }; |
511 | 513 |
512 CallGenerator* CallGenerator::for_boxing_late_inline(ciMethod* method, CallGenerator* inline_cg) { | 514 CallGenerator* CallGenerator::for_boxing_late_inline(ciMethod* method, CallGenerator* inline_cg) { |
538 | 540 |
539 virtual bool is_inline() const { return _is_inline; } | 541 virtual bool is_inline() const { return _is_inline; } |
540 virtual bool is_virtual() const { return _is_virtual; } | 542 virtual bool is_virtual() const { return _is_virtual; } |
541 virtual bool is_deferred() const { return true; } | 543 virtual bool is_deferred() const { return true; } |
542 | 544 |
543 virtual JVMState* generate(JVMState* jvms); | 545 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
544 }; | 546 }; |
545 | 547 |
546 | 548 |
547 CallGenerator* CallGenerator::for_warm_call(WarmCallInfo* ci, | 549 CallGenerator* CallGenerator::for_warm_call(WarmCallInfo* ci, |
548 CallGenerator* if_cold, | 550 CallGenerator* if_cold, |
549 CallGenerator* if_hot) { | 551 CallGenerator* if_hot) { |
550 return new WarmCallGenerator(ci, if_cold, if_hot); | 552 return new WarmCallGenerator(ci, if_cold, if_hot); |
551 } | 553 } |
552 | 554 |
553 JVMState* WarmCallGenerator::generate(JVMState* jvms) { | 555 JVMState* WarmCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
554 Compile* C = Compile::current(); | 556 Compile* C = Compile::current(); |
555 if (C->log() != NULL) { | 557 if (C->log() != NULL) { |
556 C->log()->elem("warm_call bci='%d'", jvms->bci()); | 558 C->log()->elem("warm_call bci='%d'", jvms->bci()); |
557 } | 559 } |
558 jvms = _if_cold->generate(jvms); | 560 jvms = _if_cold->generate(jvms, parent_parser); |
559 if (jvms != NULL) { | 561 if (jvms != NULL) { |
560 Node* m = jvms->map()->control(); | 562 Node* m = jvms->map()->control(); |
561 if (m->is_CatchProj()) m = m->in(0); else m = C->top(); | 563 if (m->is_CatchProj()) m = m->in(0); else m = C->top(); |
562 if (m->is_Catch()) m = m->in(0); else m = C->top(); | 564 if (m->is_Catch()) m = m->in(0); else m = C->top(); |
563 if (m->is_Proj()) m = m->in(0); else m = C->top(); | 565 if (m->is_Proj()) m = m->in(0); else m = C->top(); |
614 | 616 |
615 virtual bool is_virtual() const { return true; } | 617 virtual bool is_virtual() const { return true; } |
616 virtual bool is_inline() const { return _if_hit->is_inline(); } | 618 virtual bool is_inline() const { return _if_hit->is_inline(); } |
617 virtual bool is_deferred() const { return _if_hit->is_deferred(); } | 619 virtual bool is_deferred() const { return _if_hit->is_deferred(); } |
618 | 620 |
619 virtual JVMState* generate(JVMState* jvms); | 621 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
620 }; | 622 }; |
621 | 623 |
622 | 624 |
623 CallGenerator* CallGenerator::for_predicted_call(ciKlass* predicted_receiver, | 625 CallGenerator* CallGenerator::for_predicted_call(ciKlass* predicted_receiver, |
624 CallGenerator* if_missed, | 626 CallGenerator* if_missed, |
626 float hit_prob) { | 628 float hit_prob) { |
627 return new PredictedCallGenerator(predicted_receiver, if_missed, if_hit, hit_prob); | 629 return new PredictedCallGenerator(predicted_receiver, if_missed, if_hit, hit_prob); |
628 } | 630 } |
629 | 631 |
630 | 632 |
631 JVMState* PredictedCallGenerator::generate(JVMState* jvms) { | 633 JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
632 GraphKit kit(jvms); | 634 GraphKit kit(jvms); |
633 PhaseGVN& gvn = kit.gvn(); | 635 PhaseGVN& gvn = kit.gvn(); |
634 // We need an explicit receiver null_check before checking its type. | 636 // We need an explicit receiver null_check before checking its type. |
635 // We share a map with the caller, so his JVMS gets adjusted. | 637 // We share a map with the caller, so his JVMS gets adjusted. |
636 Node* receiver = kit.argument(0); | 638 Node* receiver = kit.argument(0); |
654 SafePointNode* slow_map = NULL; | 656 SafePointNode* slow_map = NULL; |
655 JVMState* slow_jvms; | 657 JVMState* slow_jvms; |
656 { PreserveJVMState pjvms(&kit); | 658 { PreserveJVMState pjvms(&kit); |
657 kit.set_control(slow_ctl); | 659 kit.set_control(slow_ctl); |
658 if (!kit.stopped()) { | 660 if (!kit.stopped()) { |
659 slow_jvms = _if_missed->generate(kit.sync_jvms()); | 661 slow_jvms = _if_missed->generate(kit.sync_jvms(), parent_parser); |
660 if (kit.failing()) | 662 if (kit.failing()) |
661 return NULL; // might happen because of NodeCountInliningCutoff | 663 return NULL; // might happen because of NodeCountInliningCutoff |
662 assert(slow_jvms != NULL, "must be"); | 664 assert(slow_jvms != NULL, "must be"); |
663 kit.add_exception_states_from(slow_jvms); | 665 kit.add_exception_states_from(slow_jvms); |
664 kit.set_map(slow_jvms->map()); | 666 kit.set_map(slow_jvms->map()); |
675 | 677 |
676 // fall through if the instance exactly matches the desired type | 678 // fall through if the instance exactly matches the desired type |
677 kit.replace_in_map(receiver, exact_receiver); | 679 kit.replace_in_map(receiver, exact_receiver); |
678 | 680 |
679 // Make the hot call: | 681 // Make the hot call: |
680 JVMState* new_jvms = _if_hit->generate(kit.sync_jvms()); | 682 JVMState* new_jvms = _if_hit->generate(kit.sync_jvms(), parent_parser); |
681 if (new_jvms == NULL) { | 683 if (new_jvms == NULL) { |
682 // Inline failed, so make a direct call. | 684 // Inline failed, so make a direct call. |
683 assert(_if_hit->is_inline(), "must have been a failed inline"); | 685 assert(_if_hit->is_inline(), "must have been a failed inline"); |
684 CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method()); | 686 CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method()); |
685 new_jvms = cg->generate(kit.sync_jvms()); | 687 new_jvms = cg->generate(kit.sync_jvms(), parent_parser); |
686 } | 688 } |
687 kit.add_exception_states_from(new_jvms); | 689 kit.add_exception_states_from(new_jvms); |
688 kit.set_jvms(new_jvms); | 690 kit.set_jvms(new_jvms); |
689 | 691 |
690 // Need to merge slow and fast? | 692 // Need to merge slow and fast? |
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 == NULL || !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 } |
782 break; | 784 break; |
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 == NULL || !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 } |
848 break; | 854 break; |
872 | 878 |
873 virtual bool is_virtual() const { return true; } | 879 virtual bool is_virtual() const { return true; } |
874 virtual bool is_inlined() const { return true; } | 880 virtual bool is_inlined() const { return true; } |
875 virtual bool is_intrinsic() const { return true; } | 881 virtual bool is_intrinsic() const { return true; } |
876 | 882 |
877 virtual JVMState* generate(JVMState* jvms); | 883 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
878 }; | 884 }; |
879 | 885 |
880 | 886 |
881 CallGenerator* CallGenerator::for_predicted_intrinsic(CallGenerator* intrinsic, | 887 CallGenerator* CallGenerator::for_predicted_intrinsic(CallGenerator* intrinsic, |
882 CallGenerator* cg) { | 888 CallGenerator* cg) { |
883 return new PredictedIntrinsicGenerator(intrinsic, cg); | 889 return new PredictedIntrinsicGenerator(intrinsic, cg); |
884 } | 890 } |
885 | 891 |
886 | 892 |
887 JVMState* PredictedIntrinsicGenerator::generate(JVMState* jvms) { | 893 JVMState* PredictedIntrinsicGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
888 GraphKit kit(jvms); | 894 GraphKit kit(jvms); |
889 PhaseGVN& gvn = kit.gvn(); | 895 PhaseGVN& gvn = kit.gvn(); |
890 | 896 |
891 CompileLog* log = kit.C->log(); | 897 CompileLog* log = kit.C->log(); |
892 if (log != NULL) { | 898 if (log != NULL) { |
902 JVMState* slow_jvms; | 908 JVMState* slow_jvms; |
903 if (slow_ctl != NULL) { | 909 if (slow_ctl != NULL) { |
904 PreserveJVMState pjvms(&kit); | 910 PreserveJVMState pjvms(&kit); |
905 kit.set_control(slow_ctl); | 911 kit.set_control(slow_ctl); |
906 if (!kit.stopped()) { | 912 if (!kit.stopped()) { |
907 slow_jvms = _cg->generate(kit.sync_jvms()); | 913 slow_jvms = _cg->generate(kit.sync_jvms(), parent_parser); |
908 if (kit.failing()) | 914 if (kit.failing()) |
909 return NULL; // might happen because of NodeCountInliningCutoff | 915 return NULL; // might happen because of NodeCountInliningCutoff |
910 assert(slow_jvms != NULL, "must be"); | 916 assert(slow_jvms != NULL, "must be"); |
911 kit.add_exception_states_from(slow_jvms); | 917 kit.add_exception_states_from(slow_jvms); |
912 kit.set_map(slow_jvms->map()); | 918 kit.set_map(slow_jvms->map()); |
920 kit.set_jvms(slow_jvms); | 926 kit.set_jvms(slow_jvms); |
921 return kit.transfer_exceptions_into_jvms(); | 927 return kit.transfer_exceptions_into_jvms(); |
922 } | 928 } |
923 | 929 |
924 // Generate intrinsic code: | 930 // Generate intrinsic code: |
925 JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms()); | 931 JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms(), parent_parser); |
926 if (new_jvms == NULL) { | 932 if (new_jvms == NULL) { |
927 // Intrinsic failed, so use slow code or make a direct call. | 933 // Intrinsic failed, so use slow code or make a direct call. |
928 if (slow_map == NULL) { | 934 if (slow_map == NULL) { |
929 CallGenerator* cg = CallGenerator::for_direct_call(method()); | 935 CallGenerator* cg = CallGenerator::for_direct_call(method()); |
930 new_jvms = cg->generate(kit.sync_jvms()); | 936 new_jvms = cg->generate(kit.sync_jvms(), parent_parser); |
931 } else { | 937 } else { |
932 kit.set_jvms(slow_jvms); | 938 kit.set_jvms(slow_jvms); |
933 return kit.transfer_exceptions_into_jvms(); | 939 return kit.transfer_exceptions_into_jvms(); |
934 } | 940 } |
935 } | 941 } |
995 } | 1001 } |
996 | 1002 |
997 virtual bool is_virtual() const { ShouldNotReachHere(); return false; } | 1003 virtual bool is_virtual() const { ShouldNotReachHere(); return false; } |
998 virtual bool is_trap() const { return true; } | 1004 virtual bool is_trap() const { return true; } |
999 | 1005 |
1000 virtual JVMState* generate(JVMState* jvms); | 1006 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); |
1001 }; | 1007 }; |
1002 | 1008 |
1003 | 1009 |
1004 CallGenerator* | 1010 CallGenerator* |
1005 CallGenerator::for_uncommon_trap(ciMethod* m, | 1011 CallGenerator::for_uncommon_trap(ciMethod* m, |
1007 Deoptimization::DeoptAction action) { | 1013 Deoptimization::DeoptAction action) { |
1008 return new UncommonTrapCallGenerator(m, reason, action); | 1014 return new UncommonTrapCallGenerator(m, reason, action); |
1009 } | 1015 } |
1010 | 1016 |
1011 | 1017 |
1012 JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms) { | 1018 JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { |
1013 GraphKit kit(jvms); | 1019 GraphKit kit(jvms); |
1014 // Take the trap with arguments pushed on the stack. (Cf. null_check_receiver). | 1020 // Take the trap with arguments pushed on the stack. (Cf. null_check_receiver). |
1015 int nargs = method()->arg_size(); | 1021 int nargs = method()->arg_size(); |
1016 kit.inc_sp(nargs); | 1022 kit.inc_sp(nargs); |
1017 assert(nargs <= kit.sp() && kit.sp() <= jvms->stk_size(), "sane sp w/ args pushed"); | 1023 assert(nargs <= kit.sp() && kit.sp() <= jvms->stk_size(), "sane sp w/ args pushed"); |