diff src/share/vm/ci/ciTypeFlow.cpp @ 6266:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents e9a5e0a812c8
children 7f813940ac35
line wrap: on
line diff
--- a/src/share/vm/ci/ciTypeFlow.cpp	Mon Jul 23 13:04:59 2012 -0700
+++ b/src/share/vm/ci/ciTypeFlow.cpp	Tue Jul 24 10:51:00 2012 -0700
@@ -643,9 +643,9 @@
 // ------------------------------------------------------------------
 // ciTypeFlow::StateVector::do_invoke
 void ciTypeFlow::StateVector::do_invoke(ciBytecodeStream* str,
-                                        bool has_receiver) {
+                                        bool has_receiver_foo) {
   bool will_link;
-  ciMethod* method = str->get_method(will_link);
+  ciMethod* callee = str->get_method(will_link);
   if (!will_link) {
     // We weren't able to find the method.
     if (str->cur_bc() == Bytecodes::_invokedynamic) {
@@ -654,12 +654,24 @@
            (Deoptimization::Reason_uninitialized,
             Deoptimization::Action_reinterpret));
     } else {
-      ciKlass* unloaded_holder = method->holder();
+      ciKlass* unloaded_holder = callee->holder();
       trap(str, unloaded_holder, str->get_method_holder_index());
     }
   } else {
-    ciSignature* signature = method->signature();
+    // 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;
     int i = 0;
@@ -677,6 +689,7 @@
     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();