Skip to content

Commit f23227e

Browse files
committed
[MERGE #5889 @Cellule] WebAssembly fix tee_local behavior
Merge pull request #5889 from Cellule:users/micfer/tee-local tee_local should not throw when trying to set Unreachable, but it should always yield the type of the local its trying to set <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/microsoft/chakracore/5889) <!-- Reviewable:end -->
2 parents 6b2e1ef + 45c7a7f commit f23227e

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

lib/WasmReader/WasmByteCodeGenerator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,8 @@ EmitInfo WasmBytecodeGenerator::EmitSetLocal(bool tee)
921921
{
922922
if (info.type == WasmTypes::Any)
923923
{
924-
throw WasmCompilationException(_u("Can't tee_local unreachable values"));
924+
info.location = local.location;
925+
info.type = local.type;
925926
}
926927
return info;
927928
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
(43) testsuite/core/br.wast:387: assert_return($$.as-tee_local-value() == i32:1) failed. Unexpectedly threw: CompileError: function as-tee_local-value[39] at offset 1784/2165 (0x6f8/0x875): Can't tee_local unreachable values
2-
70/71 tests passed.
1+
71/71 tests passed.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
(49) testsuite/core/return.wast:285: assert_return($$.as-tee_local-value() == i32:1) failed. Unexpectedly threw: CompileError: function as-tee_local-value[45] at offset 1672/1839 (0x688/0x72f): Can't tee_local unreachable values
2-
66/67 tests passed.
1+
67/67 tests passed.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
(47) testsuite/core/unreachable.wast:275: assert_trap($$.as-tee_local-value()) failed. Unexpected error thrown: CompileError: function as-tee_local-value[43] at offset 1588/1711 (0x634/0x6af): Can't tee_local unreachable values
2-
61/62 tests passed.
1+
62/62 tests passed.

0 commit comments

Comments
 (0)