Repository navigation
wpfacts/codegen: P3 B1, audited NUM declarations; proven-Number reads drop their INT32 tests - #14354
Merged
Merged
Conversation
…x7FFE word (C.prototype ref) is never read as an int32
… INT32 tests (C1 compare, C2 arithmetic leaf, C4 parameter entry); NUM seed audit; canonnum runtime sabotage
… arm for arithmetic results (spot check)
…48 / 32766 (cherry picked from commit a58890bc017572de7d5c7046e3d430c5f852f2aa)
…feedback/tests.rs (+15 exact-int32 test)
…-bits tests for v8 wire int32 and node:sqlite integers
|
Caution Review failedThe pull request is closed.
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. |
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.
P3 B1: element reads that the whole-program facts prove plain Numbers drop their INT32 tests. Design: /root/CHB/DESIGN-p3-canonical-numbers.md rev 3.1, which answers REVIEW-p3 (R1–R7, D1–D5). It builds on #14353 (the exact int32 predicate, merged).
The fact: the NUM declaration (REVIEW-p3 R2)
prim::NUMuse in perry-wpfacts (124) has a row inperry-wpfacts/NUM_SEEDS.md:tests/num_seeds_audit.rsfails when a file's count of uses differs from its rows, or when a row has no citation.canonical_numbers):ModuleBindings::number_element_reads.Number, optionally
undefined, and nothing else.Spot check (15 seed rows drawn at random, seed 1109, each re-read against its cited code):
_keys (NUM|UNDEF);from_concat.rs:557,index as f64);iter_object.rs:591,idx as f64);date.rs:110 js_date_now -> wall_millis());text.rs:535-536,as f64);+results (solve/apply.rs);length.typed_array_methods.rs:142cited a non-existentjs_typed_array_index_of. The real producer isobject/native_call_method/typed_array.rs:271(
js_array_indexOf_jsvalue(..) as f64). The row is fixed.dynamic_arith.rsdynamic_add_non_plain), which decodes INT32 operands and returns an f64.Consumers (codegen
expr/facts_canonical.rs)expr/compare.rs), when both operands are proven and at least one by the facts:fcmp;===/!==with a plain Number:fcmp oeq/une;fcmp oeq || (bits equal && undefined), and!==is its exact negation (D1).expr/binary.rs): a guarded leaf proven a Number is not tested.codegen/facts_number_locals.rs): a facts-proven Number parameter takes its argument's bitswithout the INT32 conversion.
value_repsandrep_rules(DESIGN-p3 §2.4), so B1 ships without it, and it follows as its own change.The two INT32 producers claimed by comments
value_call.rs:410(V8) andstringify_scalars.rs:33(sqlite) claimed live INT32 Number producers. Neither is live:n as f64.Both are proved from the code and by running against node, and raw bits are pinned by the new runtime and stdlib tests
(
NUM_SEEDS.md, "INT32-box producers claimed by code comments"). The comments are fixed.Check mode, sabotage, switch
Fact::CanonicalNumber): every trusted operand is tested "plain double" (outside the tag band and notHANDLE_TAG), or exactly
undefinedwhere the fact allows it. A miss exits 86. C4 uses the existing parameterentry witness.
PERRY_FACTS_SABOTAGE=canonnum cargo build-perry --release(scripts/p3-canonnum-runtime.sh, which also checksthe archive's mtime) builds
js_math_roundto return an INT32 word.canonical-number-negativewith--canonnum-runtime <target>/releasemust give rc 86. The correct arm givesrc 0 and node-equal output.
PERRY_FACTS_CANONICAL_NUMBERS=0turns off both the export and the consumers.Gates (qb9 x86-64; merged head ba0afd6 = this branch + main 369605c)
facts_number_locals_testsstill asserted C4's old INT32 entry decode. The test now asserts the new behaviour (0d43f44)sqlite::bindPERRY_FACTS_CANONICAL_NUMBERS=0: 66666/66666 site lines, diff 0; proven 24680 = 24680; skinbench 335/8021 bothscripts/p3-canonnum-runtime.shrebuilt the archive (mtime check passed). False arm: rc 86, predicate "canonical number". With the same sabotaged runtime and B1 off: rc 0 (no consumer trusts the word)test_p3_canonical_numbers.tsand REVIEW-p3's holey probe (/tmp/drev/p3.js): on, off and check mode all match nodeHashMap<.., RandomState>::insert(a random hash seed per run) and the symbol cache, not in compiled code. No increaseDate.now,Math.random, and two counts that swap between runs), and the on/off differences fall only on those lines; 5 fail to compile in both arms, so there is no output to compareexpr/mod.rs+1 line, allowlist re-asserted)The earlier rev-1 prototype measurement (
p3a.txt, "BUILD FAILED") ran without the GC sidecar and is not part of these gates.Files
canonical_numbers.rs(new), gen.rs/gen_expr.rs (record element value nodes), bindings.rs, lib.rs,NUM_SEEDS.md,tests/num_seeds_audit.rs.expr/facts_canonical.rs(new), compare.rs, binary.rs, codegen/facts_number_locals.rs,program_facts_view.rs, verify_facts/coverage.rs, expr/mod.rs (+1 line, allowlist re-asserted).
p3-canonnum-runtime.sh.wpfacts-p3-b1-canonical-numbers.md.