284: fix make debug-release r=MarkMcCaskey a=MarkMcCaskey
My guess without looking in to the history is that:
- the unsafe block was around the `debug!` call
- when debug was off, it was giving a warning because the unsafe block was empty
- the unsafe was removed to stop the warning
- it wasn't tested with the debug flag
This PR also
- cleans up the Makefile
- adds debug-release to CI
Co-authored-by: Mark McCaskey <mark@wasmer.io>
271: feat: Implement `wasmer_module_serialize` and `wasmer_module_deserialize` functions in `runtime-c-api` r=Hywan a=Hywan
This PR implements 5 new functions in the `runtime-c-api` crate:
1. `wasmer_module_serialize` to serialize a module into a `wasmer_serialized_module_t` type,
2. `wasmer_module_deserialize` to deserialize a serialized module,
3. `wasmer_serialized_module_bytes` to read the bytes in the `wasmer_serialized_module_t` type into a `wasmer_byte_array`,
4. `wasmer_serialized_module_from_bytes` to transform a `wasmer_byte_array` into a `wasmer_serialized_module_t`,
4. `wasmer_serialized_module_destroy` to destroy a `wasmer_serialized_module_t`.
Documentation and a test suite have been added.
We need to change the visibility of the `wasmer_runtime::default_compiler` function to public, since it is used in `runtime-c-api`.
The new test suite `test-module-serialize` does a full roundtrip: A module is compiled, then serialized, then deserialized, to finally be instantiated and a function is called on it.
Thoughts?
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
280: feat(runtime-c-api) Mirrors the `debug` and `llvm` features r=Hywan a=Hywan
`wasmer-runtime` has a `debug` and a `llvm` feature. Let's mirror
them in `wasmer-runtime-c-api` so that the user can, for instance,
compile with the LLVM backend.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
`wasmer-runtime` has a `debug` and a `llvm` features. Let's mirror
them in `wasmer-runtime-c-api` so that the user can, for instance,
compile with the LLVM backend.
This function is required to transform a `wasmer_byte_array` into a
`wasmer_serialized_module_t`. This is the complementary function of
`wasmer_serialized_module_bytes`.
The `wasmer_module_serialize` function now computes a
`wasmer_serialized_module_t` value. The `wasmer_module_deserialize`
function takes this value as an input. Same for
`wasmer_serialized_module_destroy`.
The new function `wasmer_serialized_module_bytes` allows to read the
bytes inside the `wasmer_serialized_mdule_t` structure.
264: fix(runtime-core) `SharedMemory.desc` is never used, remove it r=xmclark a=Hywan
This patch removes the `desc` field of `SharedMemory`. This field is
never used. Maybe it will be used in the future when the
implementations will be written, but so far, it only generates
warnings.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
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.
270: feat(runtime-c-api) `wasmer_validate` expects a `*const uint8_t` r=Hywan a=Hywan
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.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>