Skip to content

docs: memo on wasmtime FACT reusability for Christof Petig#105

Merged
avrabe merged 1 commit intomainfrom
docs/wasmtime-fact-reusability
Apr 23, 2026
Merged

docs: memo on wasmtime FACT reusability for Christof Petig#105
avrabe merged 1 commit intomainfrom
docs/wasmtime-fact-reusability

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 22, 2026

Summary

Memo at `docs/wasmtime-fact-reusability.md` rethinking whether meld's `adapter/fact.rs` can be reused from wasmtime.

The original claim was "cannot be used from wasmtime." Christof Petig was rightly skeptical even after seeing our work. After rereading both code-bases (meld's fact.rs vs wasmtime-environ's `src/fact/`), the honest conclusion is:

  • "Cannot be dropped in as-is" is true — different type contexts, different output strategies, different index spaces.
  • "The emission logic is unshareable" is too strong. The pure emission core (transcoders, list copies, record lift/lower, helpers like `emit_checked_realloc`) IS shareable. About 1500 LOC of leaf functions could become a third crate that both `meld-core` and `wasmtime-environ` depend on.

Includes a side-by-side architectural comparison, the equivalent function table, and three options for sharing (third crate, meld imports wasmtime FACT, wasmtime imports meld). Recommends the third crate.

Bonus observation: the LS-A-7 audit we just landed (19 realloc sites missing overflow + null guards) is likely reproducible against wasmtime FACT — same emission pattern, same likely missing guards. Worth flagging upstream.

Test plan

  • No code changes — docs-only

🤖 Generated with Claude Code

Rethinks the claim that meld's fact.rs cannot be used from wasmtime.
The honest conclusion is "cannot be dropped in as-is" — much weaker
than "the emission logic is unshareable." The pure emission core
(transcoders, list copies, record lift/lower, helpers like
emit_checked_realloc) is shareable; ~1500 LOC could become a third
crate that both meld-core and wasmtime-environ depend on.

Also notes that LS-A-7 (the realloc overflow + null-check audit we
just landed across 19 sites) is likely reproducible on wasmtime FACT,
since both have the same emission pattern.

Drafted for Christof Petig as a starting point for a possible
collaboration discussion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit ec42130 into main Apr 23, 2026
4 checks passed
@avrabe avrabe deleted the docs/wasmtime-fact-reusability branch April 23, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant