Skip to content

perf(codegen): a store of a value that is never a closure emits no ConstFn admission - #11857

Merged
proggeramlug merged 2 commits into
mainfrom
regfix-store-constfn-values
Oct 3, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
regfix-store-constfn-values

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Trims the per-site code that #11798 added to every static-key store.

Cause

#11798 gives every static-key store site two ConstFn admission blocks: one on the existing-key hit and one on the key-add memo. Each checks that the stored value is a closure of the site's one body. A site whose value can never be a closure (a literal, an arithmetic or comparison result, an object or array literal) carries both blocks for nothing: a ConstFn lane can never admit its value.

Fix

value_never_closure(value) classifies the store's HIR value. When it holds, the flagged lane branches straight to the miss, which is what a failed admission does, and the admission blocks are not emitted. Values that may be closures keep the full check.

Results

store function (bytes) morning main this PR
o.c = v + 1 915 1,311 957
o.d = "x" 815 1,208 861
o.b = v (any) 834 1,228 1,228

Real workloads (n=5, median instructions:u; main = 5b06d69)

workload main instr this PR delta full GCs main/PR RSS KB main/PR binary bytes main/PR
tsc (transpile x3) 184,902,302,770 184,899,749,498 -0.00% 244/244 323,052/323,912 182,782,336/182,598,016
zod x5000 19,831,886,486 19,831,846,455 -0.00% 0/0 59,396/59,168 24,440,056/24,431,888
qs parse_nested 32,985,522,956 32,989,923,420 +0.01% 0/0 60,144/60,164 27,301,072/27,301,072
commander parse_argv 8,912,561,402 8,912,075,482 -0.01% 0/0 57,528/55,552 34,203,080/34,198,984

Outputs are identical to main's in every run.

Verification

  • New codegen test store_ic_emits_no_constfn_admission_for_a_value_that_cannot_be_a_closure: no ConstFn blocks for a number, a string or v + 1, while the F64 lane check stays. A value that may be a closure keeps all three blocks.
  • perry-codegen (all) passed on this branch. Gap suite (1254 files) compared with main: 0 regressions. fmt: clean.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48f5fcf5-e557-41aa-929c-76e72e7992a5
📥 Commits

Reviewing files that changed from the base of the PR and between 07e50b1 and ad4ca99.

📒 Files selected for processing (4)
  • changelog.d/PENDING-regfix-store-constfn-values.md
  • crates/perry-codegen/src/expr/property_set.rs
  • crates/perry-codegen/src/expr/put_value_store_ic.rs
  • crates/perry-codegen/src/expr/write_pic_barrier_tests.rs
 ____________________________________
< Come with me if you want to debug. >
 ------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

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

@proggeramlug
proggeramlug merged commit e3d13e3 into main Oct 3, 2026
22 of 23 checks passed
@proggeramlug
proggeramlug deleted the regfix-store-constfn-values branch October 3, 2026 23:51
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