-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement wasmer_module_serialize
and wasmer_module_deserialize
functions in runtime-c-api
#271
Conversation
This is required to be able to deserialize a serialized module in `runtime-c-api`.
`std::slice` is already imported. This patch then rewrites `::std::slice::` into `slice::`.
…tions. This patch implements 2 functions: 1. `wasmer_module_serialize`, and 2. `wasmer_module_deserialize`.
…ions. 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @lachlansneff please review the caching part of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
When the value goes out-of-scope, `drop` is called utomatically.
… type. 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.
…ction. 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`.
I've added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comments I made.
…s + length instead of `wasmer_byte_array`.
bors r+ |
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>
Canceled |
bors r+ |
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>
876: Bump structopt from 0.3.2 to 0.3.3 r=Hywan a=dependabot-preview[bot] Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.2 to 0.3.3. <details> <summary>Changelog</summary> *Sourced from [structopt's changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md).* > # v0.3.3 (2019-10-10) > > * Add `from_flag` custom parser to create flags from non-bool types. > Fixes [#185](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/185) </details> <details> <summary>Commits</summary> - [`2cb1fbf`](TeXitoi/structopt@2cb1fbf) v0.3.3 - [`fd2cc62`](TeXitoi/structopt@fd2cc62) Add from_flag parser ([#271](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/271)) - [`6a3fc8b`](TeXitoi/structopt@6a3fc8b) Run ui tests only on stable - [`8d86616`](TeXitoi/structopt@8d86616) Fix code formatting - [`cf61ff1`](TeXitoi/structopt@cf61ff1) Fix nightly tests - [`0c888e9`](TeXitoi/structopt@0c888e9) Fix clippy warnings - [`1cae9fa`](TeXitoi/structopt@1cae9fa) Suppress all clippy warnings - [`c228c23`](TeXitoi/structopt@c228c23) Fix version in docs (AGAIN) - See full diff in [compare view](TeXitoi/structopt@v0.3.2...v0.3.3) </details> <br /> [![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=structopt&package-manager=cargo&previous-version=0.3.2&new-version=0.3.3)](https://dependabot.com/compatibility-score.html?dependency-name=structopt&package-manager=cargo&previous-version=0.3.2&new-version=0.3.3) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) </details> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
This PR implements 5 new functions in the
runtime-c-api
crate:wasmer_module_serialize
to serialize a module into awasmer_serialized_module_t
type,wasmer_module_deserialize
to deserialize a serialized module,wasmer_serialized_module_bytes
to read the bytes in thewasmer_serialized_module_t
type into awasmer_byte_array
,wasmer_serialized_module_from_bytes
to transform awasmer_byte_array
into awasmer_serialized_module_t
,wasmer_serialized_module_destroy
to destroy awasmer_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 inruntime-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?