just
just copied to clipboard
PR: lib/snapshot.js (create, load, modify)
This is a Tracking issue for the JustJS Implementation of the Stealify Snapshot driven Component System implemented via the b8g tooling. A WASI & WASM drop in Replacement fully Capability based and Compose able with external References support and sharedArrayBuffers ffi and dlopen everything that you expect.
Related deno/rust integration:
- https://github.com/denoland/deno/issues/1877
Related stealify snapshot tooling written in ECMAScript
- https://github.com/stealify/b8g/blob/main/README.md b8g stands for "big engine" while this at present refers to v8 it works directly with GraalVM also or any other ECMAScript Runtime.
Why?
The internal snapshot format which is in general a serialized hash table is use able as wasi wasm replacement
It implements a binary format that is able to handle any type so it is a better fit for backend development while it is still able to be used in browsers.
Impl Roadmap
- [ ] use v8/src/snapshots/* as justjs module implement a loader
- [ ] port the functions from the snapshot tests to build multiple snapshots and modify them
Snapshot blob layout:
// [0] number of contexts N
// [1] rehashability
// [2] checksum
// [3] (128 bytes) version string
// [4] offset to readonly
// [5] offset to context 0
// [6] offset to context 1
// ...
// ... offset to context N - 1
// ... startup snapshot data
// ... read-only snapshot data
// ... context 0 snapshot data
// ... context 1 snapshot data