comparison src/share/vm/ci/ciTypeFlow.cpp @ 6634:7f813940ac35

7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites Reviewed-by: kvn
author twisti
date Tue, 28 Aug 2012 15:24:39 -0700
parents 1d7922586cf6
children da91efe96a93
comparison
equal deleted inserted replaced
6633:a5dd6e3ef9f3 6634:7f813940ac35
641 } 641 }
642 642
643 // ------------------------------------------------------------------ 643 // ------------------------------------------------------------------
644 // ciTypeFlow::StateVector::do_invoke 644 // ciTypeFlow::StateVector::do_invoke
645 void ciTypeFlow::StateVector::do_invoke(ciBytecodeStream* str, 645 void ciTypeFlow::StateVector::do_invoke(ciBytecodeStream* str,
646 bool has_receiver_foo) { 646 bool has_receiver) {
647 bool will_link; 647 bool will_link;
648 ciMethod* callee = str->get_method(will_link); 648 ciSignature* declared_signature = NULL;
649 ciMethod* callee = str->get_method(will_link, &declared_signature);
650 assert(declared_signature != NULL, "cannot be null");
649 if (!will_link) { 651 if (!will_link) {
650 // We weren't able to find the method. 652 // We weren't able to find the method.
651 if (str->cur_bc() == Bytecodes::_invokedynamic) { 653 if (str->cur_bc() == Bytecodes::_invokedynamic) {
652 trap(str, NULL, 654 trap(str, NULL,
653 Deoptimization::make_trap_request 655 Deoptimization::make_trap_request
656 } else { 658 } else {
657 ciKlass* unloaded_holder = callee->holder(); 659 ciKlass* unloaded_holder = callee->holder();
658 trap(str, unloaded_holder, str->get_method_holder_index()); 660 trap(str, unloaded_holder, str->get_method_holder_index());
659 } 661 }
660 } else { 662 } else {
661 // TODO Use Bytecode_invoke after metadata changes. 663 // We are using the declared signature here because it might be
662 //Bytecode_invoke inv(str->method(), str->cur_bci()); 664 // different from the callee signature (Cf. invokedynamic and
663 //const bool has_receiver = callee->is_loaded() ? !callee->is_static() : inv.has_receiver(); 665 // invokehandle).
664 Bytecode inv(str); 666 ciSignatureStream sigstr(declared_signature);
665 Bytecodes::Code code = inv.invoke_code(); 667 const int arg_size = declared_signature->size();
666 const bool has_receiver = callee->is_loaded() ? !callee->is_static() : code != Bytecodes::_invokestatic && code != Bytecodes::_invokedynamic; 668 const int stack_base = stack_size() - arg_size;
667
668 ciSignature* signature = callee->signature();
669 ciSignatureStream sigstr(signature);
670 // Push appendix argument, if one.
671 if (str->has_appendix()) {
672 ciObject* appendix = str->get_appendix();
673 push_object(appendix->klass());
674 }
675 int arg_size = signature->size();
676 int stack_base = stack_size() - arg_size;
677 int i = 0; 669 int i = 0;
678 for( ; !sigstr.at_return_type(); sigstr.next()) { 670 for( ; !sigstr.at_return_type(); sigstr.next()) {
679 ciType* type = sigstr.type(); 671 ciType* type = sigstr.type();
680 ciType* stack_type = type_at(stack(stack_base + i++)); 672 ciType* stack_type = type_at(stack(stack_base + i++));
681 // Do I want to check this type? 673 // Do I want to check this type?
687 } 679 }
688 assert(arg_size == i, "must match"); 680 assert(arg_size == i, "must match");
689 for (int j = 0; j < arg_size; j++) { 681 for (int j = 0; j < arg_size; j++) {
690 pop(); 682 pop();
691 } 683 }
692 assert(!callee->is_loaded() || has_receiver == !callee->is_static(), "mismatch");
693 if (has_receiver) { 684 if (has_receiver) {
694 // Check this? 685 // Check this?
695 pop_object(); 686 pop_object();
696 } 687 }
697 assert(!sigstr.is_done(), "must have return type"); 688 assert(!sigstr.is_done(), "must have return type");