Skip to content

Commit 07f49d2

Browse files
committed
Fix incorrect local is set management for try tables
1 parent 3071dba commit 07f49d2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/shared-validator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,6 @@ Result SharedValidator::BeginTryTable(const Location& loc, Type sig_type) {
14221422
result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, &param_types,
14231423
&result_types);
14241424
result |= typechecker_.BeginTryTable(param_types);
1425-
SaveLocalRefs();
14261425
return result;
14271426
}
14281427

@@ -1448,6 +1447,7 @@ Result SharedValidator::EndTryTable(const Location& loc, Type sig_type) {
14481447
result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, &param_types,
14491448
&result_types);
14501449
result |= typechecker_.EndTryTable(param_types, result_types);
1450+
SaveLocalRefs();
14511451
return result;
14521452
}
14531453

test/regress/regress-2670.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
;; save/restore operations was missing for try tables
77

88
(module
9-
(func (local (ref func)))
9+
(tag $e0)
10+
11+
(func (local (ref func) (ref func) (ref func)))
1012
(func
13+
(local (ref func) (ref func))
1114
try_table
1215
end)
16+
(func
17+
(local (ref func))
18+
try_table (catch $e0 0) (catch_all 0)
19+
end)
1320
(func
1421
unreachable
1522
try_table
@@ -19,12 +26,19 @@
1926
(module
2027
(type $t0 (func))
2128
(func $f0 (type $t0)
22-
(local $l0 (ref func)))
29+
(local $l0 (ref func)) (local $l1 (ref func)) (local $l2 (ref func)))
2330
(func $f1 (type $t0)
31+
(local $l0 (ref func)) (local $l1 (ref func))
2432
(try_table $T0
2533
))
2634
(func $f2 (type $t0)
35+
(local $l0 (ref func))
36+
(try_table $T0
37+
(catch $e0 0 (;@0;))
38+
(catch_all 0 (;@0;))))
39+
(func $f3 (type $t0)
2740
(unreachable)
2841
(try_table $T0
29-
)))
42+
))
43+
(tag $e0 (type $t0)))
3044
;;; STDOUT ;;)

0 commit comments

Comments
 (0)