Skip to content

Consume pulseengine/wit-bindgen (cabi-realloc-extern): gale-owned arena instead of a per-component one #330

Description

@avrabe

Goal

Stop carrying a per-component allocator. cabi_realloc should delegate to gale's __cabi_arena_realloc via pulseengine/wit-bindgen's cabi-realloc-extern feature — one embedder-owned arena across the fused image, which is that fork's design (pulseengine/wit-bindgen#4) and gale's (gale#89).

Where we are

Why it's a migration, not a dependency swap

version rt crate
the fork (integration/embedded-rt-no-grow) wit-bindgen 0.58.0 no separate wit-bindgen-rtrt is a module inside wit-bindgen
relay's components wit-bindgen-rt 0.41.0 separate crate

So it's 0.41 → 0.58 plus a crate restructure, which pulls in cargo-component compatibility and regenerated bindings — on the flight path.

Open design question to settle first

With cabi-realloc-extern, __cabi_arena_realloc is embedder-provided. Does the published component then carry an unresolved import only gale satisfies? If so, the published artifact would no longer run standalone in wasmtime — which our tests/rate-loop-proof and any host-side composition test depend on.

Likely answer is two build modes (host build keeps the default allocator; gale build uses the extern arena), which is how the fork frames it — "it's a runtime-crate build mode". Needs verifying before we migrate, not after, because it decides what we publish to ghcr for jess to pull.

Acceptance

  • Determine whether cabi-realloc-extern yields an unresolved import; decide what the published artifact is
  • Migrate the component crates to the fork (0.58) and confirm bindings still generate under cargo-component
  • falcon-rate builds with no relay-side allocator, still a component, 0 WASI, 0 memory.grow
  • tests/rate-loop-proof still closes the loop (0.193 s, |err| 0.0059 rad/s baseline)
  • Remove the interim arena from wasm/cm/rate/src/lib.rs
  • Confirm with gale/meld that fuse --memory shared --address-rebase accepts the result — the actual kill-criterion in gale#89

Refs: pulseengine/wit-bindgen#4, gale#89, meld#299, jess#167.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions