This change also cleans up the `wasi-test` generation a bit. It's
actually still really, really messy, but at least now it's split up
into easier to understand chunks.
There's still a lot of low-hanging fruit in terms of improving the
readibilty and maintainability of the code.
1289: Enable `DynamicFunc` for closures with captured environment. r=syrusakbary a=losfair
Previously we disabled `DynamicFunc` for any non-zero-sized closures to leave space for future changes. However this feature is critical for applications that needs to bring context with host functions, like integrations with dynamic lauguages. So it might be good to enable it.
A question left is: should we put this behind a feature flag or enable it by default?
@Hywan @syrusakbary
Co-authored-by: losfair <zhy20000919@hotmail.com>
1281: feat(interface-types) Rename `call` to `call-core`, and remove `call-export` r=syrusakbary a=Hywan
The latest standard removes `call-export` and has a single `call-core` instruction.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1262: Update to latest inkwell which adds context lifetime to basic blocks. r=nlewycky a=nlewycky
The latest inkwell adds lifetimes to basic blocks and also changes most APIs to pass them without reference.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
This also returns `None` for all accesses of zero sized types and
arrays of length 0. Because the array accesses have a non-inclusive
length, length of 0 is not valid. These checks prevent returning
empty slices that point just outside of memory bounds.
1264: feat(interface-types) Implement lifting and lowering instructions r=Hywan a=Hywan
For the moment, WIT defines [a bunch of lifting and lowering instructions](https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/instr.md). The encoders, the decoders and the AST support them, but we didn't have any instruction implementations for them. This PR implements the instructions for real.
To handle casting failure, I decided to use the `TryFrom` trait, instead of `as`, such as:
```rust
let x: i32 = 128;
let y: i8 = x.try_into().unwrap(); // fails
```
while:
```rust
let x: i32 = 128;
let y: i8 = x as _; // just overflows silently
```
Not all `*x` instructions aren't implement _yet_.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>