src/cpu/ppc/vm/sharedRuntime_ppc.cpp

Print this page
rev 5186 : 8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
Summary: Some platforms, as ppc and s390x/zArch require that 32-bit ints are passed as 64-bit values to C functions. This change adds support to adapt the signature and to issue proper casts to c2-compiled stubs. The functions are used in generate_native_wrapper(). Adapt signature in PhaseIdealLoop::intrinsify_fill().

@@ -732,15 +732,12 @@
     case T_SHORT:
     case T_INT:
       // We must cast ints to longs and use full 64 bit stack slots
       // here. We do the cast in GraphKit::gen_stub() and just guard
       // here against loosing that change.
-      Unimplemented(); // TODO: PPC port
-      /*
       assert(SharedRuntime::c_calling_convention_requires_ints_as_longs(),
              "argument of type int should be promoted to type long");
-      */
       guarantee(i > 0 && sig_bt[i-1] == T_LONG,
                 "argument of type (bt) should have been promoted to type (T_LONG,bt) for bt in "
                 "{T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}");
       // Do not count halves.
       regs[i].set_bad();

@@ -828,10 +825,15 @@
 
   return round_to(stk, 2);
 }
 #endif // COMPILER2
 
+// Do we need to convert ints to longs for c calls?
+bool SharedRuntime::c_calling_convention_requires_ints_as_longs() {
+  return true;
+}
+
 static address gen_c2i_adapter(MacroAssembler *masm,
                             int total_args_passed,
                             int comp_args_on_stack,
                             const BasicType *sig_bt,
                             const VMRegPair *regs,