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? |