Skip to content

Take better advantage of CoW/snapshots#437

Open
syntactically wants to merge 4 commits intomainfrom
lm/cow-wasm-work
Open

Take better advantage of CoW/snapshots#437
syntactically wants to merge 4 commits intomainfrom
lm/cow-wasm-work

Conversation

@syntactically
Copy link
Copy Markdown
Member

This should finally get the main benefits of the hyperlight core snapshot-focused CoW workflow into wasm.

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
When we are loading from a snapshot, we can get away with just a
restore and never going through a wasmtime load.

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
@syntactically syntactically added the kind/enhancement New feature or request label Mar 30, 2026
@danbugs danbugs requested a review from Copilot March 30, 2026 21:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to bring Hyperlight’s snapshot-driven copy-on-write (CoW) workflow into the Wasm path by deferring sandbox restores and enabling Wasmtime “memory image” support via VA remapping.

Changes:

  • Add needs_restore / restore_if_needed() to defer restoring the runtime snapshot until the next module load, reducing eager restore overhead.
  • Add WasmSandbox::load_from_snapshot() to create a loaded sandbox by restoring a snapshot taken from a LoadedWasmSandbox.
  • Implement Wasmtime memory image APIs by copying VA mappings and converting writable pages to CoW mappings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs Defers restore on unload via needs_restore, adds load_from_snapshot, and wires restore into some load paths.
src/hyperlight_wasm_runtime/src/platform.rs Implements Wasmtime memory image creation/mapping via page-table remaps and CoW conversion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…o restore

A few minor nits/documentation fixes/formatting fixes/cleanups

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Fixes to some barrier logic, along with some minor formatting nits

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants