< prev index next >

src/share/vm/opto/graphKit.cpp

Print this page
rev 10518 : Tobias' flattened array
rev 10544 : call to __Value methods can't pass fields as arguments

@@ -1728,29 +1728,36 @@
 
 //-------------------------set_arguments_for_java_call-------------------------
 // Arguments (pre-popped from the stack) are taken from the JVMS.
 void GraphKit::set_arguments_for_java_call(CallJavaNode* call) {
   // Add the call arguments:
-  uint nargs = call->method()->arg_size();
-  for (uint i = 0, idx = 0; i < nargs; i++) {
-    Node* arg = argument(i);
+  const TypeTuple* domain = call->tf()->domain_sig();
+  uint nargs = domain->cnt();
+  for (uint i = TypeFunc::Parms, idx = TypeFunc::Parms; i < nargs; i++) {
+    Node* arg = argument(i-TypeFunc::Parms);
     if (ValueTypePassFieldsAsArgs) {
       if (arg->is_ValueType()) {
         ValueTypeNode* vt = arg->as_ValueType();
+        if (domain->field_at(i)->is_valuetypeptr()->klass() != C->env()->___Value_klass()) {
         // We don't pass value type arguments by reference but instead
         // pass each field of the value type
-        idx += vt->set_arguments_for_java_call(call, idx + TypeFunc::Parms, *this);
+          idx += vt->set_arguments_for_java_call(call, idx, *this);
       } else {
-        call->init_req(idx + TypeFunc::Parms, arg);
+          arg = arg->as_ValueType()->store_to_memory(this);
+          call->init_req(idx, arg);
+          idx++;
+        }
+      } else {
+        call->init_req(idx, arg);
         idx++;
       }
     } else {
       if (arg->is_ValueType()) {
         // Pass value type argument via oop to callee
         arg = arg->as_ValueType()->store_to_memory(this);
       }
-      call->init_req(i + TypeFunc::Parms, arg);
+      call->init_req(i, arg);
     }
   }
 }
 
 //---------------------------set_edges_for_java_call---------------------------
< prev index next >