Skip to content

codegen: a birth stores a proven Number into a raw f64 lane with no number test (P3 B4b) - #14668

Merged
proggeramlug merged 4 commits into
mainfrom
perf/p3-b4b-proven-number-births
Nov 14, 2026
Merged

proggeramlug merged 4 commits into
mainfrom
perf/p3-b4b-proven-number-births

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What

A Number has one encoding, the plain double (representation RFC §10 P3). The births did not use that yet: a
constructor prologue, a compact birth and a birth image (new C(..) of a store-only constructor, every closed
object literal) tested each value bound for an F64 lane "plain finite number" and sent a miss to the shared
birth and the ordinary constructor (PrologueStore::requires_number_check: the lane alone decided). The birth
and fill lanes filed this as "goes when a proven Number is storable raw (P3 B4b)".

Now a raw-f64 lane store whose argument the facts or its structure prove a Number takes the lane as it is:
PrologueStore::proven_number asks type_analysis::expr_produces_canonical_raw_f64, the predicate a field store
(property_set.rs) already stores raw on: a facts-Number local or field read, arithmetic, a Math.* result, a
closed Number call, a literal. Non-finite Numbers and -0 are born raw too, as they are stored raw by a field
store. An argument that is no proven Number keeps its test.

Chess: the Undo literal in make tested captureSquare, ep, halfmove and fullmove on every move.

Fact, witness, switch

  • The fact is the NUM declaration every P3 consumer reads; nothing new is solved or exported.
  • Check mode (PERRY_VERIFY_FACTS=1): each such value is tested "is a plain double" before the allocation
    (ctor_prologue_stores::witness_proven_number, Fact::CanonicalNumber, site "canonical number birth lane"); a
    miss exits 86.
  • S0 arm number-birth-negative: with the canonnum runtime (Math.round returns an INT32-tagged word) the
    birth's witness reports it; the correct arm prints what node prints.
  • PERRY_FACTS_NUMBER_BIRTHS=0 keeps every test (= main). Registered in compile_env (sorted position) with the
    test number_births_switch_is_a_cache_input.
  • Probe: PERRY_SITE_STATS=1 names every image as before. No per-site IR diff was taken; the on / off arms share one build and one facts dump.

Chess (qb10, ONE build d9b0433 = this branch with main dd083f3 merged in; off arm PERRY_FACTS_NUMBER_BIRTHS=0, instructions:u, each arm x2)

mode off on delta checksum peak RSS off / on (KiB)
search 250000 11 848.109 M 11 764.466 M −0.706% OK 23 720 / 23 716
perft 4 258.929 M 256.315 M −1.010% OK 15 360 / 15 360
evaluate 100000 1 191.813 M 1 191.812 M 0 OK 15 360 / 15 360
legal 10000 354.793 M 352.166 M −0.740% OK 15 604 / 15 604

Second runs: search 11 848.140 / 11 764.425, perft 258.929 / 256.316, evaluate 1 191.813 / 1 191.814, legal
354.791 / 352.166. The off arm's binary is byte-identical to main dd083f3's (sha afd9f085de252fae) and its
counts equal main's measured in the same hour (11 848.132 / 258.929 / 1 191.813 / 354.792). Binary size unchanged
(9 320 576 B); facts dump identical in both arms. Chess check mode: all four modes rc 0, 0 misses. evaluate does not
move.

Gates run

All on d9b0433 (qb10):

  • Fixture tests/parity/language/number/test_p3_b4b_number_births.ts: = node in default, DCE off, check mode,
    check mode with DCE off, and with PERRY_FACTS_NUMBER_BIRTHS=0.
  • Chess on / off x2 with checksums, RSS, size and check mode (above).
  • Language parity (2732 programs, default mode): 2472 match, 0 crashes, 0 timeouts; per-file result identical to
    the runtime: a JS Number has one encoding; delete the INT32 Number consumers (P3 B4b) #14658 branch on the same base (apart from each branch's own fixture, both matching).
  • Language check mode (2732 programs): 0 rc 86, 0 aborts.
  • S0 with a canonnum runtime: 205 executable controls passed; number-birth-negative 0 (correct) / 86 (false).
  • cargo test -p perry number_births_switch_is_a_cache_input: passed. Mac cargo check -p perry-codegen -p perry --lib --tests: clean. scripts/check_file_size.sh: OK.

Not run

Full suites, parity IR census, corpus check mode, tssrc, Supabase, skin size, GC schedule stress (the birth window
is unchanged: the same stores, the witness sits before the allocation).

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@proggeramlug
proggeramlug merged commit c2c44d2 into main Nov 14, 2026
97 of 101 checks passed
@proggeramlug
proggeramlug deleted the perf/p3-b4b-proven-number-births branch November 14, 2026 05:02
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