fix(compiler): stability-review fixes — executor convergence and soundness holes - #269
Merged
Merged
Conversation
…xecutors Converges the interpreter, wasm, and native backends on the reviewed defects and closes the semantic-analysis soundness holes: - Signed MIN % -1 traps on every executor (wasm emits an explicit guard, bootstrap trap-checks) and checkedRemainder(MIN, -1) is None everywhere; the native path no longer emits UB srem MIN,-1. - Wasm float remainder is exact IEEE fmod via an emitted Sterbenz-exact helper, replacing the overflowing div-trunc-mul-sub expansion. - Bootstrap rotate counts wrap unsigned modulo lane width. - Effect-block typing collects terminals inside unsafe blocks, joins all returns through Match.join (new SEM0163 for non-representable joins), and keeps generic value-parameter failures in the failure row. - effectCaptureFacts visits EnumValue arguments; Ownership.scanRunEnds covers PlaceReplace/EnumValue/EffectResult/EffectBindRequirement; both switches are exhaustiveness-guarded. - NativeType.lanesFor resolves EffectComposite through the registered calling shape; CoroutineFrame.stateLayout keys on the full instance key including contractRow; MirVerification.effectFieldLaneCount and WasmBackend hook release consume Layout's lane helpers instead of re-deriving the walk. - Discovered by the new tests: effect runners pass the layout to mirType so enum captures keep their representation (both runner lowerers), and MirLinearization.opensRuntimeContinuation gains the missing RunEffectComposite so post-composite locals get stack storage (fixes a native forward-value-reference bitcode failure). Adds cross-executor corpus programs, effect-block typing and ownership regression tests, and the openspec change artifacts (compiler-review-stability-fixes). Remaining review nits are tracked for a follow-up PR (see design.md).
…-stability-0b5542 # Conflicts: # packages/compiler/src/ToolchainIntegrity.generated.ts
Merges the 6 delta requirements into the main specs (integer/float scalar remainder and rotate convergence, effect-block terminal typing and captures, place-nested loan ends) and moves the change to the archive. Task 10.3's dedicated hook-release test is deferred to the tracked follow-up PR.
The native backend emits LLVM frem for float remainder, which lowers to an fmod/fmodf libcall. On Linux libm is separate from libc, so the first corpus program exercising float % broke the CI link step (undefined reference to fmod); macOS folds libm into libSystem, which is why local runs passed. Pass -lm on the one native link invocation.
julia-script
added a commit
that referenced
this pull request
Aug 27, 2026
PR #269 changed compiler sources without regenerating ToolchainIntegrity.generated.ts; its CI passed because a build cache miss regenerates the file live on the runner, masking the stale commit. Any branch that gets a compiler build cache hit — like this one — fails toolchain:check against the committed file. Regenerated to match main's sources.
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.
Implements the
compiler-review-stability-fixesOpenSpec change: the 10 confirmed findings from the compiler stability review, plus two adjacent native bugs the new tests exposed.Executor convergence
MIN % -1traps on all three executors (was: native trapped, wasm/bootstrap returned 0);checkedRemainder(MIN, -1)isNoneeverywhere, and the native path no longer emits UBsrem MIN,-1.%is exact IEEE fmod via an emitted Sterbenz-exact helper (the oldx - trunc(x/y)*yexpansion overflowed and rounded). Verified against 200k randomized cases.Semantic soundness
unsafe {}are collected; returns join through the canonicalMatch.join(new SEM0163 for non-representable joins) instead of last-return-wins; generic value-parameter failures stay in the failure row.effectCaptureFactsvisitsEnum.value(x)arguments;Ownership.scanRunEndscoversPlaceReplace/EnumValue/EffectResult/EffectBindRequirement. Both switches now carrysatisfies neverexhaustiveness guards so the next missing fact kind is a compile error.Native/layout hardening
NativeType.lanesForresolvesEffectCompositethrough the registered calling shape (mirrorsWasmLanes.laneKindsOf).CoroutineFrame.stateLayoutkeys frames on the full instance key includingcontractRow.MirVerification.effectFieldLaneCountand wasm hook release consumeLayout.effectFieldLanes/lane placements instead of re-deriving the walk (this family desynced once before, commit 7a8434b).mirType(enum captures previously lost their representation and the runner silently failed to lower), andMirLinearization.opensRuntimeContinuationgains the missingRunEffectComposite(fixes a native "non-phi forward value reference" bitcode failure when a composite result crosses blocks).Tests
Cross-executor corpus programs (
arith-convergence-*, capture-arity composite, contract-row suspension frames),EffectBlockTyping.test.ts, a place-replace loan regression test, and a wasm parity sweep. Full suite green: typecheck, biome, 223 files / 2,266 parallel tests, full native acceptance corpus.A subagent review pass ran over the diff; remaining nits and coverage gaps are deferred to a follow-up PR — see the "Deferred to a follow-up PR" section in
openspec/changes/compiler-review-stability-fixes/design.md.