Skip to content

fuse: drop vestigial cabi_realloc / canonical-ABI adapter once the inter-component boundary is internalized (unblocks --memory shared) #298

Description

@avrabe

Observation

After meld fuse of two components whose interface is fully resolved internally (app imports gale:kernel, host exports it → fused core has 0 remaining gale:kernel imports), the fused core still exports cabi_realloc (×2, one per input) and still contains memory.grow (×2):

(export "cabi_realloc" (func 13))
(export "cabi_realloc$1" (func 32))
memory.grow occurrences: 2

Those cabi_realloc functions (wit-bindgen canonical-ABI realloc, backed by Rust dlmalloc → sbrk → memory.grow) exist to marshal data across the component boundary — which fusion has just removed. They're vestigial. Because they're exports, loom can't DCE them, so the allocator + memory.grow survive.

Consequence

This is what blocks the lean MCU path: meld fuse --memory shared --address-rebase fails with "memory.grow not supported with address rebasing" — solely because of the dead canonical-ABI allocator. (The user's logic: meld fusion should make the per-component adapter unnecessary; right now it keeps it.)

Ask

When fusion internalizes the inter-component boundary and the remaining external surface is scalar/flat (no realloc-requiring lifts), meld should de-export / drop the now-internal cabi_realloc and canonical-ABI adapter functions (or mark them internal so loom DCEs them). Then dlmalloc/sbrk/memory.grow DCE away → --memory shared becomes viable → one lean single-address-space core for synth (target the wasm-dist 544 B class, not tens of KB).

Kill-criterion

"After meld fuse of an all-scalar-boundary component pair, cabi_realloc is still exported / memory.grow still present in the fused core" → not fixed.

Repro: crates/gale-app-demo/dissolve.sh on gale@feat/kiln-dissolve-libos. Relates: gale#89 (the gale-side tracking; the grow is NOT gale code — it's the canonical-ABI adapter meld should drop on fusion).

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