hotspot/src/share/vm/opto/generateOptoStub.cpp
changeset 35112 b3c4347bb751
parent 33589 7cbd1b2c139b
child 37248 11a660dbbb8e
--- a/hotspot/src/share/vm/opto/generateOptoStub.cpp	Mon Dec 14 10:27:33 2015 -0800
+++ b/hotspot/src/share/vm/opto/generateOptoStub.cpp	Mon Dec 07 15:42:47 2015 +0100
@@ -72,16 +72,18 @@
 
   // Make up the parameters
   uint i;
-  for( i = 0; i < parm_cnt; i++ )
+  for (i = 0; i < parm_cnt; i++) {
     map()->init_req(i, _gvn.transform(new ParmNode(start, i)));
-  for( ; i<map()->req(); i++ )
+  }
+  for ( ; i<map()->req(); i++) {
     map()->init_req(i, top());      // For nicer debugging
+  }
 
   // GraphKit requires memory to be a MergeMemNode:
   set_all_memory(map()->memory());
 
   // Get base of thread-local storage area
-  Node* thread = _gvn.transform( new ThreadLocalNode() );
+  Node* thread = _gvn.transform(new ThreadLocalNode());
 
   const int NoAlias = Compile::AliasIdxBot;
 
@@ -113,21 +115,27 @@
 
   //-----------------------------
   // Compute signature for C call.  Varies from the Java signature!
+
   const Type **fields = TypeTuple::fields(2*parm_cnt+2);
   uint cnt = TypeFunc::Parms;
   // The C routines gets the base of thread-local storage passed in as an
-  // extra argument.  Not all calls need it, but its cheap to add here.
+  // extra argument. Not all calls need it, but it is cheap to add here.
   for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) {
-    fields[cnt] = jdomain->field_at(pcnt);
+    const Type *f = jdomain->field_at(pcnt);
+    if (CCallingConventionRequiresIntsAsLongs && f->isa_int()) {
+      fields[cnt++] = TypeLong::LONG;
+      fields[cnt] = Type::HALF; // Must add an additional half for a long.
+    } else {
+      fields[cnt] = f;
+    }
   }
-
   fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage
   // Also pass in the caller's PC, if asked for.
   if (return_pc) {
     fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC
   }
+  const TypeTuple* domain = TypeTuple::make(cnt, fields);
 
-  const TypeTuple* domain = TypeTuple::make(cnt,fields);
   // The C routine we are about to call cannot return an oop; it can block on
   // exit and a GC will trash the oop while it sits in C-land.  Instead, we
   // return the oop through TLS for runtime calls.
@@ -155,37 +163,44 @@
       rfields[TypeFunc::Parms+1] = jrange->field_at(TypeFunc::Parms+1);
     }
   }
-  const TypeTuple* range = TypeTuple::make(jrange->cnt(),rfields);
+  const TypeTuple* range = TypeTuple::make(jrange->cnt(), rfields);
 
   // Final C signature
-  const TypeFunc *c_sig = TypeFunc::make(domain,range);
+  const TypeFunc *c_sig = TypeFunc::make(domain, range);
 
   //-----------------------------
-  // Make the call node
+  // Make the call node.
   CallRuntimeNode *call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM);
   //-----------------------------
 
-  // Fix-up the debug info for the call
-  call->set_jvms( new (C) JVMState(0) );
+  // Fix-up the debug info for the call.
+  call->set_jvms(new (C) JVMState(0));
   call->jvms()->set_bci(0);
   call->jvms()->set_offsets(cnt);
 
-  // Set fixed predefined input arguments
+  // Set fixed predefined input arguments.
   cnt = 0;
-  for (i = 0; i < TypeFunc::Parms; i++)
-    call->init_req(cnt++, map()->in(i));
-  // A little too aggressive on the parm copy; return address is not an input
-  call->set_req(TypeFunc::ReturnAdr, top());
-  for (; i < parm_cnt; i++) { // Regular input arguments
+  for (i = 0; i < TypeFunc::Parms; i++) {
     call->init_req(cnt++, map()->in(i));
   }
+  // A little too aggressive on the parm copy; return address is not an input.
+  call->set_req(TypeFunc::ReturnAdr, top());
+  for (; i < parm_cnt; i++) { // Regular input arguments.
+    const Type *f = jdomain->field_at(i);
+    if (CCallingConventionRequiresIntsAsLongs && f->isa_int()) {
+      call->init_req(cnt++, _gvn.transform(new ConvI2LNode(map()->in(i))));
+      call->init_req(cnt++, top());
+    } else {
+      call->init_req(cnt++, map()->in(i));
+    }
+  }
+  call->init_req(cnt++, thread);
+  if (return_pc) {             // Return PC, if asked for.
+    call->init_req(cnt++, returnadr());
+  }
 
-  call->init_req( cnt++, thread );
-  if( return_pc )             // Return PC, if asked for
-    call->init_req( cnt++, returnadr() );
   _gvn.transform_no_reclaim(call);
 
-
   //-----------------------------
   // Now set up the return results
   set_control( _gvn.transform( new ProjNode(call,TypeFunc::Control)) );