feat(298): drop vestigial cabi_realloc + defer dead memory.grow (unblocks --memory shared --address-rebase) - #345
Conversation
Mythos discover pass — done, two findings fixed in this PRAdversarial pass on the export-drop + grow-defer wiring. Cleared: gating (defer flag only consulted under FINDING 1 (HIGH) — fixed. The FINDING 2 (LOW) — fixed. 11 new |
Mythos delta-pass requiredThis PR modifies one or more Tier-5 source files (per Before merge, run the Mythos discover protocol on the
Why this gate exists: LS-A-10 The gate check on this PR will pass once the label is |
LS-N verification gate✅ 59/59 approved LS entries verified
Approved Failed LS entries(none) Missing regression tests(none) Updated automatically by |
Mythos delta-pass (auto)❌ 1 finding(s) across 1 Tier-5 file(s)
Auto-run via |
…ised Plan for #298 (v0.41.0): when cabi_realloc_drop_provably_safe (core output, no adapters, all lifts scalar — already computed, INERT), wire the drop: remove the cabi_realloc* exports (allocator DCEs downstream) + defer the now-dead memory.grow under rebasing (IndexMaps::defer_grow_under_rebase), unblocking the lean --memory shared --address-rebase MCU fuse. Conservatism is load-bearing (over-drop = silent marshalling corruption). derives-from SYS-8, mitigates LS-D-3. rivet validate PASS. Refs #298, #299, SR-50. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire the (previously INERT) cabi_realloc_drop_provably_safe verdict: when a component boundary is fully internalised (core output, no adapters, all lifts scalar) AND address rebasing is on AND the allocator is provably dead, meld drops the cabi_realloc* exports (allocator DCEs downstream) and defers the dead memory.grow to `unreachable`, unblocking the lean --memory shared --address-rebase MCU fuse (SR-50). All other paths byte-identical. Mythos discover pass (this branch) found + fixed two findings: - FINDING 1 (HIGH): module-wide grow-defer was unsound — the boundary verdict proves no *marshalling* realloc is needed, NOT that the allocator is dead. A scalar-interface component that allocates internally (Vec/String -> dlmalloc -> sbrk -> memory.grow, reachable from a live export) would fuse-Ok then TRAP at runtime (a compile error silently downgraded to a trap). FIX: new memory_probe::module_has_reachable_memory_grow — a call-graph reachability probe (roots = exports except the dropped cabi_realloc*, start, ref.func/elem targets; edges = call/return_call; fail-safe true on parse error) ANDed into the gate via allocator_grow_is_dead(). Now only fires when NO memory.grow is reachable from a live non-cabi_realloc root; a live internal grow keeps cabi_realloc and preserves the clean hard-error. - FINDING 2 (LOW): tightened the export match to cabi_realloc or cabi_realloc$ + non-empty ASCII digits (was starts_with, which could drop a lookalike). Verdict conservatism preserved (fail-safe false/keep on any uncertainty; the new gate only ever PREVENTS a drop). Detection: exports named cabi_realloc / cabi_realloc$<digits>. Export removal only (loom DCEs the dead code). 467 lib + 7 drop_realloc integration tests green (incl. live_internal_grow_keeps_realloc_and_hard_errors, tight_match_preserves_realloc_lookalike_export, and 11 memory_probe unit tests); clippy + fmt clean. Refs #298, #299, SR-50, SYS-8, LS-D-3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a8a8ef2 to
f01f266
Compare
Wires the previously-INERT
cabi_realloc_drop_provably_safeverdict so a fully-internalised boundary drops its dead allocator — removing the last dead artifact that blocked the lean single-address-space MCU fuse (SR-50, the #326→#334→#298 MCU-dissolve arc).What it does
When the boundary is provably vestigial (core output, no adapters, all lifts scalar) AND
address_rebasingis on AND the allocator is provably dead, meld drops thecabi_realloc*exports (allocator DCEs downstream) and defers the deadmemory.growtounreachable— so--memory shared --address-rebase(which otherwise hard-errors onmemory.grow) succeeds. Every other path is byte-identical.Mythos discover pass — 2 findings, both fixed on this branch
Vec/String→dlmalloc→sbrk→memory.grow, reachable from a live export) would fuse-Ok then trap at runtime (a compile error silently downgraded to a trap). Fix: a call-graph reachability probe (memory_probe::module_has_reachable_memory_grow— roots = live exports minus the droppedcabi_realloc*,start,ref.func/elem targets; edges =call/return_call; fail-safe on parse error) ANDed into the gate. Now only fires when nomemory.growis reachable from a live non-cabi_reallocroot; a live internal grow keepscabi_reallocand the clean hard-error.cabi_realloc/cabi_realloc$<digits>(wasstarts_with, which could drop a lookalike export).Tests (467 lib + 7 integration green; clippy + fmt clean)
scalar_boundary_drops_realloc_and_defers_grow(positive),live_internal_grow_keeps_realloc_and_hard_errors(FINDING 1),tight_match_preserves_realloc_lookalike_export(FINDING 2), 3 verdict-branch negatives (string lift / component output / adapter site all keep realloc + hard-error), non-shared guard, + 11memory_probeunit tests (transitive dlmalloc/sbrk reachability live vs dead, elem/start roots, malformed fail-safe).Falsification
If the reachability gate regressed,
live_internal_grow_keeps_realloc_and_hard_errors(fuses-Ok-then-would-trap) fails. If the drop misfired, a verdict-branch negative fails. If the match broadened,tight_match_preserves_realloc_lookalike_exportfails.Refs #298, #299, SR-50, SYS-8, LS-D-3.
🤖 Generated with Claude Code