[Pkg-mono-svn-commits] [mono] 01/04: Fixes to get mono to build on big endian ppc.

Jo Shields directhex at moszumanska.debian.org
Mon Sep 7 09:16:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

directhex pushed a commit to branch master-patches/ppc_big_endian_fixes
in repository mono.

commit 7d7f61a7c37f70ff8847dc39c607177cd00d8618
Author: Bill Seurer <seurer at linux.vnet.ibm.com>
Date:   Wed Jul 1 08:39:05 2015 -0500

    Fixes to get mono to build on big endian ppc.
    
    (cherry picked from commit d36ce0d9911fc668ac25d7116772044a78790f0e)
    
    Conflicts:
    	mono/mini/tramp-ppc.c
---
 mono/metadata/sgen-archdep.h |  2 +-
 mono/mini/mini-ppc.c         | 31 ++++++++++++++++++++++++++++++-
 mono/mini/mini-trampolines.c |  2 +-
 mono/mini/tramp-ppc.c        |  2 ++
 4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/mono/metadata/sgen-archdep.h b/mono/metadata/sgen-archdep.h
index 410ba6a..7b1539e 100644
--- a/mono/metadata/sgen-archdep.h
+++ b/mono/metadata/sgen-archdep.h
@@ -89,7 +89,7 @@
 
 /* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some
    archs is 64k.  */
-#if defined(TARGET_POWERPC64) && _CALL_ELF == 2
+#if defined(TARGET_POWERPC64)
 #define ARCH_MIN_MS_BLOCK_SIZE	(64*1024)
 #define ARCH_MIN_MS_BLOCK_SIZE_SHIFT	16
 #endif
diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c
index 80a6c8a..46c37c5 100644
--- a/mono/mini/mini-ppc.c
+++ b/mono/mini/mini-ppc.c
@@ -1091,8 +1091,10 @@ get_call_info (MonoGenericSharingContext *gsctx, 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;
@@ -1695,15 +1697,27 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
 		} else
 #endif
 			for (i = 0; i < ainfo->vtregs; ++i) {
+	 			dreg = mono_alloc_ireg (cfg);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
 				int antipadding = 0;
 				if (ainfo->bytes) {
 					g_assert (i == 0);
 					antipadding = sizeof (gpointer) - ainfo->bytes;
 				}
-				dreg = mono_alloc_ireg (cfg);
 				MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset);
 				if (antipadding)
 					MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_UN_IMM, dreg, dreg, antipadding * 8);
+#else
+				if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 1) {
+					MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU1_MEMBASE, dreg, src->dreg, soffset);
+				} else if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 2) {
+					MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU2_MEMBASE, dreg, src->dreg, soffset);
+				} else if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 4) { // WDS -- Maybe <= 4?
+					MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU4_MEMBASE, dreg, src->dreg, soffset);
+				} else {
+					MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset);
+				}
+#endif
 				mono_call_inst_add_outarg_reg (cfg, call, dreg, ainfo->reg + i, FALSE);
 				soffset += sizeof (gpointer);
 			}
@@ -2235,8 +2249,11 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
 		else
 			MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_IMM, ins->dreg, result_shifted_reg, 32);
 		ins->opcode = OP_NOP;
+		break;
 	}
 #endif
+	default:
+		break;
 	}
 }
 
@@ -5033,9 +5050,21 @@ mono_arch_emit_prolog (MonoCompile *cfg)
 #ifdef __mono_ppc64__
 						if (ainfo->bytes) {
 							g_assert (cur_reg == 0);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
 							ppc_sldi (code, ppc_r0, ainfo->reg,
 									(sizeof (gpointer) - ainfo->bytes) * 8);
 							ppc_stptr (code, ppc_r0, doffset, inst->inst_basereg);
+#else
+							if (mono_class_native_size (inst->klass, NULL) == 1) {
+							  ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+							} else if (mono_class_native_size (inst->klass, NULL) == 2) {
+								ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+							} else if (mono_class_native_size (inst->klass, NULL) == 4) {  // WDS -- maybe <=4?
+								ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+							} else {
+								ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);  // WDS -- Better way?
+							}
+#endif
 						} else
 #endif
 						{
diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c
index daac4fe..e1a334e 100644
--- a/mono/mini/mini-trampolines.c
+++ b/mono/mini/mini-trampolines.c
@@ -1079,7 +1079,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
 					method = mono_marshal_get_unbox_wrapper (method);
 			}
 		}
-	} else {
+	} 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);
diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c
index 1b2cc1d..4d44ba7 100644
--- a/mono/mini/tramp-ppc.c
+++ b/mono/mini/tramp-ppc.c
@@ -690,6 +690,8 @@ mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info)
 
 	if (info)
 		*info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
+	/* It is expected to be a function descriptor on power pre-v2 ABI */
+	buf = mono_create_ftnptr (mono_domain_get (), buf);
 
 	return buf;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mono/packages/mono.git



More information about the Pkg-mono-svn-commits mailing list