Skip to content

fuse: pass through embedder import cabi-arena-realloc instead of trying to satisfy it #301

Description

@avrabe

Context

BYO-OS lean-MCU dissolve pipeline (gale#89):

gale app + kernel-primitive components
  → meld fuse --memory shared
  → loom → synth (native ELF, no memory.grow)

Grow-free components (forked wit-bindgen cabi-realloc-extern, pulseengine/wit-bindgen#4) route cabi_realloc to an embedder-provided env::__cabi_arena_realloc, satisfied at native link / synth dissolve — not by the component model.

What wasm-tools now produces (contract)

pulseengine/wasm-tools#2 adds component new --import-passthrough env::__cabi_arena_realloc, which emits a valid component carrying a world-root import:

world root {
  import cabi-arena-realloc: func(p0: u32, p1: u32, p2: u32, p3: u32) -> u32;
  export greet: func() -> string;
}

(extern name = kebab_case(core_field_name); __cabi_arena_realloccabi-arena-realloc. Internally it's canon lowered and wired to the core module's env::__cabi_arena_realloc.)

This import is embedder-provided — meant to survive down to synth, not be resolved during fusion.

Ask (meld)

When fusing components — especially fuse --memory shared (meld#298/#300) — recognize this embedder import and pass it through to the fused artifact unsatisfied:

  • do not error that the import is unresolved;
  • do not attempt to map it to a provider component in the fusion set;
  • preserve it (by extern name cabi-arena-realloc, or as the underlying env::__cabi_arena_realloc core import if meld emits a core module) so synth can bind it at dissolve (see synth#418).

Open question for us to settle across meld/synth/wasm-tools: how meld should mark "this is embedder-provided, leave it alone." Options: match on the well-known name cabi-arena-realloc, or introduce a dedicated namespaced interface (e.g. an embedder ABI interface) that wasm-tools emits instead of a bare world-root func. The wasm-tools fork currently emits the bare kebab name; happy to switch to a namespaced interface if meld prefers a non-name-matching signal.

Refs

pulseengine/wasm-tools#2, pulseengine/wit-bindgen#4, pulseengine/synth#418, meld#298, meld#300, gale#89.

Pulseengine fork pipeline only — nothing goes upstream to bytecodealliance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions