[ppc] Basic changes to allow mono to build and run on power BE
authorBill Seurer <seurer@linux.vnet.ibm.com>
Tue, 18 Aug 2015 14:36:23 +0000 (09:36 -0500)
committerBill Seurer <seurer@linux.vnet.ibm.com>
Tue, 18 Aug 2015 14:36:23 +0000 (09:36 -0500)
mono/mini/mini-ppc.c
mono/mini/mini-trampolines.c
mono/sgen/sgen-archdep.h

index 06528bdee781394e7fa004661f2266914fe453fe..16d3eaf28ebb9fb5546e75f73733e5888a368a18 100644 (file)
@@ -1096,8 +1096,10 @@ get_call_info (MonoMethodSignature *sig)
                                        cinfo->args [n].reg = fr;
                                        fr ++;
                                        FP_ALSO_IN_REG (gr ++);
+#if !defined(__mono_ppc64__)
                                        if (size == 8)
                                                FP_ALSO_IN_REG (gr ++);
+#endif
                                        ALWAYS_ON_STACK (stack_size += size);
                                } else {
                                        cinfo->args [n].offset = PPC_STACK_PARAM_OFFSET + stack_size;
@@ -1165,7 +1167,10 @@ get_call_info (MonoMethodSignature *sig)
                        cinfo->args [n].size = 4;
 
                        /* It was 7, now it is 8 in LinuxPPC */
-                       if (fr <= PPC_LAST_FPARG_REG) {
+                       if (fr <= PPC_LAST_FPARG_REG
+                       // For non-native vararg calls the parms must go in storage
+                                && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG))
+                               ) {
                                cinfo->args [n].regtype = RegTypeFP;
                                cinfo->args [n].reg = fr;
                                fr ++;
@@ -1182,7 +1187,10 @@ get_call_info (MonoMethodSignature *sig)
                case MONO_TYPE_R8:
                        cinfo->args [n].size = 8;
                        /* It was 7, now it is 8 in LinuxPPC */
-                       if (fr <= PPC_LAST_FPARG_REG) {
+                       if (fr <= PPC_LAST_FPARG_REG
+                       // For non-native vararg calls the parms must go in storage
+                                && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG))
+                                ) {
                                cinfo->args [n].regtype = RegTypeFP;
                                cinfo->args [n].reg = fr;
                                fr ++;
@@ -1354,7 +1362,7 @@ mono_arch_allocate_vars (MonoCompile *m)
                m->ret->inst_c0 = m->ret->dreg = ppc_r3;
        } else {
                /* FIXME: handle long values? */
-               switch (mini_get_underlying_type (m, sig->ret)->type) {
+               switch (mini_get_underlying_type (sig->ret)->type) {
                case MONO_TYPE_VOID:
                        break;
                case MONO_TYPE_R4:
index b8fc3337d75120dd783d9705cec484ec39015b3b..d4af8df57a08e4065f746f834cfc369e426a6a9c 100644 (file)
@@ -1002,7 +1002,10 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
                                }
                        }
                }
-       } else {
+       // If "delegate->method_ptr" is null mono_get_addr_from_ftnptr will fail if
+       // ftnptrs are being used.  "method" would end up null on archtitectures without
+       // ftnptrs so we can just skip this.
+       } else if (delegate->method_ptr) {
                ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr));
                if (ji)
                        method = jinfo_get_method (ji);
index 410ba6aab0a0435b0e61a4f1cdded22bc4e2ad62..5e349f8416ee22539b4e1eee99f7e4599765cbd8 100644 (file)
@@ -88,8 +88,8 @@
        } while (0)
 
 /* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some
-   archs is 64k.  */
-#if defined(TARGET_POWERPC64) && _CALL_ELF == 2
+   architectures is 64k.  */
+#if defined(TARGET_POWERPC64)
 #define ARCH_MIN_MS_BLOCK_SIZE (64*1024)
 #define ARCH_MIN_MS_BLOCK_SIZE_SHIFT   16
 #endif