-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm-interp: Fix catch handlers' value stack sizes (#2478)
Fixes the value stack size of the catch handler. There were two (related) issues here: - The previous code used `func_->locals.size()` as soon as the function was available, but it hadn't processed the function's locals yet, so it was always empty. (This might not matter in practice, as it's only used by the "function-wide catch handler", which just rethrows.) - The previous code didn't take the function's locals into account when computing the value stack height (relative to the function frame) for a try-catch block. So, it would drop the locals when catching an exception. Closes #2476 (Split from #2470 )
- Loading branch information
Showing
2 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
;;; TOOL: run-interp-spec | ||
;;; ARGS*: --enable-exceptions | ||
;;; NOTE: ref: issue-2476 | ||
(module | ||
(tag $e0) | ||
(func (export "broken-local") (result i32) | ||
(local $value i32) | ||
(try $try | ||
(do | ||
(local.set $value (i32.const 1)) | ||
(throw $e0) | ||
) | ||
(catch $e0) | ||
) | ||
(local.get $value) | ||
) | ||
) | ||
|
||
(assert_return (invoke "broken-local") (i32.const 1)) | ||
(;; STDOUT ;;; | ||
2/2 tests passed. | ||
;;; STDOUT ;;) |