Skip to content

chore: merge train 236 (v0.5.1615) - #10790

Merged
proggeramlug merged 2 commits into
mainfrom
train236r
Sep 20, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
train236r

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Merge train 236 — a Windows-platform extraction, released as v0.5.1615.

What this is

The main-applicable subset of PR #10403 ("Windows: make the platform buildable and Node-correct end-to-end"), extracted onto main with the author's authorship preserved. 13 files, +810/−473.

#10403 cannot land as it stands: its base is turnloop/integration, a draft branch whose merge-base with main is fcd108bfb0 (v0.5.1579) — 375 commits back. By its own accounting nine of its ten defects are pre-existing on main, and the diff separates cleanly along a subsystem line. That PR stays open for the turnloop half.

The headline is that Windows had no precise GC roots at all: #7302 moved EH to invoke/landingpad because longjmp could skip a statepoint relocation write-back (#7174); on windows-msvc that lowering becomes SEH funclets, and rewrite-statepoints-for-gc dies on funclets. So Windows could have precise roots or try, never both — and since essentially all async lowers to a try, the whole surface was unreachable except with the collector in fallback mode. This puts windows-msvc on the same Itanium landingpad shape as ELF/Mach-O with Perry's own personality.

The EH change is unconditional in source. Here is why it is still inert off Windows.

This is the only part with host blast radius, so it was verified from the diff rather than accepted:

-    let msvc = ctx.target_triple.contains("-windows-");
-    ctx.func.personality = Some(if msvc { "__C_specific_handler" } else { "perry_eh_personality" });
-    if msvc { /* catchswitch / catchpad / perry_seh_filter */ }
+    ctx.func.personality = Some("perry_eh_personality");
+    let lpad_idx = ctx.new_block("eh.lpad");
+    …  "{} = landingpad {{ ptr, i32 }} catch ptr null"

The deleted branch was never cfg(windows) — it was a runtime string test on the target triple, false for aarch64-apple-darwin and x86_64-unknown-linux-gnu. What survives is the old else arm de-indented: same personality, one eh.lpad, same landingpad. Off Windows this is a no-op refactor, and that is a property of the source rather than a measurement. Same for needs_eh_funclets in codegen/mod.rs, whose predicate was target_triple.contains("-windows-") && any(personality). eh.rs's decoder relocation into the new eh_lsda.rs was verified byte-identical.

Three of #10403's defects were dropped, because main moved past them

main picked up 7b90108d17 ("unbreak the MSVC compiler link and the WinUI widget backend") and df29edbe46 in the intervening 375 commits. Carrying these would not have been merely redundant:

  • reorder_child — a duplicate definition (E0428). main already has it, with a parent <= 0 guard the PR's version lacks.
  • The whole lru-subclass Cargo-feature treatmentmain fixes the seven LNK2019s with MSVC /ALTERNATENAME weak defaults, and 7b90108d17's own message rejects the feature approach: "A Cargo feature cannot express 'this link has no provider'." The PR's js_lru_cache_* definitions in perry.exe would shadow those alternates. Moot regardless — v0.5.1612 removed the lru-cache binding entirely.
  • gc/tests/heap_generation.rsmain already carries the not(debug_assertions) ignore plus a note reading "Do NOT 'fix' the test instead." The PR's rewrite is inert behind that ignore anyway.

Two edits beyond #10403's diff, both required

#10403's branch does not compile off Windows, because eh.rs is #[cfg(not(windows))] and its Windows-only validation never built it. As extracted it produced E0603 (eh_walker.rs:948 calls crate::eh::find_landing_pad_in_lsda, which the move made private — that caller does not exist on the PR's base) and E0425/E0433 ×6 from the LSDA unit tests losing DwarfReader and the DW_EH_PE_* constants. The tests moved into eh_lsda.rs and now run on every host — five pass, including action_zero_pad_is_still_a_handler (the #8082 invariant). DispatcherContext also became pub, since it appears in pub fn perry_eh_personality's signature and private_interfaces is a hard error under -D warnings.

Open risk, recorded rather than assumed away

