Skip to content

perf(codegen): re-enter guarded specialization clones - #8290

Open
proggeramlug wants to merge 2 commits into
mainfrom
fix/8169-tier-b-recursion
Open

perf(codegen): re-enter guarded specialization clones#8290
proggeramlug wants to merge 2 commits into
mainfrom
fix/8169-tier-b-recursion

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • let constructively numeric derived arguments satisfy Tier-B guarded call routing
  • make recursive f(n - 1) edges re-enter the $spec_b clone directly instead of re-running the public parameter guard
  • keep BigInt-capable arithmetic on the public guarded fallback, with positive and negative IR regression coverage

Fixes #8169.

Validation

  • cargo test -p perry-codegen spec_self_recursion_tests --lib (5 passed)
  • cargo test -p perry-codegen --lib --no-fail-fast (1,067 passed; the two existing Windows temporary-object-name byte-identity tests failed: split_native_construction_lowers_precise_roots_before_rs4gc, split_native_construction_propagates_shadow_backend_to_workers)
  • cargo fmt -p perry-codegen -- --check
  • python scripts/check_test_registration.py
  • workspace architecture, public baseline freshness, local-binding proof, GC store-site, address-classification, and gap-snapshot quick gates
  • git diff --check

No version bump. The required changelog fragment is included.

Summary by CodeRabbit

  • Performance

    • Improved recursive numeric computations by enabling optimized execution when values are proven to be standard numbers.
    • Preserved safe fallback behavior for BigInt-capable or otherwise uncertain calculations.
  • Bug Fixes

    • Improved handling of derived numeric arguments in guarded recursive calls, ensuring they use the appropriate optimized or fallback path.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@proggeramlug, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Limit details: You’ve used all 8 included reviews currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e0dcd192-de98-4a08-8dc1-7523faf9085b

📥 Commits

Reviewing files that changed from the base of the PR and between 14468dc and e9968e9.

📒 Files selected for processing (3)
  • changelog.d/8290-tier-b-self-recursion.md
  • crates/perry-codegen/src/codegen/spec_self_recursion_tests.rs
  • crates/perry-codegen/src/lower_call/func_ref.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 50c8680c-3841-47ee-b816-c01e2adc146f

📥 Commits

Reviewing files that changed from the base of the PR and between 14468dc and e9968e9.

📒 Files selected for processing (3)
  • changelog.d/8290-tier-b-self-recursion.md
  • crates/perry-codegen/src/codegen/spec_self_recursion_tests.rs
  • crates/perry-codegen/src/lower_call/func_ref.rs

Included review availability: Your plan includes up to 8 reviews per rolling hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The change extends guarded-path type inference for proven numeric expressions. New recursive fixtures and tests verify direct Tier-B clone re-entry for Number values and guarded fallback for BigInt-capable arithmetic. A changelog entry documents the behavior.

Changes

Tier-B guarded self-recursion

Layer / File(s) Summary
Numeric guarded-path proof
crates/perry-codegen/src/lower_call/func_ref.rs
guarded_path_type classifies canonical raw f64 expressions as Number, including derived numeric arguments used by specialized calls.
Recursive guarded-call validation
crates/perry-codegen/src/codegen/spec_self_recursion_tests.rs, changelog.d/8290-tier-b-self-recursion.md
Recursive fixtures and tests verify direct $spec_b clone re-entry for numeric arguments and public guarded fallback for BigInt-capable arithmetic. The changelog records the behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to e9968

This localized code-generation change includes targeted regression coverage and reported validation checks; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main code-generation change: recursive calls re-enter guarded specialization clones.
Description check ✅ Passed The description covers the change, linked issue, validation commands, test results, changelog, and version policy; some template headings are consolidated or omitted.
Linked Issues check ✅ Passed The implementation addresses issue #8169 by recognizing proven numeric expressions, routing recursive calls to the Tier-B clone, and preserving BigInt fallback behavior.
Out of Scope Changes check ✅ Passed The changed code, regression tests, and changelog fragment directly support the linked issue and stated objectives; no unrelated changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/8169-tier-b-recursion

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

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug marked this pull request as ready for review August 17, 2026 05:36
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.

A guarded $spec_b clone never re-enters itself either — the Tier-B half of #8167

1 participant