Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Jul 24, 2025

Bumps hyperlight dependency. Reworks uses of MultiuseSandboxContext to use snapshots instead.

Memory is no longer restored after a call to LoadedWasmSandbox::call_guest_function which revealed that memory is leaked during mashalling, and a missing post_call after calling a wasmtime func. In addition, a Store and wasm Instance are no longer created per guest function call. Rather, it's being created once and reused.

Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

Good work updating hyperlight-wasm to use the new snapshoting API.
I left a couple of comments/questions. Let me know what you think.

@ludfjig ludfjig force-pushed the bump_snapshot branch 7 times, most recently from 1540b2a to d2de1b9 Compare July 25, 2025 03:51
@ludfjig ludfjig force-pushed the bump_snapshot branch 3 times, most recently from e9931f9 to fa04ec0 Compare July 28, 2025 18:09
syntactically
syntactically previously approved these changes Aug 5, 2025
Replace transition-based sandbox evolution with direct snapshot/restore API:

- Remove EvolvableSandbox/DevolvableSandbox trait usage
- Replace transition callbacks with direct method calls
- Add snapshot/restore methods to LoadedWasmSandbox
- Store initial snapshots in WasmSandbox for efficient unloading
- Export Snapshot type in public API

This provides more direct control over sandbox state management
and enables features like checkpoint/restore.

Signed-off-by: Ludvig Liljenberg <[email protected]>
- Reuse wasmtime Store and Instance across guest function calls instead
  of creating new one per call.
- Establish memory contract between host and guest.
 - Guest functions takes ownership of input parameters
 - Guest transfer ownership of return values
 - Host functions parameters are borrowed from guest
 - Host function return values are owned by guest and guest must free them.
- Component: Add post_return calls for proper WASM function cleanup
- Fix ABI mismatch in parameter of guest_dispatch_function

Signed-off-by: Ludvig Liljenberg <[email protected]>
...and so "build" recipe doens't build runtime. Seeems to fix some local build issues

Signed-off-by: Ludvig Liljenberg <[email protected]>
Copy link
Contributor

@simongdavies simongdavies left a comment

Choose a reason for hiding this comment

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

One question but otherwise LGTM

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.

7 participants