Permalink
Browse files

2002-05-16 Dietmar Maurer <dietmar@ximian.com>

	* jit.c (mono_find_final_block): make it work with mcs

svn path=/trunk/mono/; revision=4678
  • Loading branch information...
1 parent 0057b35 commit 7441975a4517e8713776213bb083ae757e1c18c5 Dietmar Maurer committed May 16, 2002
Showing with 36 additions and 7 deletions.
  1. +2 −0 mono/jit/ChangeLog
  2. +5 −7 mono/jit/jit.c
  3. +1 −0 mono/tests/Makefile.am
  4. +28 −0 mono/tests/exception12.cs
View
@@ -1,5 +1,7 @@
2002-05-16 Dietmar Maurer <dietmar@ximian.com>
+ * jit.c (mono_find_final_block): make it work with mcs
+
* x86.brg: buf fix. if exception variable is allocated to a register.
* jit.c (mono_find_final_block): bug fix.
View
@@ -1095,7 +1095,7 @@ mono_cfg_free (MonoFlowGraph *cfg)
}
static MonoBBlock *
-mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, int type)
+mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, guint32 target, int type)
{
MonoMethod *method = cfg->method;
MonoBytecodeInfo *bcinfo = cfg->bcinfo;
@@ -1105,15 +1105,13 @@ mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, int type)
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
- if (MONO_OFFSET_IN_HANDLER (clause, ip))
- return NULL;
- if (MONO_OFFSET_IN_CLAUSE (clause, ip)) {
+ if (MONO_OFFSET_IN_CLAUSE (clause, ip) &&
+ (!MONO_OFFSET_IN_CLAUSE (clause, target))) {
if (clause->flags & type) {
g_assert (bcinfo [clause->handler_offset].is_block_start);
return &cfg->bblocks [bcinfo [clause->handler_offset].block_id];
- } else
- return NULL;
+ }
}
}
return NULL;
@@ -3067,7 +3065,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
/* fixme: fault handler */
- if ((hb = mono_find_final_block (cfg, cli_addr, MONO_EXCEPTION_CLAUSE_FINALLY))) {
+ if ((hb = mono_find_final_block (cfg, cli_addr, target, MONO_EXCEPTION_CLAUSE_FINALLY))) {
mark_reached (cfg, hb, NULL, 0);
t1 = mono_ctree_new_leaf (mp, MB_TERM_HANDLER);
t1->data.p = hb;
@@ -30,6 +30,7 @@ TESTSRC= \
exception8.cs \
exception10.cs \
exception11.cs \
+ exception12.cs \
struct.cs \
valuetype-gettype.cs \
static-constructor.cs \
@@ -0,0 +1,28 @@
+using System;
+
+public class Test {
+
+ public static int Main (string[] args) {
+
+ int c = 0;
+ try {
+ try {
+ c = 0;
+ }
+ catch (Exception e) {
+ Console.WriteLine("Exception: {0}", e.Message);
+ }
+ finally {
+ Console.WriteLine("Finally... {0}", c++);
+ }
+ }
+ finally {
+ c++;
+ }
+
+ if (c != 2)
+ return 1;
+
+ return 0;
+ }
+}

0 comments on commit 7441975

Please sign in to comment.