Bug 1847239 - wasm: Reset non-nullable local state when using delegate to end try. r=jseward

A try block can end with 'delegate' instead of 'end'. We need to unset the nnl state
the same way in both.

Differential Revision: https://phabricator.services.mozilla.com/D185439
This commit is contained in:
Ryan Hunt 2023-08-29 17:50:41 +00:00
parent 00b18fa30a
commit 5c5632a208
2 changed files with 5 additions and 0 deletions

View file

@ -10,6 +10,7 @@ const KINDS = [
"loop", "loop",
"try", "try",
"catch", "catch",
"delegate",
"if", "if",
"else", "else",
] ]
@ -41,6 +42,9 @@ function generateBlock(kind, contents) {
case "catch": { case "catch": {
return `try\ncatch_all\n${contents}end\n` return `try\ncatch_all\n${contents}end\n`
} }
case "delegate": {
return `try\n${contents}\ndelegate 0\n`
}
case "if": { case "if": {
return `i32.const 0\nif\n${contents}end\n` return `i32.const 0\nif\n${contents}end\n`
} }

View file

@ -1724,6 +1724,7 @@ inline void OpIter<Policy>::popDelegate() {
MOZ_ASSERT(Classify(op_) == OpKind::Delegate); MOZ_ASSERT(Classify(op_) == OpKind::Delegate);
controlStack_.popBack(); controlStack_.popBack();
unsetLocals_.resetToBlock(controlStack_.length());
} }
template <typename Policy> template <typename Policy>