1229: Add clippy::missing_safety_doc lint to wasi, misc clean up r=MarkMcCaskey a=MarkMcCaskey
Part of #1219
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1222: feat(runtime-core) Simplify `WasmExternType` implementations with macros r=Hywan a=Hywan
Extracted from #1018.
This PR simplifies the code (understand, remove code duplication) of `WasmExternType` by using a macro.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1224: fix(runtime-core) Remove warnings r=Hywan a=Hywan
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1221: doc(interface-types) Add a `README.md` file r=MarkMcCaskey a=Hywan
Just a small `README.md`, so that users aren't totally loss.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Those are not necessary for the user. It's only internal
implementation, that must be public because it ends up in public
types, but the compiler infers everything automatically.
This patch adds a new field in `Func`: `signature`. It contains the
signature of the host function.
For non-polymorphic host functions, the signature is computed from the
`Args` and `Rets` implementation parameters at compile-time.
For polymorphic host functions though, to be fully dynamic, the
signature given to `new_polymorphic` is used in `Func` as the correct
signature.
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
1218: Enable clif verifier in debug mode, fix issue with verifier r=MarkMcCaskey a=MarkMcCaskey
Ensures we're using I32s to index into things that are indexed by I32s
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1209: Maybe improve safety of MemoryView Deref r=MarkMcCaskey a=MarkMcCaskey
Possibly slightly better... (effectively does exactly the same thing the same way):
Notably this code still violates the safety rules of its unsafe functions:
It violates rule 2 from https://doc.rust-lang.org/std/slice/fn.from_raw_parts_mut.html :
> The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime ’a. Both read and write accesses are forbidden.
Some comments in the stdlib indicate that casting between `Cell<T>` and `T` isn't something that's safe to do outside of the stdlib 🤷♂ .
Fundamentally, `MemoryView` is unsound. Our docs say that it does not have undefined behavior, but we don't properly justify that. I believe it relies very heavily on undefined behavior.
Looking for feedback here about what we can do. It seems like we'll have to break the public API to make a sound API... if we can decide on a sufficiently good one, we can deprecate the old one and roll out the new one to prevent user breakage.
We may need to use something like https://docs.rs/crossbeam/0.7.3/crossbeam/atomic/struct.AtomicCell.html or implement something like it.
Where I'm at in regards to memory access from the host is that it's not possible to make any kind of efficient API that is not entirely `unsafe`. Even given that, we need to figure out the bounds with which the `unsafe` functions can be used relatively safely. I think even if we marked our existing functions as `unsafe`, it's too complex to figure out whether or not you're using it correctly...
Bonus points if your solution works across multiple threads properly...
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1214: test(interface-types) Add `wasmer-interface-types` to `make check` r=MarkMcCaskey a=Hywan
Sequel of #787. Forgot to update the changelog, and to add `wasmer-interface-types` to `make check`.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1213: Fixed WASI isatty 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
Current WASI implementation returns a wrong response when libc `isatty` is used for `stdin`, `stdout` or `stderr`.
This PR fixes it.
<!--
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: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>