Skip to content

The native compiler carries the wasm32 runtime (#2131 layer 3) - #2264

Merged
ehartford merged 1 commit into
mainfrom
wasm-rt-embed
Oct 7, 2026
Merged

ehartford merged 1 commit into
mainfrom
wasm-rt-embed

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

See the commit. The release embeds the five wasm32 runtime objects (stage1's for the stage embed, stage2's for the release embed), and the link stage extracts them for a wasm32 link when no cross/wasm32 directory holds them. Verified by hiding the directory and linking hello.w, which ran under node; :wasm-tests 6 ok. Item 4 (every match false on wasm32) is untouched. Gate and battery to follow.

…links outside the repository (#2131 layer 3)

A wasm32 link found its five runtime objects only under <runtime
root>/cross/wasm32, which exists only in a tree after `:cross-rt-wasm`;
outside the repository the installed compiler reported them missing.

- build: stage1 compiles the wasm32 runtime (rt_core, rt_wasm, compat,
  panic, fiber stubs) into out/bootstrap/lib/cross/wasm32 beside the
  native objects, and the stage embed carries them as `wasm32_<stem>_o`
  blobs; `:cross-rt-wasm`'s objects are compiled by stage2 rather than the
  release (as the release's own native runtime objects are), so the
  release embed carries them too. The bootstrap embed and the four cross
  compilers' embeds define the same symbols as empty blobs. One list of
  the five objects (parallel lists built with push: the build layer runs
  on the pinned seed, whose evaluator has neither `for` destructuring nor
  `len()` on a collection literal, #1122).
- Link.w: `link_stage_embedded_runtime_object` knows the objects by their
  cross path; `link_stage_find_runtime_object_path` extracts them for a
  wasm32 link when no cross/wasm32 directory holds them, under the same
  generation check as the native fallback, into
  <artifact root>/tmp/with_runtime/cross/wasm32.

Verified with the pinned seed: full build green; `nm` shows the runtime
symbols in the release; with out/lib/cross/wasm32 moved aside, `hello.w
--target wasm32` from the tree extracted the embedded objects and ran
under node; a std.regex program links with no WITH_RUNTIME_ROOT (and
still returns false for every match: item 4, unchanged); `:wasm-tests` 6
files ok on the stage2-built objects. No casts added; the loops index
with the i64 len() returns.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on df39fa3 (tools/battery.w: gate green, uat 21s, battery-checks 793s; status.txt has no RED).

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