uce/spikes/wasm-phase0/README.md
2026-06-12 11:40:26 +00:00

31 lines
1.4 KiB
Markdown

# spikes/wasm-phase0 — WASM-PROPOSAL Phase 0 (toolchain & runtime spike)
Validates the dynamic-linking foundation for the WASM unit runtime:
wasi-sdk PIC side modules + a host loader linking a core module and a unit
module at runtime with shared memory/table. **Exit criterion passed; runtime
selected: Wasmtime.** See `FINDINGS.md` for results and `realunit-report.md`
for the real-generated-unit compile log.
Everything builds and runs **on k-uce** (toolchains under `/opt`, artifacts
under `/tmp/uce/wasm-phase0`):
```
bash spikes/wasm-phase0/build_modules.sh # core.wasm + unit.wasm (wasi-sdk)
bash spikes/wasm-phase0/build_loader.sh # loader (Wasmtime C API)
/tmp/uce/wasm-phase0/loader # expect: PHASE0 EXIT CRITERION: PASS
```
Files:
- `core.cpp` — core-module stand-in: owns memory/allocator/libc++, exports
everything; includes the guest-side GOT.func resolver pattern
- `unit.cpp` — unit stand-in: PIC, imports allocator/runtime, exercises GOT,
cross-module C++ objects, function pointers, lambdas
- `loader.cpp` — minimal runtime linker (standard wasm-c-api): dylink.0
parsing, base allocation, GOT resolution, init sequencing
- `wasm_inspect.py` — dumps imports/exports/dylink.0 of a module
- `FINDINGS.md` — toolchain pins, WAMR rejection evidence, flag recipe,
Phase 2/3 implications
- `realunit-report.md``collections.uce.cpp`/`hello.uce.cpp` compiled as
side modules (worker-agent log)