perf(repsel): admit logical return-shape producers (#7170 R2) - #8015
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe change adds ChangesReturn-shape analysis and reporting
Estimated code review effort: 3 (Moderate) | ~30 minutes Mergeability Score: ⚪ Minimal · up to This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant ReturnExpression
participant ptr_shape_returns
participant ptr_shape_report
participant OptReport
ReturnExpression->>ptr_shape_returns: analyze && or || return outcomes
ptr_shape_returns-->>ptr_shape_report: provide fresh result allocations
ptr_shape_report->>OptReport: mark result-producing allocations
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 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 |
proggeramlug
left a comment
There was a problem hiding this comment.
Review complete: no blocking correctness finding. The truthy/falsy outcome partition matches JavaScript operand-value semantics for &&/||, fresh allocations are correctly treated as truthy, unsupported and nullish cases remain fail-closed, and opt-report source selection stays aligned with the producer proof. Local focused validation passed: 35 return-shape tests and 22 opt-report tests. The gc-ptr-shape-off-witness CI failure still had byte-exact Node parity in 23/23 cells; its failure was the independent liveness requirement (zero moving cells), not a behavioral mismatch from this diff.
Summary
Admit short-circuiting
&&/||expressions asPtr<Shape>return producers when every value that can escape the complete expression is a fresh allocation of one admissible class. This is the logical-expression producer increment identified by #7170's post-R1 measurement.Changes
true && new C()and(flag && new C()) || new C().??pending a nullish-specific outcome partition.The proof continues to use the existing class-admission, containment, module-barrier, caller-slot, and rooting machinery. It introduces no new pointer position or ABI change.
Related issue
Refs #7170 (R2 logical producer increment; the broader issue remains open for cross-module and method-call consumers).
Test plan
cargo check --profile perry-dev -p perry-codegencargo test --profile perry-dev -p perry-codegen --lib ptr_shape_returns --no-fail-fast(35 passed)cargo test --profile perry-dev -p perry-codegen --lib 'ptr_shape::opt_report_tests' --no-fail-fast(22 passed)./scripts/test_affected_crates.sh --base origin/main(perry: 959 passed;perry-codegen: 950 passed)cargo fmt --all --checkgit diff --check./scripts/pre-tag-check.sh --quickhas one pre-existing failure on unchangedcrates/perry-codegen/src/expr/property_set.rs:1457in the GC store-site inventory; every other quick check passed#[test]coverage in the affected crateChecklist
CLAUDE.md/CHANGELOG.mdCONTRIBUTING.mdand agree to the Code of ConductSummary by CodeRabbit
New Features
&&and||expressions.Bug Fixes
Tests