ARM64 Windows is unverified and its guard cannot discriminate. DispatcherContext is documented as the x64 DISPATCHER_CONTEXT, carries offset_of! asserts at 0x38/0x40, and is not cfg(target_arch)-guarded — while windows-arm64-build is a live CI job. Both targets are LP64, so those asserts pass whether or not the ARM64 layout is right. The fields the handler reads do appear to sit at matching offsets in the documented layout, so it is probably fine — but "probably fine, and the assert can't fail" is exactly the shape CLAUDE.md's ★ section is about. In the changelog fragment.

And this train does not prove what #10403 exists to do. It shows Windows EH compiles and that nothing else regressed. That Windows actually gets precise roots — the .pgcmap present-vs-absent A/B — needs the author's box, and a green build here should not be read as confirming it.

Validation

Assembled on 1afa961894; source head asserted fresh; no attribution trailers; author preserved. Nine cheap gates, cargo check --workspace --all-targets under -D warnings, all five pinned artifacts byte-identical before and after the sweep, six unit suites with an empty failing set, lint complete at 6-of-6 with nothing outside the known-red public-baseline step.

Gap sweep at PERRY_RUN_TIMEOUT=30, eight areas chosen for the exception-handling blast radius rather than for Windows, which cannot be exercised here — async is in the list because essentially all async lowers to a try. Every area asserted live, zero unexplained regressions:

gc_ 54   async 19   throw 10   error 10   promise 10   try_ 7   catch 3   finally 3

Ralph Kuepper added 2 commits September 20, 2026 09:15
Main-applicable extraction of PR #10403, which targets the draft
turnloop/integration branch (375 commits off main) and cannot land as it
stands. The turnloop-only half stays in #10403.

windows-msvc lowered try/catch to SEH funclets, and LLVM's
rewrite-statepoints-for-gc does not support funclet EH, so a Windows module
containing a try could have precise moving-GC roots or compile, never both.
It now emits the same single landingpad shape as ELF/Mach-O under Perry's own
personality; LLVM then classifies the function as non-funclet EH and emits an
Itanium GCC_except_table on COFF, which a new x64 language handler in
eh_windows.rs walks and transfers through RtlUnwindEx. The LSDA decoder moves
out of eh.rs into eh_lsda.rs verbatim so both personalities share it.

For every non-Windows target triple the emitted IR is unchanged: the branch
removed from emit_eh_dispatch and from declare_phase_b_strings_part2 already
selected the landingpad arm there, and needs_eh_funclets()/
declare_seh_machinery() had no callers outside the Windows path.

Also: perry-ext-http reports libuv's err.errno on Windows rather than a
negated Winsock number (non-Windows arm byte-identical); the malloc-trim
telemetry test asks the mimalloc purge witness instead of an OS list; and
node_compat_matrix.mjs honours PERRY_BIN, finds a produced .exe, and raises
the cold-compile timeout that was fabricating prefix divergences.

Not carried, because main already fixes them in 7b90108 and with an
existing cfg_attr(ignore): the lru-subclass feature plus perry.exe link shim,
perry-ui-windows-winui's reorder_child, and the heap_generation funnel-assert
rewrite.

Validated on macOS/aarch64 only. No Windows behavioural claim from #10403 is
re-verified here.
@proggeramlug
proggeramlug merged commit cdd65e6 into main Sep 20, 2026
19 of 20 checks passed
@proggeramlug
proggeramlug deleted the train236r branch September 20, 2026 08:08
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0c92d240-3c4f-4ad3-859b-00851d7a03f0

📥 Commits

Reviewing files that changed from the base of the PR and between 1afa961 and e31fec1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • CLAUDE.md
  • Cargo.toml
  • changelog.d/10385-windows-support.md
  • crates/perry-codegen/src/codegen/mod.rs
  • crates/perry-codegen/src/function.rs
  • crates/perry-codegen/src/module.rs
  • crates/perry-codegen/src/runtime_decls/strings_part2.rs
  • crates/perry-codegen/src/stmt/try_stmt.rs
  • crates/perry-ext-http/src/transport_error.rs
  • crates/perry-runtime/src/eh.rs
  • crates/perry-runtime/src/eh_lsda.rs
  • crates/perry-runtime/src/eh_walker.rs
  • crates/perry-runtime/src/eh_windows.rs
  • crates/perry-runtime/src/gc/tests/telemetry_verifier.rs
  • crates/perry-runtime/src/lib.rs
  • scripts/node_compat_matrix.mjs
 ___________________________________________________
< Stealth mode activated. Bugs won't see me coming. >
 ---------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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