Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

[test] Add tests for return_call(_indirect) in try #275

Merged
merged 6 commits into from
Apr 23, 2023

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Apr 21, 2023

This adds tests of return_call(_indirect)s within trys. Because this repo's interpreter doesn't have the tail call support, this requires #274 to be merged before merging. But currently even with #274 the
tests here don't run. When a return_call(_indirect) runs within a try, it errors out with

runtime crash: undefined frame

I think we need to fix the interpreter first before merging this.

Closes #249.

This adds tests of `return_call(_indirect)`s within `try`s. Because this
repo's interpreter doesn't have the tail call support, this requires
 WebAssembly#274 to be merged before merging. But currently even with WebAssembly#275 the
tests here don't run. When a `return_call(_indirect)` run within a
`try`, it errors out with
```
runtime crash: undefined frame
```
I think we need to fix the interpreter first before merging this.

Closes WebAssembly#249.
@aheejin aheejin force-pushed the return_call_tests branch from 0e7ccc5 to 2c722f7 Compare April 21, 2023 09:22
@thibaudmichaud
Copy link
Collaborator

I would also suggest adding a test that return_calls an import, and maybe one that return_calls a host function in the JS tests.

Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the crash is unsurprising and easily fixed, see my comment on #274.

aheejin added a commit that referenced this pull request Apr 23, 2023
This cherry-picks interpreter changes from
https://github.com/WebAssembly/tail-call to run spec tests that mix
`try`s with `return_call(_indirect)`s (#275). When tail-call is merged
to the main spec repo, we can revert this change and merge the upstream
spec.

This also adds missing handling for `ReturningInvoke` in the new
`Catch`/`Caught`/`Delegate` instructions in the evaluator.
@@ -31,4 +31,4 @@ jobs:
- name: Build interpreter
run: cd interpreter && opam exec make
- name: Run tests
run: cd interpreter && opam exec make JS=node ci
run: cd interpreter && opam exec make JS='node --experimental-wasm-return_call' ci
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary to make the interpreter tests pass, because we not only run them with ocaml but also with JS. I think we can revert this later once the tail call is merged to the main spec and is enabled without a flag.

@aheejin aheejin merged commit 36a364c into WebAssembly:main Apr 23, 2023
@aheejin aheejin deleted the return_call_tests branch April 23, 2023 10:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tail call + exception handling
3 participants