Repository navigation
codegen(win64): indirect aggregate closure params by pointer; un-skip combinator tests (#806) - #821
Merged
ropoctl merged 4 commits intoAug 18, 2026
Conversation
ropoctl
force-pushed
the
windows-806-combinator-indirect
branch
from
August 17, 2026 23:03
3f461c3 to
b3bb099
Compare
ropoctl
force-pushed
the
windows-806-combinator-indirect
branch
from
August 18, 2026 00:14
f1ca9d1 to
f3fe038
Compare
ropoctl
force-pushed
the
windows-806-combinator-indirect
branch
from
August 18, 2026 01:16
f3fe038 to
b75e0c4
Compare
ropoctl
force-pushed
the
windows-806-combinator-indirect
branch
from
August 18, 2026 02:24
b75e0c4 to
a1952b9
Compare
The win64 dyn-trait sret-lowering fix in the previous commit makes &dyn Error.source() (returning the 24-byte fat Option[&dyn Error]) produce correct output on Windows. Remove the skip-windows gate.
…callee (#806) A closure callee built its parameter LLVM signature straight from each param's by-value type, but the closure CALL site (mir_build_closure_fn_type) applies internal_abi_needs_indirect_param and passes a win64 aggregate >8B (e.g. a 16-byte str) as a pointer. Caller and callee then disagreed on the argument shape, so the aggregate arrived corrupted: map_err(s => s.len()) read a garbage str and returned 0. Mirror the call-site ABI in gen_closure: when a param is win64-indirect, declare it as ptr in the callee signature and, in the body prologue, load a callee-owned copy from the incoming pointer into a local alloca. This reads the single FnAbi-equivalent indirect decision that the call site already uses (D6), so producer and consumer agree. The path is gated on internal_abi_needs_indirect_param, which is win64-only, so non-win64 targets are unchanged. Fixes the Option/Result combinator wrong-output class (#806).
The indirect-aggregate closure-param codegen fix makes the win64 closure call ABI agree with the callee, so the Option/Result combinator tests now produce correct output. Verified on the native Windows VM: spec_ss10_3 -> ok, spec_ss10_6 -> ok.
ropoctl
force-pushed
the
windows-806-combinator-indirect
branch
from
August 18, 2026 02:58
a1952b9 to
7e768b7
Compare
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
Fixes the win64 Option/Result combinator wrong-output class under #806
and un-skips the two affected spec tests on Windows.
spec_ss10_3_option_result_combinatorsandspec_ss10_6_result_combinators_completeproduced wrong output on win64(e.g.
map_err(s => s.len())returning0instead of3).Root cause (D6 — one ABI, read by both sides)
A closure callee built its parameter LLVM signature directly from each
parameter's by-value type. But the closure call site
(
mir_build_closure_fn_type) appliesinternal_abi_needs_indirect_param,so a win64 aggregate larger than 8 bytes — a 16-byte
str, for instance —is passed as a pointer. Caller and callee then disagreed on the
argument shape, so the aggregate arrived corrupted and the closure read
garbage.
This is the same single-ABI-source-of-truth divergence class as the
sibling dispatch-vs-vtable fix: one side re-derived the passing mode
independently of the other.
Fix
Mirror the call-site decision in
gen_closure:ptrin the calleesignature (matching the call site).
into a local alloca, so the body reads its own storage.
The path is gated on
internal_abi_needs_indirect_param, which iswin64-only, so non-win64 targets are unchanged (the branch is a no-op
and the direct-by-value path is taken exactly as before).
Verification (native Windows VM)
Cross-built with the fixed stage1, run on the real Windows x86_64 VM:
spec_ss10_3_option_result_combinatorsokspec_ss10_6_result_combinators_completeokRegression — the closure/dyn tests already un-skipped by #818/#819/#820
still pass on the VM:
error_context,sequence_traverse_transpose,no_suspend_blocks,error_trait→ allok.Stacked on #820.