fix(codegen): non-Number fields no longer pay for region Number proofs (#11680 matrix regressions) - #11795
Conversation
Fixes the #11680 matrix regressions for any/str fields: - a Number read (R) on a non-identity lane (Any, deprecated F64) is published with REGION_LOOP_WORD_VALUE_TEST (bit 63); the guard tests the R slots values on the object (a static word decides it at compile time); - a read beneath a property access, element access, call or new is not a Number operand (o.a.length no longer requests R); - an admitted region Ptr<Shape> authority covers its receivers stores only; reads and method dispatch keep their proven routes; - re-check: a learned word with the bit fails the loop-invariant fast compare and continues in G, so F64 words pay nothing extra.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughLoop-region Number reads can now use eligible non-F64 lanes when guards check the slot values. Receiver selection, guard generation, and store-proof access were updated. New runtime and compiler tests cover ChangesLoop-region Number reads
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change; it is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change admits more values to optimized execution while retaining value validation and stricter write restrictions. No introduced security weakness was established in the reviewed paths. Incomplete compatibility and deployment coverage keeps the assessment above minimal risk. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 72.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 15 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Fixes most of the matrix regressions that #11680 caused on
any- andstr-typed fields.Root cause. The region planner asked for a Number lane on every
+or compare operand, and on receivers such aso.aino.a.length. The runtime refused that lane on non-double fields, so the region word retired and every iteration ran the generic path. An admitted region also switched off the proven-shape routes for reads and method dispatch across the whole loop.Fix. A Number request on a non-double field is published with a value-test bit, and the guard checks the value. Reads beneath a property access, call or
newno longer request a Number lane. A region's proven-shape authority now covers stores only.Matrix
Examples, shown as pre-#11680 / main / this PR:
read1 any param: 33 / 71 / 12read4_stmt any modconst: 85 / 132 / 28read1 str param: 64 / 92 / 64The Number-field wins from #11680 are kept: 258 cells are faster than pre-#11680.
tsc and Zod: tsc −0.11%, Zod +0.01%; full collections and RSS are equal, and output matches node.
Verification
region_any_str_reads4/0.--gate: OK. fmt and file size pass.Still open
read4 varying anyis 114 against 92 before perf: complete one-shape numeric regions and ConstFn method calls #11680, the cost of the per-iteration value test; fixing it needs a decision.thisstr read4 rows are slow with regions off too.region_loop/plan.rsandmod.rs.Summary by CodeRabbit
.lengthreads avoid unnecessary numeric checks, and calls on receivers with a proven class can remain direct.