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.