Skip to content

refactor(ir): make arithmetic failure destinations explicit - #40

Merged
mremond merged 3 commits into
mainfrom
fm/task-e18db27c
Nov 14, 2026
Merged

mremond merged 3 commits into
mainfrom
fm/task-e18db27c

Conversation

@mremond

@mremond mremond commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Why

Make arithmetic failure transfer explicit so compiler refactoring preserves error handling and side-effect ordering.

What changed

  • Compiler structure changes only: typed arithmetic sites carry independent identities, evaluation contexts and failure destinations.
  • One checked native route retains immediate-integer and boolean-not fast paths.
  • Verification preserves failure routes through optimization and generated helpers.
  • Tuple/send fusion counts actual reads, and exceptional-cycle checks respect exception consumption.
  • Expanded native/OTP fixtures protect guard rejection, cleanup replacement and receive-resume behavior.

Before and after

Before: Seven arithmetic operators relied on protected-result bookkeeping and separately emitted exception checks.

After: Seven operators use explicit operation sites, with local proof and the pull request's required Linux/macOS checks passing.

This changes compiler structure, not a screen; actual native/OTP program output and IR diagnostics demonstrate the result.

Checked

Live validation: Demonstrated for this version. 4 of 4 scenarios driven live in the product.

Scenario Result Evidence
Arithmetic values, failures and side-effect ordering ✅ Passed live Six fixtures complete in three execution modes; changed runtime journeys pass ten consecutive rounds.
Operation identity, failure destinations and transformations ✅ Passed live Real lowered IR accepts mutable/resultless sites and rejects malformed routes; source and generated functions remain verified.
Project gate and integration coverage ✅ Passed live The complete local gate, exact-version hosted proof and the pull request's own required Linux/macOS checks pass.
Exact-base workload comparison ✅ Passed live Initial slower samples are retained; counterbalanced existing-binary measurements did not reproduce the increase. No general speedup is claimed.
  • Combined-tree integration: The actual pull-request merge tree matches the conflict-free integration calculation and preserves newer main's runtime/test-storage fixes. Both platforms passed private native test storage.
  • Pull-request checks: All 19 applicable checks succeeded; three unrelated editor/packaging checks were skipped. No check is failed, pending or waived.
  • Independent review: Code, documents and all four exact-version proof scenarios were independently accepted.
How it was checked

Ordered matching release builds; strict workspace Clippy; cargo test --workspace --locked --no-fail-fast.

Full local serial native suite: 488 passes and two external-module skips. Local Rust workspace: 2,167 passes and one release-only performance probe ignored.

All changed IR/backend test files and native/default/single/OTP runtime journeys passed ten consecutive rounds without retries on OTP 29.1.2.

Allocator, stacktrace, both documented cross-object probes and disposable installed external/embedded archive execution passed. No release packaging or cross-target native execution is claimed.

The first local Cowlib reference build failed because upstream Make split its work path. MAKEFLAGS='CURDIR=.' let the unchanged suite pass all 122 cases.

All 80 local Thoas differential cases agree. Comparator and fixture boundaries remain unchanged; whole-stack metadata equality is not claimed.

The existing workflow's single manual run completed all 21 jobs successfully on the reviewed branch, including required Linux/macOS checks and the aggregate.

Inspected Linux reports confirm 122 project-owned Cowlib differential cases, 80 Thoas cases, and 157 cookie plus 27 date functional EUnit assertions.

Cookie attribute-order comparison rules and functional/property exclusions remain explicit. These results do not establish complete upstream-suite compatibility.

The manual run's optional Poolboy command reported five unresolved ETS/supervisor functions and exit 1. Its existing workflow policy is unchanged; Poolboy functionality is not claimed.

Initial default/single medians in milliseconds, base to final: plain arithmetic 28.088/28.002 to 29.863/29.791; arithmetic in try 55.078/55.033 to 55.701/55.376; process ring 178/180 to 181/182.

Counterbalanced default/single medians in milliseconds, base to final: plain arithmetic 30.140/29.754 to 29.909/29.676; arithmetic in try 58.605/58.553 to 56.116/55.933; process ring 189/194 to 178.5/186.

Counterbalanced runs used existing binaries, two warmups and twelve measured samples per version/mode; no compiler process was observed.

Hot-loop instructions, local branches and resolved calls match after relocation normalization. Address layout differs; the original timing cause remains unproven.

The complete merge tree differs from the reviewed branch because newer main adds runtime and test-storage changes. The pull request's own checks passed on that combined tree.

The reviewed arithmetic implementation/test blobs remain identical; only disjoint README additions combine. The new private-test-storage journey passed on Linux and macOS.

Risk

Risk above low: Blast radius, medium — Touches arithmetic lowering, optimization, verification and native emission.; Novelty, medium — Typed arithmetic sites extend existing compiler infrastructure.

Full risk assessment
Dimension Level Why
Blast radius medium Touches arithmetic lowering, optimization, verification and native emission.
Behavior low Supported program behavior is preserved; regression fixtures guard error ordering.
Undo low A revert needs no data or settings migration.
Evidence low Independent proof and the PR's own Linux/macOS checks passed.
Sensitivity low No key, sign-in, saved-data or release implementation changes.
Novelty medium Typed arithmetic sites extend existing compiler infrastructure.
Dependencies low No dependency changes.
Not done

Windows and cross-target native execution are not claimed.

Measurements are local samples, not a universal throughput or latency guarantee.

Broader runtime refactors and complete stack-metadata compatibility remain outside this bounded change.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 14, 2026
@mremond
mremond merged commit 7c7fd82 into main Nov 14, 2026
43 checks passed
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