Skip to content

wasm32 bundles: built by stage1, embedded beside the host's, selected by target (#2131) - #2260

Merged
ehartford merged 2 commits into
mainfrom
wasm-bundles
Oct 7, 2026
Merged

ehartford merged 2 commits into
mainfrom
wasm-bundles

Conversation

@ehartford

@ehartford ehartford commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

#2131 layers 1 and 2.

Layer 1: :cross-rt-wasm builds the four corpus bundles for wasm32 (by stage1, as the host's are) into out/wo/wasm32 and the store.

Layer 2: the native release carries the wasm32 bundles beside its own (wo_<name>_wasm32_* blobs, <name>@wasm32 index entries with embedded_bundles_target_data); the link stage, interface registration and import resolution select a bundle by target. rt/wasm.w provides the corpora's thirteen libc externs (ctype family, memchr) in With under their C names (FnAbi's wasm libc-provider list; ABI hash re-recorded, no convention change).

Evidence: full build and fixpoint green under the pinned seed; nm shows the wasm32 slots in the release; a native std.regex program links and runs unchanged; hello.w --target wasm32 runs under node; :wasm-tests 6 files ok. A std.regex program for wasm32 links and runs and returns false for every match: item 4 (64-bit corpus model on 32-bit pointers), recorded on the issue with the repro; not claimed fixed here.

Not in this PR: item 3 (the release carrying the wasm32 runtime objects; today WITH_RUNTIME_ROOT=out/lib), the SDK path resolving from the tree rather than the cwd, item 4, item 5. Gate and battery to follow.

`:cross-rt-wasm` now builds the four corpus bundles for wasm32 beside the
wasm32 runtime objects, by stage1 as the host bundles are (there is no
wasm32 cross compiler to build them with the release), into out/wo/wasm32
and the store slot <name>/wasm32-<abi>. Verified: `src/main build
:cross-rt-wasm` produced pcre2, zlib, c_algorithms and tommyds .o/.wi/
.manifest with `target wasm32` in 253s, and a cached rerun in 29s.

The loops index with the i64 `len()` returns (D11); no cast.
…ed by target; the wasm runtime provides the corpora's libc externs (#2131 layer 2)

Bundle slots were keyed by name only, one per corpus, so a `--target
wasm32` link of a std.regex program met the darwin pcre2 bundle and was
refused. Now:

- build: the stage and release embeds carry the wasm32 plans' blobs under
  `wo_<name>_wasm32_*`; stage1's embed has the matching empty slots; the
  index generator takes `<name>@<target>` entries and emits
  `embedded_bundles_target_data(index)` ("" is the compiler's own target).
- compiler: `embedded_bundle_for_this_target(index)`; the link stage's
  selection, Compilation's interface registration and Resolve's provider
  lookup skip a slot carried for another target (D39: an interface is its
  target's; two under one module identity would be refused as #2248 does).
- rt/wasm.w provides the thirteen libc symbols the migrated corpora
  declare (the ctype family and memchr), in With, C locale, under their C
  names through FnAbi's wasm libc-provider list; the ABI hash is
  re-recorded (no convention change).

Verified with the pinned seed: full build green, fixpoint through the
chain, `nm` shows the wasm32 slots in the release, a native std.regex
program links and runs unchanged, `hello.w --target wasm32` runs under
node, `:wasm-tests` 6 files ok. A std.regex program for wasm32 now links
and runs and returns false for every match: #2131 item 4 (the corpus's
64-bit model on 32-bit pointers), recorded on the issue with the repro.

Loops index with the i64 len() returns; no casts added.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on d19f7a3 (tools/battery.w: gate 41s, uat 28s, battery-checks 876s; status.txt has no RED). Main moved only by docs-only merges since the branch point (D108).

@ehartford
ehartford marked this pull request as ready for review October 7, 2026 21:31
@ehartford
ehartford merged commit 645dc53 into main Oct 7, 2026
@ehartford
ehartford deleted the wasm-bundles branch October 7, 2026 21:31
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