Skip to content

Artifact rkyv#16

Merged
camilbancioiu merged 22 commits into
masterfrom
artifact-rkyv
Feb 22, 2022
Merged

Artifact rkyv#16
camilbancioiu merged 22 commits into
masterfrom
artifact-rkyv

Conversation

@camilbancioiu
Copy link
Copy Markdown

@camilbancioiu camilbancioiu commented Jan 14, 2022

This PR adds Rkyv serialization support for wasmer_runtime_core::cache::Artifact, the structure produced by serializing an instance. Rkyv allows for much more efficient deserialization.

By default, Wasmer starts with Rkyv disabled (see wasmer_singlepass_backend::USE_RKYV_SERIALIZATION). It can be turned on and off using the C API methods wasmer_instance_enable_rkyv() and wasmer_instance_disable_rkyv().

The changes are mostly concerned with adding the proper derive macros to the relevant structs and enums, and also with switching between Rkyv serialization and the legacy serde.

A special case is wasmer_runtime_core::sys::ArchivableMemory, which is a custom wrapper for the Memory of an instance (defined in the same crate). Normally, Memory cannot be archived, because it holds a reference to an actual memory page requested from the kernel using mmap(). But the ArchivableMemory wrapper provides an intermediate step, copying the contents of the memory pages into a CompactMemory struct, which is easily serialized by Rkyv.

@camilbancioiu camilbancioiu marked this pull request as ready for review February 9, 2022 18:18
Comment thread Cargo.lock
# It is not intended for manual editing.
version = 3

[[package]]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo.lock should probably be gitignored entirely

@camilbancioiu camilbancioiu merged commit c3bc0d1 into master Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants