2008-01-27 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 27 Jan 2008 17:28:08 +0000 (17:28 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sun, 27 Jan 2008 17:28:08 +0000 (17:28 -0000)
* mini-s390.c: Add support for generic sharing.

svn path=/trunk/mono/; revision=94058

mono/mini/ChangeLog
mono/mini/mini-s390.c

index bc532109022d091fc3d79446b217d8295682413f..23535cd54a17150a829498d99365ecb1f1dec7d9 100644 (file)
@@ -1,5 +1,7 @@
 2008-01-27  Zoltan Varga  <vargaz@gmail.com>
 
+       * mini-s390.c: Add support for generic sharing.
+
        * mini-exceptions.c (ves_icall_System_Security_SecurityFrame_GetSecurityFrame): 
        Fix CAS on s390.
        (ves_icall_System_Security_SecurityFrame_GetSecurityStack): Ditto.
index 82de52fc241d37391dc965e60fb47f2837ae9720..f8739e558fa9738234bd57bd755f0b23eb41e9c6 100644 (file)
@@ -247,7 +247,7 @@ static gboolean is_regsize_var (MonoType *);
 static inline void add_general (guint *, size_data *, ArgInfo *, gboolean);
 static inline void add_stackParm (guint *, size_data *, ArgInfo *, gint);
 static inline void add_float (guint *, size_data *, ArgInfo *);
-static CallInfo * calculate_sizes (MonoMethodSignature *, size_data *, gboolean);
+static CallInfo * calculate_sizes (MonoCompile *, MonoMethodSignature *, size_data *, gboolean);
 static void peephole_pass (MonoCompile *, MonoBasicBlock *);
 static guchar * emit_float_to_int (MonoCompile *, guchar *, int, int, int, gboolean);
 gpointer mono_arch_get_lmf_addr (void);
@@ -669,7 +669,7 @@ enter_method (MonoMethod *method, RegParm *rParm, char *sp)
        
        sig = mono_method_signature (method);
        
-       cinfo = calculate_sizes (sig, &sz, sig->pinvoke);
+       cinfo = calculate_sizes (NULL, sig, &sz, sig->pinvoke);
 
        if (cinfo->struct_ret) {
                printf ("[STRUCTRET:%p], ", (gpointer) rParm->gr[0]);
@@ -1274,13 +1274,15 @@ add_float (guint *fr,  size_data *sz, ArgInfo *ainfo)
 /*------------------------------------------------------------------*/
 
 static CallInfo *
-calculate_sizes (MonoMethodSignature *sig, size_data *sz, 
+calculate_sizes (MonoCompile *cfg, MonoMethodSignature *sig, size_data *sz, 
                 gboolean string_ctor)
 {
        guint i, fr, gr, size;
        int nParm = sig->hasthis + sig->param_count;
+       MonoType *ret_type;
        guint32 simpletype, align;
        CallInfo *cinfo = g_malloc0 (sizeof (CallInfo) + sizeof (ArgInfo) * nParm);
+       MonoGenericSharingContext *gsctx = cfg ? cfg->generic_sharing_context : NULL;
 
        fr                = 0;
        gr                = s390_r2;
@@ -1300,7 +1302,9 @@ calculate_sizes (MonoMethodSignature *sig, size_data *sz,
        /* area that the callee will use.                           */
        /*----------------------------------------------------------*/
 
-       simpletype = mono_type_get_underlying_type (sig->ret)->type;
+       ret_type = mono_type_get_underlying_type (sig->ret);
+       ret_type = mini_get_basic_type_from_generic (gsctx, ret_type);
+       simpletype = ret_type->type;
 enum_retvalue:
        switch (simpletype) {
                case MONO_TYPE_BOOLEAN:
@@ -1385,6 +1389,8 @@ enum_retvalue:
        /*----------------------------------------------------------*/
 
        for (i = 0; i < sig->param_count; ++i) {
+               MonoType *ptype;
+
                /*--------------------------------------------------*/
                /* Handle vararg type calls. All args are put on    */
                /* the stack.                                       */
@@ -1402,7 +1408,9 @@ enum_retvalue:
                        continue;
                }
 
-               simpletype = mono_type_get_underlying_type(sig->params [i])->type;
+               ptype = mono_type_get_underlying_type (sig->params [i]);
+               ptype = mini_get_basic_type_from_generic (gsctx, ptype);
+               simpletype = ptype->type;
                switch (simpletype) {
                case MONO_TYPE_BOOLEAN:
                case MONO_TYPE_I1:
@@ -1645,7 +1653,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
 
        sig     = mono_method_signature (cfg->method);
        
-       cinfo   = calculate_sizes (sig, &sz, sig->pinvoke);
+       cinfo   = calculate_sizes (cfg, sig, &sz, sig->pinvoke);
 
        if (cinfo->struct_ret) {
                cfg->ret->opcode = OP_REGVAR;
@@ -1835,7 +1843,7 @@ mono_arch_call_opcode (MonoCompile *cfg, MonoBasicBlock* bb,
        n = sig->param_count + sig->hasthis;
        DEBUG (g_print ("Call requires: %d parameters\n",n));
        
-       cinfo = calculate_sizes (sig, &sz, sig->pinvoke);
+       cinfo = calculate_sizes (cfg, sig, &sz, sig->pinvoke);
 
        stackSize         = sz.stack_size + sz.local_size + sz.parm_size + sz.offset;
        call->stack_usage = MAX(stackSize, call->stack_usage);
@@ -4138,7 +4146,7 @@ emit_load_volatile_registers(guint8 * code, MonoCompile *cfg)
        sig = mono_method_signature (method);
        pos = 0;
 
-       cinfo = calculate_sizes (sig, &sz, sig->pinvoke);
+       cinfo = calculate_sizes (NULL, sig, &sz, sig->pinvoke);
 
        if (cinfo->struct_ret) {
                ArgInfo *ainfo = &cinfo->ret;
@@ -4299,7 +4307,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        sig = mono_method_signature (method);
        pos = 0;
 
-       cinfo = calculate_sizes (sig, &sz, sig->pinvoke);
+       cinfo = calculate_sizes (cfg, sig, &sz, sig->pinvoke);
 
        if (cinfo->struct_ret) {
                ArgInfo *ainfo = &cinfo->ret;