Author: zoltan
Date: 2006-06-12 10:16:59 -0400 (Mon, 12 Jun 2006)
New Revision: 61627

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/iltests.il
   trunk/mono/mono/mini/mini.c
Log:
2006-06-12  Zoltan Varga  <[EMAIL PROTECTED]>

        * mini.c (remove_block_if_useless): Do not remove the bblock immediately
        after the end of a try bblock, to prevent asserts in 
mini_method_compile ().

        * iltests.il: Add a test for the above.


Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2006-06-12 13:53:17 UTC (rev 61626)
+++ trunk/mono/mono/mini/ChangeLog      2006-06-12 14:16:59 UTC (rev 61627)
@@ -1,3 +1,10 @@
+2006-06-12  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * mini.c (remove_block_if_useless): Do not remove the bblock immediately
+       after the end of a try bblock, to prevent asserts in 
mini_method_compile ().
+
+       * iltests.il: Add a test for the above.
+
 2006-06-10  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * mini-ia64.c (mono_arch_lowering_pass): Remove some code duplication.

Modified: trunk/mono/mono/mini/iltests.il
===================================================================
--- trunk/mono/mono/mini/iltests.il     2006-06-12 13:53:17 UTC (rev 61626)
+++ trunk/mono/mono/mini/iltests.il     2006-06-12 14:16:59 UTC (rev 61627)
@@ -1041,4 +1041,30 @@
        ret     
   }
 
+       .method public static void try_block_end_remove_if_useless () cil 
managed {
+           .maxstack  8
+
+           T_START:
+               ldstr   "Start"
+                       pop
+               leave.s COMPLETE
+           T1_END:
+
+           COMPLETE:
+               ret
+
+           F1_START:
+               ldstr   "Finally1"
+                       pop
+               endfinally
+           F1_END:
+
+           .try T_START to T1_END finally handler F1_START to F1_END
+       }
+
+       .method public static int32 test_0_try_block_end_remove_if_useless () 
cil managed {
+               call void class Tests::try_block_end_remove_if_useless ()
+               ldc.i4.0
+               ret
+       }
 }

Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2006-06-12 13:53:17 UTC (rev 61626)
+++ trunk/mono/mono/mini/mini.c 2006-06-12 14:16:59 UTC (rev 61627)
@@ -8762,6 +8762,13 @@
        if ((previous_bb == cfg->bb_entry) && (bb->next_bb != target_bb)) {
                return FALSE;
        }
+
+       /* 
+        * Do not touch BBs following a try block as the code in 
+        * mini_method_compile needs them to compute the length of the try 
block.
+        */
+       if (MONO_BBLOCK_IS_IN_REGION (previous_bb, MONO_REGION_TRY))
+               return FALSE;
        
        /* Check that there is a target BB, and that bb is not an empty loop 
(Bug 75061) */
        if ((target_bb != NULL) && (target_bb != bb)) {

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

Reply via email to