hotspot/src/share/vm/ci/ciTypeFlow.cpp
changeset 13522 5ad4627e792a
parent 13391 30245956af37
child 13728 882756847a04
equal deleted inserted replaced
13521:97a23be06f4e 13522:5ad4627e792a
   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");