db6292add6
Add `wafer build --native` to produce self-contained native executables. The approach appends AOT-precompiled WASM and metadata to a copy of the wafer binary itself, requiring no Rust toolchain at build time. On startup, the binary checks for an appended payload (8-byte "WAFEREXE" magic trailer). If found, it deserializes the precompiled module and runs it directly, skipping CLI argument parsing entirely. Uses wasmtime's Engine::precompile_module() for AOT compilation at build time and Module::deserialize() at runtime — instant startup with no JIT. Binary layout: [wafer binary][precompiled wasm][metadata json][trailer] Trailer: payload_len(u64 LE) + metadata_len(u64 LE) + "WAFEREXE" Also refactored runner.rs: extracted shared run_module() to avoid duplication between run_wasm_bytes() and run_precompiled_bytes(). Made serialize_metadata() public for CLI use.
17 lines
402 B
TOML
17 lines
402 B
TOML
[package]
|
|
name = "wafer"
|
|
description = "WAFER: WebAssembly Forth Engine in Rust - CLI REPL and compiler"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
wafer-core = { path = "../core", version = "0.1.0" }
|
|
wasmtime = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
clap = { version = "4", features = ["derive"] }
|
|
rustyline = "15"
|