This test suite compiles a module, then serializes it, deserializes
it, and continues by creating an instance and calling a function on
it. It allows to test the entire roundtrip.
This patch updates the first argument of `wasmer_validate` from `*mut
uint8_t` to `*const uint8_t`. Indeed, the
`wasmer-runtime-core::validate` function doesn't expect a mutable
slice, so it's not required to expect a mutable array from C.
Also, it's likely for the Wasm bytes to be stored in the
`wasmer_byte_array` structure. The first field `bytes` is defined as
`*const uint8_t`. So this patch avoids a cast when writing a C++
program.
* fix(emscripten) Remove unused imports.
This patch removes unused imports reported by `rustc` as warnings.
* fix(emscripten) Allow unreachable patterns in `_clock_gettime`.
The compiler thinks `CLOCK_MONOTONIC_COARSE` is unreachable, which is
not always the case. Add an attribute to allow unreachable patterns to
remove the warning.
* fix(emscripten) Rename unused variables.
This patch renames various unused variables by appending an underscore
to them.
* fix(emscripten) Declare `table` as immutable.
The `table` variable in `EmscriptenGlobals::new` was declared as
mutable, but it's never mutated.
* fix(emscripten) Remove an unnecessary `unsafe` block.
* fix(emscripten) Remove duplicate definition of `SO_NOSIGPIPE`.
The `SO_NOSIGPIPE` constant is defined in `syscalls/mod.rs` and
`syscalls/unix.rs`. It's never used in the first case. We can safely
remove it in this file, and keep it in `unix.rs`.
* fix(emscripten) `read_string_from_wasm` is used only on Windows.
Mark `read_string_from_wasm` as possible deadcode, since it's used
only on Windows.
* fix(emscripten) Remove `DYNAMICTOP_PTR_DIFF`, `stacktop`, `stack_max`,
`dynamic_base` and `dynamic_ptr`.
Four functions and one constant are used together but never used
inside or outside this file. They are deadcode.
* fix(emscripten) Remove `infinity` and `nan` fields of `EmscriptenGlobalsData`.
Those fields are never used.
* fix(emscripten) Allow non snake case in `emscripten_target.rs`.
Many functions in this file don't follow the snake case style for Rust
function names. The reason is that we want the names to match the
emscripten symbol names; even if a mapping is done in `lib.rs`, it's
easier to get the same names.
* fix(emscripten) Rename `STATIC_TOP` to `static_top`.
This variable is not a constant.
263: fix(runtime-core) Remove unused imports r=Hywan a=Hywan
This patch removes unused imports as reported by `rustc` as warnings.
265: fix(clif-backend) Remove unused imports r=Hywan a=Hywan
This patch removes unused imports reported by `rustc` as warnings.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.
This is required to pass dynamic data to imported functions for
instance.
`imports` contains `func_import`, `global_import`, `memory_import` and
`table_import`, so 4 items. This patch updates the length of `imports`
when calling the `wasmer_instantiate` function.
* Add local_function field to context
* Add local call indirection to llvm
* local call indirection
* Fix vm test
* Fix cranelift local call indirection
* Fix unwinding on nightly
This patch ensures that all our examples and tests do not generate
warnings. In C, it can be catastrophic sometimes…
Also, be sure that the `cmake` command doesn't emit any warnings too.
When compiling `wasmer-runtime-c-api` as a dependency of another
crate, `rustc` emits this warning:
```
warning: The package `wasmer_runtime_c_api` provides no linkable
target. The compiler might raise an error while compiling
`foo`. Consider adding 'dylib' or 'rlib' to key `crate-type` in
`wasmer_runtime_c_api`'s Cargo.toml. This warning might turn into a
hard error in the future.
```
To solve this issue, the `rlib` type has been added to the
`crate-type` list.
This patch removes the `WASM_EMSCRIPTEN_GENERATE_C_API_HEADERS`
flag. Consequently, the C header files will be generated for each
build.
The `generate-c-api-headers` feature is also removed, since it becomes useless.
This patch changes the directory where the C header files are
generated, from `CARGO_MANIFEST_DIR` to `OUT_DIR`. The goal is: When
`wasm-runtime-c-api` is used as a dependency of another Rust project,
then the C header files are accessible in the `target/` directory
(i.e. the `OUT_DIR`).
Also, since `rustc` has a `--out-dir` directory, it increases the
flexibility of this approach: The user can generate the C header files
where she wants.
When requiring `wasmer-runtime-c-api`, I get the following conflicts:
```
error: failed to select a version for `serde_derive`.
... required by package `cbindgen v0.7.1`
... which is depended on by `wasmer-runtime-c-api v0.2.1`
... which is depended on by `foo v0.1.0 (/private/tmp/foo)`
versions that meet the requirements `= 1.0.58` are: 1.0.58
all possible versions conflict with previously selected packages.
previously selected package `serde_derive v1.0.89`
... which is depended on by `wasmer-runtime-core v0.2.1`
... which is depended on by `wasmer-runtime-c-api v0.2.1`
... which is depended on by `foo v0.1.0 (/private/tmp/foo)`
failed to select a version for `serde_derive` which could resolve this conflict
```
This issue resolves by updating `cbindgen` to 0.8.
This patch cleans several warnings where mutable bindings are declared
but used only as immutable bindings.
It's a little bit opinionated patch. I think it's interesting to use
`const` pointers as much as possible.
This patch removes `unsafe { … }` blocks inside `unsafe` functions.
This patch also removes some warnings about camel case. All structures
with a C representation are automatically not mangle, and allow non
camel case.
* Change RuntimeError type and fix codebase to use it
* Fix spectests to work with new runtime error type
* Fix windows signal handler in the clif-backend
* Add missing conversion
* final windows fix
The supporting framework around LLVM will make sure to only compute values once if they
are known to never change. Previously, these values were attempted to be reused from places where
the users may not dominate the creation of the value. To avoid that, they are always created
in the entry block now.