[Feature] purwc: a single module compilation worker - purs-wasm orchestrate mode and nix-style cache store - #46
Merged
Merged
Conversation
… binaryen init accross modules
…und Control.Lazy.fix
….json) in the purs-wasm store
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.
What's in this PR
Separated compilation — ADR 0038
cli-lib: common CLI machinery extracted frompurs-wasm/ulib-toolinginto a shared package.purwc: a standalone single-module worker. It compiles one module from its source and its dependencies'.pmiinterfaces into three artifacts —{M}.pmi(the dependent-facing interface + optimization summary),{M}.wasm(the object), and{M}.link.json(link metadata). The.pmiis now a complete interface (no.pmoneeded by dependents).compile-batch: a long-lived worker mode that compiles a topo-ordered work-list in one process, amortizing Binaryen init across modules.purs-wasm build --orchestratedrivespurwcper module (in dependency order) and links the results.Content-addressed library store — ADR 0040
nix-style source/toolchain tag hashing, and a recursive.pmikey — a module is keyed against its dependencies'.pmikeys (content-address), not their summary hashes..watis merged into{M}.wasm, so a worker artifact is self-contained.caf_initreachability ([Feature] Monomorphization (unbox polymorphic container elements) #19): per-binding reference graph emitted by the worker; the orchestrator chainscaf_initonly for entry-reachable modules.$PURS_WASM_STOREholds the{.pmi, .wasm, .link.json}triplet per library module, keyed by content. Write-back is partitioned by own vs library — a.spagodependency or a ulib shadow goes to the global store (shared across builds and projects), the project's own modules stay in the local_build. store; reuse is content-addressed and sound (version drift → key mismatch → recompile).prewarm(optional): precompile a package set's library closure into the store..pmoretired (P6): the.pmiinterface + the.wasmobject are the artifacts; the separate optimized-MIR object is gone. The in-process whole-program path stays as an uncached differential oracle.Fixes
Lower: a non-functional recursive value aroundControl.Lazy.fixwas mis-handled.purs-wasmexplicitly (it had relied onulib-toolingtransitively pulling it in, which no longer holds since the maintainer CLI was decoupled from the orchestrator).Cleanup & docs
ulib install) and ADR 0042 (orchestrate as the default build; trigger-based retirement of the whole-program oracle) capture the agreed next direction (Proposed).Checklist
CI passing is enforced by the required
ci-gatestatus check, not by a box here.The items below are the human-judgment gates:
docs/and relevant ADR(s).test:binscript.Statusset (ADR-first).node bench/run.mjs <dir>; do not overwritebench/snapshots/baseline.json). N/A otherwise.