diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/rse_all-features.txt | 81 | ||||
-rw-r--r-- | test/passes/rse_all-features.wast | 58 |
2 files changed, 139 insertions, 0 deletions
diff --git a/test/passes/rse_all-features.txt b/test/passes/rse_all-features.txt index 6c9d52585..1594425cf 100644 --- a/test/passes/rse_all-features.txt +++ b/test/passes/rse_all-features.txt @@ -4,6 +4,7 @@ (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_f64_=>_none (func (param i32 f64))) (event $e (attr 0) (param i32)) + (event $e2 (attr 0) (param)) (func $basic (param $x i32) (param $y f64) (local $a f32) (local $b i64) @@ -645,4 +646,84 @@ (i32.const 1) ) ) + (func $nested-catch1 + (local $x i32) + (try $try + (do + (throw $e + (i32.const 0) + ) + ) + (catch $e + (drop + (pop i32) + ) + ) + (catch $e2 + (try $try6 + (do + (throw $e + (i32.const 0) + ) + ) + (catch $e + (drop + (pop i32) + ) + ) + (catch $e2 + (local.set $x + (i32.const 1) + ) + ) + ) + ) + ) + (local.set $x + (i32.const 1) + ) + ) + (func $nested-catch2 + (local $x i32) + (try $try + (do + (throw $e + (i32.const 0) + ) + ) + (catch $e + (drop + (pop i32) + ) + (local.set $x + (i32.const 1) + ) + ) + (catch_all + (try $try7 + (do + (throw $e + (i32.const 0) + ) + ) + (catch $e + (drop + (pop i32) + ) + (local.set $x + (i32.const 1) + ) + ) + (catch_all + (local.set $x + (i32.const 1) + ) + ) + ) + ) + ) + (drop + (i32.const 1) + ) + ) ) diff --git a/test/passes/rse_all-features.wast b/test/passes/rse_all-features.wast index b3c684fbd..8192ecea1 100644 --- a/test/passes/rse_all-features.wast +++ b/test/passes/rse_all-features.wast @@ -288,6 +288,7 @@ ) (event $e (attr 0) (param i32)) + (event $e2 (attr 0)) (func $try1 (local $x i32) (try @@ -416,4 +417,61 @@ ;; so the local.set may not run. So this should NOT be dropped. (local.set $x (i32.const 1)) ) + (func $nested-catch1 + (local $x i32) + (try + (do + (throw $e (i32.const 0)) + ) + (catch $e + (drop (pop i32)) + ) + (catch $e2 + (try + (do + (throw $e (i32.const 0)) + ) + (catch $e + (drop (pop i32)) + ) + (catch $e2 + (local.set $x (i32.const 1)) + ) + ) + ) + ) + ;; This should NOT be dropped because the exception might not be caught by + ;; the inner catches, and the local.set above us may not have run, and + ;; other possible code paths do not even set the local. + (local.set $x (i32.const 1)) + ) + (func $nested-catch2 + (local $x i32) + (try + (do + (throw $e (i32.const 0)) + ) + (catch $e + (drop (pop i32)) + (local.set $x (i32.const 1)) + ) + (catch_all + (try + (do + (throw $e (i32.const 0)) + ) + (catch $e + (drop (pop i32)) + (local.set $x (i32.const 1)) + ) + (catch_all + (local.set $x (i32.const 1)) + ) + ) + ) + ) + ;; This should be dropped because the exception is guaranteed to be caught + ;; by one of the catches and it will set the local to 1. + (local.set $x (i32.const 1)) + ) ) |