Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singlepass failed to find trap info for unreachable instruction #1523

Closed
nlewycky opened this issue Jul 17, 2020 · 2 comments
Closed

singlepass failed to find trap info for unreachable instruction #1523

nlewycky opened this issue Jul 17, 2020 · 2 comments
Labels
bug Something isn't working 📦 lib-compiler-singlepass About wasmer-compiler-singlepass
Milestone

Comments

@nlewycky
Copy link
Contributor

Describe the bug

When building with singlepass, wasmer panics when attempting to find information about the native instruction mapping to an unreachable in the wasm.

With cranelift and LLVM:

$ ~/wasmer-reborn/target/debug/wasmer run --cranelift ~/x.wat
error: failed to run `/home/nicholas/x.wat`
╰─> 1: RuntimeError: unreachable
           at <unnamed> (x.wat[0]:0x1a)
$ ~/wasmer-reborn/target/debug/wasmer run --llvm ~/x.wat
error: failed to run `/home/nicholas/x.wat`
╰─> 1: RuntimeError: unreachable
           at <unnamed> (x.wat[0]:0xffffffff)

With singlepass:

$ ~/wasmer-reborn/target/debug/wasmer run --singlepass ~/x.wat
thread 'main' panicked at 'failed to find instruction for 7f75aa0ae01e', lib/engine/src/trap/frame_info.rs:151:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Steps to reproduce

Here's x.wat:

(module
  (type (;0;) (func))
  (func (;0;) (type 0)
    unreachable)
  (start 0))

Run it with singlepass and engine-jit.

Expected behavior

A RuntimeError reporting the execution of an unreachable.

Actual behavior

A panic while looking up the trap info.

@syrusakbary
Copy link
Member

I've just tested this and it doesn't happen in master with macos.

$ make build-wasmer-debug
$ ./target/debug/wasmer run --singlepass x.wat
error: failed to run `x.wat`
│   1: RuntimeError: unreachable
╰─> 2: unreachable

bors bot added a commit that referenced this issue Dec 8, 2020
1870: Added basic AddressMap support for singlepass r=syrusakbary a=syrusakbary

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description

This PR should fix #1856 and #1523 by adding address maps with the locations related to the traps.

The PR makes the following command to pass (in debug mode):

```
cargo test --features "singlepass" --features "test-singlepass test-jit"
```

<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Syrus <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
@syrusakbary
Copy link
Member

This issue should be fixed on master. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-compiler-singlepass About wasmer-compiler-singlepass
Projects
None yet
Development

No branches or pull requests

4 participants