Author: massi
Date: 2006-06-16 16:33:31 -0400 (Fri, 16 Jun 2006)
New Revision: 61812

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/aliasing.c
   trunk/mono/mono/mini/mini.h
   trunk/mono/mono/mini/simple-cee-ops.h
   trunk/mono/mono/mini/simple-mini-ops.h
   trunk/mono/mono/mini/ssa.c
Log:
        * ssa.c: Fixed bug 78653 for SSA based deadce.
        * mini.h: added MONO_INST_DEFINITION_HAS_SIDE_EFFECTS flag go
        MonoInst.flags, used in SSA based deadce.
        * aliasing.c: Fixed bug 78653 for "fastpath" deadce.
        * simple-cee-ops.h, simple-mini-ops.h: Fixed bug 78653.



Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2006-06-16 18:57:08 UTC (rev 61811)
+++ trunk/mono/mono/mini/ChangeLog      2006-06-16 20:33:31 UTC (rev 61812)
@@ -1,3 +1,9 @@
+2006-06-13  Massimiliano Mantione  <[EMAIL PROTECTED]>
+       * ssa.c: Fixed bug 78653 for SSA based deadce.
+       * mini.h: added MONO_INST_DEFINITION_HAS_SIDE_EFFECTS flag go
+       MonoInst.flags, used in SSA based deadce.
+       * aliasing.c: Fixed bug 78653 for "fastpath" deadce.
+       * simple-cee-ops.h, simple-mini-ops.h: Fixed bug 78653.
 
 Thu Jun 15 16:52:46 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
 

Modified: trunk/mono/mono/mini/aliasing.c
===================================================================
--- trunk/mono/mono/mini/aliasing.c     2006-06-16 18:57:08 UTC (rev 61811)
+++ trunk/mono/mono/mini/aliasing.c     2006-06-16 20:33:31 UTC (rev 61812)
@@ -896,10 +896,17 @@
        
        arity = mono_burg_arity [inst->opcode];
        
-       if (OP_IS_CALL (inst->opcode)) {
+       switch (inst->opcode) {
+#define OPDEF(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) case a1:
+#include "simple-cee-ops.h"
+#undef OPDEF
+#define MINI_OP(a1,a2) case a1:
+#include "simple-mini-ops.h"
+#undef MINI_OP
+               has_side_effects = FALSE;
+               break;
+       default:
                has_side_effects = TRUE;
-       } else {
-               has_side_effects = FALSE;
        }
        
        if (arity) {

Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2006-06-16 18:57:08 UTC (rev 61811)
+++ trunk/mono/mono/mini/mini.h 2006-06-16 20:33:31 UTC (rev 61812)
@@ -338,6 +338,7 @@
        MONO_INST_BRLABEL    = 4,
        MONO_INST_NOTYPECHECK    = 4,
        MONO_INST_UNALIGNED  = 8,
+       MONO_INST_DEFINITION_HAS_SIDE_EFFECTS = 8,
        /* the address of the variable has been taken */
        MONO_INST_INDIRECT   = 16,
        MONO_INST_NORANGECHECK   = 16

Modified: trunk/mono/mono/mini/simple-cee-ops.h
===================================================================
--- trunk/mono/mono/mini/simple-cee-ops.h       2006-06-16 18:57:08 UTC (rev 
61811)
+++ trunk/mono/mono/mini/simple-cee-ops.h       2006-06-16 20:33:31 UTC (rev 
61812)
@@ -1,6 +1,6 @@
 
-#if 0
 
+#if (ANALYZE_DEV_USE_SPECIFIC_OPS)
 OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x46, 
NEXT)
 OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x47, 
NEXT)
 OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, X, 1, 0xFF, 0x48, 
NEXT)
@@ -14,7 +14,9 @@
 OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, X, 1, 0xFF, 0x50, 
NEXT)
 OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, X, 1, 0xFF, 0x72, NEXT)
 OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0x81, NEXT)
+#endif
 
+#if 0
 OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, X, 1, 0xFF, 0x70, NEXT)
 OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, X, 1, 0xFF, 0x71, NEXT)
 OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, X, 1, 0xFF, 
0x74, NEXT)
@@ -27,7 +29,6 @@
 OPDEF(CEE_MONO_LDNATIVEOBJ, "mono_ldnativeobj", PopI, Push1, InlineType, X, 2, 
0xF0, 0x06, RETURN)
 OPDEF(CEE_MONO_CISINST, "mono_cisinst", PopRef, Push1, InlineType, X, 2, 0xF0, 
0x07, NEXT)
 OPDEF(CEE_MONO_CCASTCLASS, "mono_ccastclass", PopRef, Push1, InlineType, X, 2, 
0xF0, 0x08, NEXT)
-
 #endif
 
 #if (SSAPRE_SPECIFIC_OPS)
@@ -48,7 +49,7 @@
 #endif
 
 
-
+#if (TREEMOVE_SPECIFIC_OPS)
 OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, X, 1, 0xFF, 0x8E, NEXT)
 OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, X, 1, 0xFF, 
0x8F, NEXT)
 OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 
0x90, NEXT)
@@ -63,8 +64,8 @@
 OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, X, 1, 0xFF, 
0x99, NEXT)
 OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, X, 1, 
