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>
1272: Fix WasmPtr to work with accesses accessing the final valid byte r=MarkMcCaskey a=MarkMcCaskey
Resolves#1258
The fix was to change `>=` into `>`. Doing this made us vulnerable to accessing memory to create an empty slice just out of bounds so we have to add some additional checks to make sure that that can't happen.
This PR also prevents accessing arrays of length 0 (the length bound is non-inclusive, so length 0 is never valid) and prevents access of zero-sized types.
The zero-sized type checks will probably be inlined (or will be in the future as `const fn` gets more mature) so provide no additional overhead. The checking of if length == 0 does add some overhead, but on modern CPUs it shouldn't be an issue as it's a branch that should be always false in normal use.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@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.
1268: Prepare for 0.15.0 release r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1267: Improve support for preopened directories in WASI syscalls r=MarkMcCaskey a=MarkMcCaskey
Ported over from #1263
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
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>
1265: Improve `WasmPtr` documentation r=MarkMcCaskey a=MarkMcCaskey
This came up multiple times when responding to people on our issue tracker.
Adds an example and a lot more information about `WasmPtr` and `ValueType`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1217: Polymorphic host functions based on dynamic trampoline generation. r=losfair a=losfair
This PR implements polymorphic host functions by dynamically generating the "glue" code that translates platform arguments to an array in `runtime-core`.
TODO:
- ~~Multiple return values.~~ Deferring to a future multivalue PR.
- [x] Dynamic signatures for polymorphic functions.
- [x] Use a proper executable memory allocator.
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>