feat(multimodule): per-module split + tw link — the killer feature over genuinely separate binaries (#140)#203
Merged
Merged
Conversation
…er genuinely separate binaries (#140) - parser: `module Name [isolated] { … }` blocks (the grammar's v1.2 L13 form) now drive a real per-module split. `parse_modules` slices the source, parses each block standalone, then RE-parses importers seeded with the producer's ACTUAL region schemas (real field offsets + real instance counts) so cross-module accesses and scans lower against the producer's layout, not the expected subset's packing. The merged single-module view (`parse_module`) flattens blocks, preserving the corpus contract. NOTE: module blocks previously hit skip_declaration and were silently DROPPED from the parse. - tw CLI: `tw build --split` emits `<stem>.<module>.wasm` per block; `tw link <files…>` runs the ADR-0007 link-graph pass over built modules (names = file stems), printing CERTIFIED/VIOLATION lines and failing non-zero on violations. - tests/fixtures/multimodule/game.twasm: examples/02 restructured with real module blocks (lowerable bodies); 4 tests: split + seeding (actual schema, matching byte_size), 3 binaries validate + link with 2 certificates, mutant expectation rejected at link, merged view unchanged. - #140 differential pair: producer-emitted callee/caller ownership fixtures committed under tests/fixtures/producer_pair/ (clean caller ACCEPTED, double-caller REJECTED LinearImportCalledMultiple) with provenance README — byte-level drift armour mirroring c5_real and zig_producer. End-to-end: `tw build game.twasm --split` -> 3 wasm files -> `tw link` -> "2 certificate(s), no violations". Workspace: 181 tests, 0 failures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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.



Item 2 of the construction sequence (owner: "2 yes").
module Name { … }blocks (the grammar's v1.2 form) now drive a real per-module split:parse_modulesparses each block standalone, then re-parses importers seeded with the producer's actual region schemas — so cross-module accesses lower against the producer's real field offsets and instance counts, not the expected subset's packing.tw build --splitemits one wasm per module andtw linkruns the ADR-0007 link-graph pass over the built binaries:The examples/02 killer feature now runs over genuinely separate binaries instead of a merged parse (fixture:
tests/fixtures/multimodule/game.twasm). Also lands #140's remaining deliverable — the producer-emitted callee/caller differential pair, committed undertests/fixtures/producer_pair/(clean caller accepted, double-caller rejected).181 workspace tests, 0 failures.
🤖 Generated with Claude Code