Repository navigation
Feat/wasm frontend - #1
Merged
Merged
Conversation
scribbler owns the WebAssembly binary and text formats: it decodes a .wasm,
validates it, canonicalises and lowers it into carder's IR, and stops there.
carder (scarletindustries/carder) owns everything from the IR down — the
policy pass, the optimizer, Core Erlang codegen, linking, the BEAM runtime and
the run ABI — and is consumed here as an ordinary Gleam package dependency.
This is the same shape as the arc JavaScript frontend's relationship to
carder: a frontend produces carder IR, carder turns that IR into a running
BEAM module. No wasm code remains in carder, and no backend code lives here.
What moved in:
- src/scribbler/wasm/{ast,canon,decode,validate,lower,wat} — the frontend
- src/scribbler/pipeline — the wasm-entry driver plus WasmError, whose
Backend variant wraps carder's PipelineError and whose describe/1
delegates to carder's, so a diagnostic reads byte-identically to before
- src/scribbler — the CLI: decode / validate / to-ir|lower|ir / to-core /
run / build|to-beam (was to-beam-wasm) / exec / help
- src/scribbler/embed — the wasm-bytes front door over carder/embed.compile_ir
- src/scribbler/host/{spectest,teavm} and src/scribbler/porffor/* — the
wasm-producer host runtimes, re-homed as carder link.Provider.Namespace
values. carder hard-codes no host module by name any more, so a harness
must now PASS spectest.provider() rather than inherit it ambiently.
- the full WebAssembly spec-test suite, smoke/, scripts/, and the wasm
surface docs
The CLI imports carder/cli for every posture flag and splices cli.axes_usage()
into its own help text, so the two binaries can never drift on what --unsafe,
--tier or --cap mean, and resolve_binding — the fail-closed Binding -> Instance
gate — has exactly one implementation.
Verified against the pre-split tree:
- 717 tests pass; gleam build --warnings-as-errors and gleam format clean
- conformance 47,736 pass / 681 skip / 0 fail, Safe and Unsafe identical.
That is +2 pass / -2 skip against the pre-split Safe baseline of
47,734/683/0, and the gain is accounted for exactly: the two return_call
asserts that tail-call into spectest.print* used to be SKIPPED under Safe
because carder resolved spectest through the deny-all HostPolicy. They now
resolve through this repo's Namespace provider and execute — matching what
the pre-split Unsafe run (47,736/681/0) already proved. Nothing weakened.
- cross-repo byte identity over the whole 32-program corpus: the .beam from
`scribbler build <x>.wasm` is byte-identical to the .beam from
`carder to-beam <x>.ir` for all 32, differ=0 errors=0 — so the extraction
changed no compiler output.
NOTE: the carder dependency points at github main. It resolves once carder's
feat/extract-wasm-frontend branch lands there; until then build with a local
path dep (see the comment in gleam.toml). manifest.toml is gitignored for now
and should be committed as soon as `gleam deps download` can record the
resolved carder SHA — that pin is what makes CI reproducible.
Points the carder dependency at the extraction branch on GitHub and commits
the lockfile, so a fresh clone and CI both build without a sibling checkout.
The ref is intent; manifest.toml is the pin — it records the resolved commit
faf5b849 ("Extract the WebAssembly frontend into the scribbler repo"), which
is what actually gets built. When the split lands on carder's main, change
`ref` to "main" and re-run `gleam deps download`; the pin moves, nothing else.
Verified against the git dependency rather than the local path dep:
gleam build --warnings-as-errors clean, 717 tests pass, conformance
47,736 / 681 / 0, and `run add.wasm add 3 5` prints 8.
The extraction merged as carder 4d437d8, so the dependency no longer needs to follow the feature branch. `ref` becomes "main"; the lockfile moves from faf5b849 (the branch tip) to 4d437d8 (the merge commit) — same tree, and the lockfile is what a fresh clone and CI actually build. Re-verified against carder main rather than assuming the merge was a no-op: gleam build --warnings-as-errors clean, gleam format clean, 717 tests pass, conformance 47,736 / 681 / 0 on both Safe and Unsafe, and `run add.wasm add 3 5` prints 8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.