Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2016-01-05 20:30:03 +0300
committerZoltan Varga <vargaz@gmail.com>2016-01-05 20:33:17 +0300
commitf04a83ca39e0a4bbf01bcd96236e3017e85390cf (patch)
tree3db9294677077dde7057609880157f82c49d11ae
parentae23fba121d3d89227a362674ae85018fe0efb5f (diff)
[llvm] Fix the linking of the bblocks containing endfinally instructions with the targets of leave instructions, previously we would link the first bblock instead of the last one. Fixes #37412.
-rw-r--r--mono/mini/iltests.il21
-rw-r--r--mono/mini/method-to-ir.c2
2 files changed, 22 insertions, 1 deletions
diff --git a/mono/mini/iltests.il b/mono/mini/iltests.il
index 35f1f8db28f..203584e1433 100644
--- a/mono/mini/iltests.il
+++ b/mono/mini/iltests.il
@@ -668,6 +668,27 @@ COND: ldloc.0
ret
}
+ .method public static int32 test_5_endfinally_llvm_linking () il managed {
+ .maxstack 16
+
+ .try {
+ leave IL_0
+ }
+ finally {
+ ldc.i4.0
+ dup
+ brtrue L1
+ pop
+ br L2
+ L1:
+ pop
+ L2:
+ endfinally
+ }
+ IL_0: ldc.i4.5
+ ret
+ }
+
.method public static int32 test_0_conv_ovf_i8_neg () il managed {
.maxstack 16
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index a1dc9fbc994..795fee2ef9f 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -12335,8 +12335,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
/*
* Link the finally bblock with the target, since it will
* conceptually branch there.
- * FIXME: Have to link the bblock containing the endfinally.
*/
+ GET_BBLOCK (cfg, tblock, cfg->cil_start + clause->handler_offset + clause->handler_len - 1);
GET_BBLOCK (cfg, target_bb, target);
link_bblock (cfg, tblock, target_bb);
}