0xFF, 0x9A, NEXT)
 OPDEF(CEE_LDELEM_ANY, "ldelem.any", PopRef+PopI, Push1, InlineType, X, 1, 
0xFF, 0xA3, NEXT)
+#endif
 
-
 OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x58, NEXT)
 OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x59, NEXT)
 OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5A, NEXT)

Modified: trunk/mono/mono/mini/simple-mini-ops.h
===================================================================
--- trunk/mono/mono/mini/simple-mini-ops.h      2006-06-16 18:57:08 UTC (rev 
61811)
+++ trunk/mono/mono/mini/simple-mini-ops.h      2006-06-16 20:33:31 UTC (rev 
61812)
@@ -15,6 +15,12 @@
 
 #endif
 
+#if (ANALYZE_DEV_USE_SPECIFIC_OPS)
+MINI_OP(OP_LOCAL, "local")
+MINI_OP(OP_ARG, "arg")
+#endif
+
+
 MINI_OP(OP_LOAD_MEMBASE,"load_membase")
 MINI_OP(OP_LOADI1_MEMBASE,"loadi1_membase")
 MINI_OP(OP_LOADU1_MEMBASE,"loadu1_membase")
@@ -28,7 +34,9 @@
 MINI_OP(OP_LOADR8_SPILL_MEMBASE,"loadr8_spill_membase")
 MINI_OP(OP_LOADU4_MEM,"loadu4_mem")
 
+#if (TREEMOVE_SPECIFIC_OPS)
 MINI_OP(OP_LDELEMA2D, "getldelema2")
+#endif
 
 MINI_OP(OP_GETTYPE, "gettype")
 MINI_OP(OP_GETHASHCODE, "gethashcode")

Modified: trunk/mono/mono/mini/ssa.c
===================================================================
--- trunk/mono/mono/mini/ssa.c  2006-06-16 18:57:08 UTC (rev 61811)
+++ trunk/mono/mono/mini/ssa.c  2006-06-16 20:33:31 UTC (rev 61812)
@@ -579,16 +579,37 @@
        MonoInst *inst;
 } MonoVarUsageInfo;
 
-static void
+
+
+
+/*
+ * Returns TRUE if the tree can have side effects.
+ */
+static gboolean
 analyze_dev_use (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *root, 
MonoInst *inst)
 {
        MonoMethodVar *info;
        int i, idx, arity;
+       gboolean has_side_effects;
 
        if (!inst)
-               return;
+               return FALSE;
 
        arity = mono_burg_arity [inst->opcode];
+       switch (inst->opcode) {
+#define ANALYZE_DEV_USE_SPECIFIC_OPS 1
+#define OPDEF(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) case a1:
+#include "simple-cee-ops.h"
+#undef OPDEF
+#define MINI_OP(a1,a2) case a1:
+#include "simple-mini-ops.h"
+#undef MINI_OP
+#undef ANALYZE_DEV_USE_SPECIFIC_OPS
+               has_side_effects = FALSE;
+               break;
+       default:
+               has_side_effects = TRUE;
+       }
 
        if ((inst->ssa_op == MONO_SSA_STORE) && 
            (inst->inst_i0->opcode == OP_LOCAL /*|| inst->inst_i0->opcode == 
OP_ARG */)) {
@@ -631,11 +652,15 @@
        } else {
                if (arity) {
                        //if (inst->ssa_op != MONO_SSA_STORE)
-                       analyze_dev_use (cfg, bb, root, inst->inst_left);
+                       if (analyze_dev_use (cfg, bb, root, inst->inst_left))
+                               has_side_effects = TRUE;
                        if (arity > 1)
-                               analyze_dev_use (cfg, bb, root, 
inst->inst_right);
+                               if (analyze_dev_use (cfg, bb, root, 
inst->inst_right))
+                                       has_side_effects = TRUE;
                }
        }
+       
+       return has_side_effects;
 }
 
 
@@ -704,7 +729,11 @@
        for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
                MonoInst *inst;
                for (inst = bb->code; inst; inst = inst->next) {
-                       analyze_dev_use (cfg, bb, inst, inst);
+                       gboolean has_side_effects = analyze_dev_use (cfg, bb, 
inst, inst);
+                       if (has_side_effects && (inst->ssa_op == 
MONO_SSA_STORE) && 
+                                       (inst->inst_i0->opcode == OP_LOCAL || 
inst->inst_i0->opcode == OP_ARG)) {
+                               inst->inst_i0->flags |= 
MONO_INST_DEFINITION_HAS_SIDE_EFFECTS;
+                       }
                }
        }
 
@@ -1179,7 +1208,7 @@
                MonoMethodVar *info = (MonoMethodVar *)work_list->data;
                work_list = g_list_delete_link (work_list, work_list);
 
-               if (!info->uses && info->def && (!(cfg->varinfo 
[info->idx]->flags & (MONO_INST_VOLATILE|MONO_INST_INDIRECT)))) {
+               if (!info->uses && info->def && (!(cfg->varinfo 
[info->idx]->flags & 
(MONO_INST_DEFINITION_HAS_SIDE_EFFECTS|MONO_INST_VOLATILE|MONO_INST_INDIRECT))))
 {
                        MonoInst *i1;
                        //printf ("ELIMINATE %s: ", mono_method_full_name 
(cfg->method, TRUE)); mono_print_tree (info->def); printf ("\n");
 

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

Reply via email to