1054: Improve wasmer invoke function 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
Prior to this PR, when executing wasmer, we will have this in the stdout:
```bash
➜ wasmer fib32.wasm --invoke fib 30
main() returned: [I32(832040)]
```
Note that it says `main()` returned even if the function called is `fib`.
This PR fixes this and improves the messaging also for WASI invoked functions
<!--
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 Akbary <me@syrusakbary.com>
1053: For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>. r=syrusakbary a=nlewycky
# Description
For RuntimeError and breakpoints, use Box<Any + Send> instead of Box\<Any\>.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Fixes#1049
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1052: Fix issue #1051 + replace assert, unreachable in singlepass codegen code r=syrusakbary a=pventuzelo
# Description
This pull request:
- fix the issue #1051
- replace `asserts` by Errors
- replace `unreachable!` by Errors
- Improve Error handling in singlepass codegen code
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
1050: feat(github) Attach C & C++ headers to releases r=syrusakbary a=Hywan
This patch copies the generated C and C++ headers of `wasmer-runtime-c-api` in the `artifacts` directory, so that they are attached to releases as assets.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1042: Make regression test work in release builds too. r=nlewycky a=nlewycky
Fix this regression test to detect the bug it was looking for in release builds too.
This bug triggered an assertion failure in debug, and by examining the pre-opt IR, we can check for the bug in release mode too.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
709: new feature flag: `deterministic` r=MarkMcCaskey a=YaronWittenstein
The motivation for the PR is for introducing a new feature flag called `deterministic`.
When `deterministic` will be enabled (turned-off by default) it'll guarantee deterministic
execution of wasm programs across different hardware/circumstances.
This is critical for Blockchain projects that require execution to be deterministic
in order to reach a consensus of the state transition of each smart-contract transaction.
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Yaron Wittenstein <yaronwittenstein@users.noreply.github.com>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1033: Improve default compiler story for wasmer cli r=MarkMcCaskey a=MarkMcCaskey
This PR needs the following to be ready to ship:
- [x] Verified make commands are still fine
- [x] Verified this doesn't do anything bad in CI
This PR adds:
- compile_error if no backend is specified in wasmer.rs
- readds clif as the default
- improves the error message saying "specified backend not found" to include the name of the backend that it couldn't find
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
1036: Add experimental invoke support to WASI in wasmer cli r=MarkMcCaskey a=MarkMcCaskey
Resolves#1024
This PR also does a bit of code clean up
# 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>
1030: feat(runtime-c-api) Ability to generate `ImportObject` for a specific WASI version r=Hywan a=Hywan
❗️⚠️ Contains #1028, must be merged before this one.
This patch introduces 2 new functions:
* `wasmer_wasi_generate_import_object_for_version` and
* `wasmer_wasi_get_version`.
It mimics the current API provided by `wasmer_wasi`, nothing fancy
here. It's just a regular port to C/C++.
Because `wasmer_wasi::get_wasi_version` returns an option, and in
order to simplify the C/C++ API, `wasmer_wasi_get_version` can return
`Version::Unknown` in case of an error. It's up to the user to check
the version is valid (i.e. not unknown).
To see only the changes provided by this PR (excluding #1028), check https://github.com/Hywan/wasmer/compare/fix-wasi-get-version...feat-runtime-c-api-wasi-version.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1028: feat(wasi) Introduce strict/non-strict modes for `get_wasi_version` r=Hywan a=Hywan
Sequel of https://github.com/wasmerio/wasmer/pull/957.
If a module has multiple import namespaces, `get_wasi_version` is
broken because it assumes a module must only have a single namespace.
This patch updates `get_wasi_version` to introduce a `strict` flag:
* In strict mode, the previous behavior applies; only one namespace is expected to be found, and this namespace must be a WASI namespace to detect the version,
* In non-strict mode, at least one WASI namespace must be declared, and the first one is used to detect the version if any.
The non-strict mode is slower because it compares namespace strings.
2 new private constants have been declared: `SNAPSHOT0_NAMESPACE` and `SNAPSHOT1_NAMESPACE` to avoid repetition and bugs.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1040: Add the ability to pass backend specific options through CompilerConfig. r=nlewycky a=nlewycky
# Description
Add the ability to pass backend specific options through CompilerConfig.
Use this to replace wasmer_llvm_backend::GLOBAL_OPTIONS.
This adds a new item to CompilerConfig which can be any struct defined by a backend for backend specific configuration options. So far, we only implement the options that were previously in GLOBAL_OPTIONS, these move to wasmer.rs. The plan is to use these same callbacks for testing in llvm-backend-tests.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>