Author: zoltan
Date: 2006-01-13 16:53:42 -0500 (Fri, 13 Jan 2006)
New Revision: 55552

Modified:
   branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
Log:
Infrastructure work

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-01-13 21:44:01 UTC (rev 55551)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-01-13 21:53:42 UTC (rev 55552)
@@ -8743,11 +8743,6 @@
 
        /* FIXME: Do this in mono_create_var */
 
-       g_assert (!cfg->vreg_to_inst);
-
-       cfg->vreg_to_inst = mono_mempool_alloc0 (cfg->mempool, sizeof 
(MonoBasicBlock***) * 256);
-       cfg->vreg_to_inst_len = mono_mempool_alloc0 (cfg->mempool, sizeof 
(guint32) * 256);
-
        cfg->vreg_to_inst ['i'] = mono_mempool_alloc0 (cfg->mempool, sizeof 
(MonoInst*) * cfg->next_vireg);
        cfg->vreg_to_inst_len ['i'] = cfg->next_vireg;
        
@@ -8884,7 +8879,7 @@
                                        if (!cfg->vreg_to_inst ['l'][vreg]) {
                                                MonoInst *tree;
 
-                                               cfg->vreg_to_inst ['l'][vreg] = 
mono_compile_create_var_for_vreg (cfg, &mono_defaults.int64_class->byval_arg, 
OP_LOCAL, vreg);
+                                               cfg->vreg_to_inst ['l'][vreg] = 
mono_compile_create_var_for_vreg (cfg, &mono_defaults.int64_class->byval_arg, 
OP_LOCAL, 'l', vreg);
 
                                                if (cfg->verbose_level > 0)
                                                        printf ("LONG VREG R%d 
made global.\n", vreg);
@@ -8921,10 +8916,10 @@
                                                // FIXME:
                                                switch (regtype) {
                                                case 'i':
-                                                       cfg->vreg_to_inst 
[regtype][vreg] = mono_compile_create_var_for_vreg (cfg, 
&mono_defaults.int_class->byval_arg, OP_LOCAL, vreg);
+                                                       cfg->vreg_to_inst 
[regtype][vreg] = mono_compile_create_var_for_vreg (cfg, 
&mono_defaults.int_class->byval_arg, OP_LOCAL, 'i', vreg);
                                                        break;
                                                case 'f':
-                                                       cfg->vreg_to_inst 
[regtype][vreg] = mono_compile_create_var_for_vreg (cfg, 
&mono_defaults.double_class->byval_arg, OP_LOCAL, vreg);
+                                                       cfg->vreg_to_inst 
[regtype][vreg] = mono_compile_create_var_for_vreg (cfg, 
&mono_defaults.double_class->byval_arg, OP_LOCAL, 'f', vreg);
                                                        break;
                                                default:
                                                        NOT_IMPLEMENTED;
@@ -9236,6 +9231,7 @@
  *   3 sregs (2 for arg1 and 1 for arg2)
  * - fix #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS for x86
  * - same goes for lcall and other non-decomposable long opcodes
+ * - make byref a 'normal' type.
  * - LAST MERGE: 55174
  */
 

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-13 
21:44:01 UTC (rev 55551)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-13 
21:53:42 UTC (rev 55552)
@@ -1677,7 +1677,7 @@
 }
 
 MonoInst*
-mono_compile_create_var_for_vreg (MonoCompile *cfg, MonoType *type, int 
opcode, int vreg)
+mono_compile_create_var_for_vreg (MonoCompile *cfg, MonoType *type, int 
opcode, int regtype, int vreg)
 {
        MonoInst *inst;
        int num = cfg->num_varinfo;
@@ -1714,58 +1714,41 @@
 mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode)
 {
        int dreg;
+       int regtype;
+       MonoInst dummy;
 
-       if (cfg->new_ir) {
-               if (type->byref)
-                       dreg = cfg->next_vireg ++;
-               else {
-                       switch (mono_type_get_underlying_type (type)->type) {
-                       case MONO_TYPE_I1:
-                       case MONO_TYPE_U1:
-                       case MONO_TYPE_BOOLEAN:
-                       case MONO_TYPE_I2:
-                       case MONO_TYPE_U2:
-                       case MONO_TYPE_CHAR:
-                       case MONO_TYPE_I4:
-                       case MONO_TYPE_U4:
-                       case MONO_TYPE_I:
-                       case MONO_TYPE_U:
-                       case MONO_TYPE_PTR:
-                       case MONO_TYPE_FNPTR:
-                       case MONO_TYPE_CLASS:
-                       case MONO_TYPE_STRING:
-                       case MONO_TYPE_OBJECT:
-                       case MONO_TYPE_SZARRAY:
-                       case MONO_TYPE_ARRAY:    
-                               /* FIXME: call alloc_dreg */
-                               dreg = cfg->next_vireg ++;
-                               break;
-                       case MONO_TYPE_R4:
-                       case MONO_TYPE_R8:
-                               dreg = cfg->next_vfreg ++;
-                               break;
-                       case MONO_TYPE_I8:
-                       case MONO_TYPE_U8:
+       type_to_eval_stack_type (type, &dummy);
+
+       switch (dummy.type) {
+       case STACK_I4:
+       case STACK_OBJ:
+       case STACK_PTR:
+       case STACK_MP:
+               dreg = cfg->next_vireg ++;
+               regtype = 'i';
+               break;
+       case STACK_R8:
+               dreg = cfg->next_vfreg ++;
+               regtype = 'f';
+               break;
+       case STACK_I8:
 #if SIZEOF_VOID_P == 8
-                               dreg = cfg->next_vireg ++;
+               dreg = cfg->next_vireg ++;
+               regtype = 'i';
 #else
-                               /* Use a pair of vregs */
-                               dreg = cfg->next_vireg ++;
-                               cfg->next_vireg ++;
+               /* Use a pair of vregs */
+               dreg = cfg->next_vireg ++;
+               cfg->next_vireg ++;
+               regtype = 'l';
 #endif
-                               break;
-                       case MONO_TYPE_VALUETYPE:
-                       case MONO_TYPE_TYPEDBYREF:
-                               dreg = -1;
-                               break;
-                       default:
-                               printf ("A: %s\n", mono_type_full_name (type));
-                               NOT_IMPLEMENTED;
-                       }
-               }
+               break;
+       default:
+               dreg = -1;
+               regtype = ' ';
+               break;
        }
 
-       return mono_compile_create_var_for_vreg (cfg, type, opcode, dreg);
+       return mono_compile_create_var_for_vreg (cfg, type, opcode, regtype, 
dreg);
 }
 
 /*
@@ -9477,7 +9460,7 @@
        mono_compile_create_vars (cfg);
 
        if (cfg->new_ir) {
-               cfg->opt &= MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS | 
MONO_OPT_LOOP | MONO_OPT_EXCEPTION | MONO_OPT_AOT | MONO_OPT_BRANCH | 
MONO_OPT_LINEARS;
+               cfg->opt &= MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS | 
MONO_OPT_LOOP | MONO_OPT_EXCEPTION | MONO_OPT_AOT | MONO_OPT_BRANCH;
 
                i = mono_method_to_ir2 (cfg, method, NULL, NULL, 
cfg->locals_start, NULL, NULL, NULL, 0, FALSE);
        }

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.h        2006-01-13 
21:44:01 UTC (rev 55551)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.h        2006-01-13 
21:53:42 UTC (rev 55552)
@@ -584,14 +584,6 @@
        /* The current virtual register numbers */
        guint32 next_vireg, next_vfreg;
 
-       /* Maps vregs to their associated MonoInst's */
-       /* vregs with an associated MonoInst are 'global' while others are 
'local' */
-       /* Indexed first by vreg type ('i' etc), then by the vreg itself */
-       MonoInst ***vreg_to_inst;
-
-       /* Size of above array, indexed by vreg type */
-       guint32 *vreg_to_inst_len;
-
        unsigned char   *native_code;
        guint            code_size;
        guint            code_len;
@@ -624,6 +616,14 @@
        guint32          exception_data;
        char*            exception_message;
 
+       /* Maps vregs to their associated MonoInst's */
+       /* vregs with an associated MonoInst are 'global' while others are 
'local' */
+       /* Indexed first by vreg type ('i' etc), then by the vreg itself */
+       MonoInst **vreg_to_inst [256];
+
+       /* Size of above array, indexed by vreg type */
+       guint32 vreg_to_inst_len [256];
+
 } MonoCompile;
 
 typedef enum {
@@ -849,7 +849,7 @@
 int       mono_is_power_of_two              (guint32 val);
 void      mono_cprop_local                  (MonoCompile *cfg, MonoBasicBlock 
*bb, MonoInst **acp, int acp_size);
 MonoInst* mono_compile_create_var           (MonoCompile *cfg, MonoType *type, 
int opcode);
-MonoInst* mono_compile_create_var_for_vreg  (MonoCompile *cfg, MonoType *type, 
int opcode, int vreg);
+MonoInst* mono_compile_create_var_for_vreg  (MonoCompile *cfg, MonoType *type, 
int opcode, int regtype, int vreg);
 void      mono_compile_make_var_load        (MonoCompile *cfg, MonoInst *dest, 
gssize var_index);
 MonoInst* mono_compile_create_var_load      (MonoCompile *cfg, gssize 
var_index);
 MonoInst* mono_compile_create_var_store     (MonoCompile *cfg, gssize 
var_index, MonoInst *value);
@@ -857,6 +857,7 @@
 guint32   mono_alloc_ireg                   (MonoCompile *cfg);
 guint32   mono_alloc_freg                   (MonoCompile *cfg);
 guint32   mono_alloc_preg                   (MonoCompile *cfg);
+guint32   mono_alloc_dreg                   (MonoCompile *cfg, MonoStackType 
stack_type);
 void      mono_blockset_print               (MonoCompile *cfg, MonoBitSet 
*set, const char *name, guint idom);
 void      mono_print_tree                   (MonoInst *tree);
 void      mono_print_tree_nl                (MonoInst *tree);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to