Cast result of s390x_emit16/32 to eliminate lots of warning messages
authorNeale Ferguson <neale@sinenomine.net>
Mon, 17 Jan 2011 04:40:23 +0000 (23:40 -0500)
committerNeale Ferguson <neale@sinenomine.net>
Tue, 18 Jan 2011 23:21:43 +0000 (18:21 -0500)
Check for wrapper-managed-to-native when assessing call parameters and have emit_prolog use native_size when processing those parameters
Signed-off-by: Neale Ferguson <neale@sinenomine.net>
mono/arch/s390x/s390x-codegen.h
mono/mini/mini-s390x.c

index 7a2e069bfc26a6934609ac6977887cb42f8adfcd..26411b4507deb884d49c9a527fe308dab8b9c9f3 100644 (file)
@@ -433,13 +433,13 @@ typedef struct {
 
 #define s390_emit16(c, x) do                   \
 {                                              \
-       *((guint16 *) c) = x;                   \
+       *((guint16 *) c) = (guint16) x;         \
        c += sizeof(guint16);                   \
 } while(0)
 
 #define s390_emit32(c, x) do                   \
 {                                              \
-       *((guint32 *) c) = x;                   \
+       *((guint32 *) c) = (guint32) x;         \
        c += sizeof(guint32);                   \
 } while(0)
 
index 607ff530b9db33c40af6c622159a111aafb1154f..4ebe0b00b2ec054da4aef6b29d69fd88f3e539d2 100644 (file)
@@ -1560,7 +1560,10 @@ enum_retvalue:
         * are sometimes made using calli without sig->hasthis set, like in the delegate
         * invoke wrappers.
         */
-       if (cinfo->struct_ret && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
+       if (cinfo->struct_ret && !is_pinvoke && 
+           (sig->hasthis || 
+             (sig->param_count > 0 && 
+             MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
                if (sig->hasthis) {
                        cinfo->args[nParm].size = sizeof (gpointer);
                        add_general (&gr, sz, cinfo->args + nParm);
@@ -1926,15 +1929,15 @@ mono_arch_allocate_vars (MonoCompile *cfg)
 
                                size = sizeof (gpointer);
 
-                               inst->opcode = OP_REGOFFSET;
+                               inst->opcode       = OP_REGOFFSET;
                                inst->inst_basereg = frame_reg;
-                               offset = S390_ALIGN (offset, sizeof (gpointer));
-                               inst->inst_offset = offset;
+                               offset             = S390_ALIGN (offset, sizeof (gpointer));
+                               inst->inst_offset  = offset;
 
                                /* Add a level of indirection */
                                MONO_INST_NEW (cfg, indir, 0);
-                               *indir = *inst;
-                               inst->opcode = OP_VTARG_ADDR;
+                               *indir          = *inst;
+                               inst->opcode    = OP_VTARG_ADDR;
                                inst->inst_left = indir;
                        }
                                break;
@@ -1962,9 +1965,9 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                        case RegTypeStructByVal :
                                size               = cinfo->args[iParm].size;
                                offset             = S390_ALIGN(offset, size);
-                               inst->opcode = OP_REGOFFSET;
+                               inst->opcode       = OP_REGOFFSET;
                                inst->inst_basereg = frame_reg;
-                               inst->inst_offset = offset;
+                               inst->inst_offset  = offset;
                                break;
                        default :
                                if (cinfo->args [iParm].reg == STK_BASE) {
@@ -1991,7 +1994,10 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                                                                          ? sizeof(int)  
                                                                          : sizeof(long));
                                        offset             = S390_ALIGN(offset, size);
-                                       inst->inst_offset  = offset;
+                                       if (cfg->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) 
+                                               inst->inst_offset  = offset;
+                                       else
+                                               inst->inst_offset  = offset + (8 - size);
                                }
                                break;
                        }
@@ -2000,7 +2006,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                            (iParm < sig->sentinelpos)) 
                                cfg->sig_cookie += size;
 
-                       offset += size;
+                       offset += MAX(size, 8);
                }
                curinst++;
        }
@@ -4882,6 +4888,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        MonoInst *inst;
        int alloc_size, pos, max_offset, i;
        guint8 *code;
+       guint32 size;
        CallInfo *cinfo;
        int tracing = 0;
        int lmfOffset;
@@ -4949,8 +4956,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        cinfo = get_call_info (cfg, cfg->mempool, sig, sig->pinvoke);
 
        if (cinfo->struct_ret) {
-               ArgInfo *ainfo = &cinfo->ret;
-               inst         = cfg->vret_addr;
+               ArgInfo *ainfo     = &cinfo->ret;
+               inst               = cfg->vret_addr;
                inst->backend.size = ainfo->vtsize;
                s390_stg (code, ainfo->reg, 0, inst->inst_basereg, inst->inst_offset);
        }
@@ -5020,7 +5027,12 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                                        s390_lgr  (code, s390_r13, STK_BASE);
                                        s390_aghi (code, s390_r13, alloc_size);
                                }
-                               switch (ainfo->size) {
+
+                               size = (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE  
+                                       ? mono_class_native_size(mono_class_from_mono_type(inst->inst_vtype), NULL)
+                                       : ainfo->size);
+
+                               switch (size) {
                                        case 1:
                                                if (ainfo->reg == STK_BASE)
                                                        s390_ic (code, reg, 0, s390_r13, ainfo->offset+7);