hotspot/src/share/vm/ci/ciTypeFlow.cpp
changeset 13522 5ad4627e792a
parent 13391 30245956af37
child 13728 882756847a04
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp	Mon Aug 27 15:17:17 2012 -0700
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp	Tue Aug 28 15:24:39 2012 -0700
@@ -643,9 +643,11 @@
 // ------------------------------------------------------------------
 // ciTypeFlow::StateVector::do_invoke
 void ciTypeFlow::StateVector::do_invoke(ciBytecodeStream* str,
-                                        bool has_receiver_foo) {
+                                        bool has_receiver) {
   bool will_link;
-  ciMethod* callee = str->get_method(will_link);
+  ciSignature* declared_signature = NULL;
+  ciMethod* callee = str->get_method(will_link, &declared_signature);
+  assert(declared_signature != NULL, "cannot be null");
   if (!will_link) {
     // We weren't able to find the method.
     if (str->cur_bc() == Bytecodes::_invokedynamic) {
@@ -658,22 +660,12 @@
       trap(str, unloaded_holder, str->get_method_holder_index());
     }
   } else {
-    // TODO Use Bytecode_invoke after metadata changes.
-    //Bytecode_invoke inv(str->method(), str->cur_bci());
-    //const bool has_receiver = callee->is_loaded() ? !callee->is_static() : inv.has_receiver();
-    Bytecode inv(str);
-    Bytecodes::Code code = inv.invoke_code();
-    const bool has_receiver = callee->is_loaded() ? !callee->is_static() : code != Bytecodes::_invokestatic && code != Bytecodes::_invokedynamic;
-
-    ciSignature* signature = callee->signature();
-    ciSignatureStream sigstr(signature);
-    // Push appendix argument, if one.
-    if (str->has_appendix()) {
-      ciObject* appendix = str->get_appendix();
-      push_object(appendix->klass());
-    }
-    int arg_size = signature->size();
-    int stack_base = stack_size() - arg_size;
+    // We are using the declared signature here because it might be
+    // different from the callee signature (Cf. invokedynamic and
+    // invokehandle).
+    ciSignatureStream sigstr(declared_signature);
+    const int arg_size = declared_signature->size();
+    const int stack_base = stack_size() - arg_size;
     int i = 0;
     for( ; !sigstr.at_return_type(); sigstr.next()) {
       ciType* type = sigstr.type();
@@ -689,7 +681,6 @@
     for (int j = 0; j < arg_size; j++) {
       pop();
     }
-    assert(!callee->is_loaded() || has_receiver == !callee->is_static(), "mismatch");
     if (has_receiver) {
       // Check this?
       pop_object();