-
-
Notifications
You must be signed in to change notification settings - Fork 0
[#446 Tier 1 #5 follow-up] Zig FFI implementation for wasm_export_call dispatch #497
Copy link
Copy link
Open
Labels
bindingsABI, FFI, WASM, and cross-language interop surfacesABI, FFI, WASM, and cross-language interop surfacesfeeds:valence-shellFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes thereFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes therepriority:p2Normal - queue itNormal - queue itscope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked uptier-1AS bindings top-50 Tier 1 (idaptik blockers)AS bindings top-50 Tier 1 (idaptik blockers)
Description
Activity
Metadata
Metadata
Assignees
Labels
bindingsABI, FFI, WASM, and cross-language interop surfacesABI, FFI, WASM, and cross-language interop surfacesfeeds:valence-shellFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes thereFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes therepriority:p2Normal - queue itNormal - queue itscope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked uptier-1AS bindings top-50 Tier 1 (idaptik blockers)AS bindings top-50 Tier 1 (idaptik blockers)
Context
Closed #455 (the WASM-exports calling pattern kickoff) shipped via PR #467 with the Deno-ESM backend lowering:
wasm_export_call(exports, name, args)+WasmValueopaque type + JS-side dispatch (__as_wasm_export_call).Per the owner's Option-B scope breakdown, the Zig-side dispatch was deferred to a follow-up:
This issue tracks that.
Scope
The Zig-side counterpart to the Deno-ESM lowering. When
wasm_export_callis invoked from an AffineScript program targeting the linear-memory WebAssembly backend (i.e. anywhere outside the Deno-ESM host), the host must supply awasm_export_callsymbol under theenvimport — and that symbol should be implementable in a canonical Zig crate so any embedder can pick it up.What to ship
tools/, or scaffolded as ahpm-wasm-export-rsrsibling — owner's choice) exporting anextern "C" fn wasm_export_call(exports_handle: *anyopaque, name_ptr: [*]const u8, name_len: usize, args_ptr: [*]const WasmValueRepr, args_len: usize) -> WasmValueRepr(or matching ABI).WasmValueRepr↔ the tagged scalar (i32/i64/f32/f64).WebAssembly.Instance.exports-like handle.docs/specs/zig-ffi-patterns.adoc) showing how to wire this Zig dispatcher into a wasm-host configuration.Acceptance
.wasm(or a host-linkable.so) that satisfies theenv.wasm_export_callimport contract.STDLIB-EXTERN-AUDIT.adocrow forwasm_export_callupdated to flag the Zig host as available.Refs
docs/specs/zig-ffi-patterns.adoc(general pattern doc)This is the FFI implementation half; the Idris2-ABI proof-carrier doc is a separate follow-up under the "Idris2 = ABIs" directive.