Implement --native flag for standalone executables
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.
This commit is contained in:
Generated
+1
@@ -1523,6 +1523,7 @@ dependencies = [
|
||||
"clap",
|
||||
"rustyline",
|
||||
"wafer-core",
|
||||
"wasmtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in New Issue
Block a user