perf(ir): drop the P6 copies whose signature did not change #286
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/281-perf-f12-p6-copies"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #281
Drops the P6 copies that the second peel run left with the signature of their original (
dropIdleCopiesincompiler/src/ir/devirtualize.trb).specializeFrozenCalleesnow returns its clone map, and after the secondpeelPrograma copy is idle when every parameter type and the result type equal the original's. An idle copy's calls name the original again; the kept copies move down into the tail,program.functionsis truncated,specializedFunctionsis rebuilt, andredirectCalls(the generalizedredirectSpecializedCalls) rewrites everyCall.Tests (
compiler/tests/devirtualize.test.trb, new group "a copy that peels nothing", existing tests unchanged):Five_iterate_x24_directfor a frozen member whose result class is poisoned, andheldcallsFive_iterate;Three_iterate_x24_direct) stays and its call site still names it;_x24_directfunction is inspecializedFunctions.Ledger
Base: main
6f9d340b(push CI run 701, artifactcompiler-linux-x64) against this branch ateb14a70a(PR CI run 709). Stage-2program.c, one CI bootstrap each:_x24_direct+_x24_direct_x24_site)program.cbytestools/bootstrap.sh, all three stepstorb build --emit-c_x24_direct_x24_sitecopies collapse into_x24_sitecopies of their originals, which already existed. No name is new.var numbers = [1, 2, 3]/numbers.append 4/print numbers.length()) was emitted by main's and this branch's compiler sources, both run under the 2026-10-09 nightly's VM, because the CI artifact binaries need a newer glibc than the measuring host.benchmarks.ymltable after the merge.docs/PERFORMANCE.md records this in F5 (code size), the F12 second ledger and the P6 row.
docs skill --checkanddocs index --checkare up to date.Checklist (head
dcf9cae):_x24_directis inspecializedFunctions). CI green on this head, including bootstrap/fixpoint, tier A/B, gates.moved[copy]is the original for a dropped copy and the lower slot for a kept one; the in-place compaction never overwrites an unread slot (kept <= copy);specializedFunctionsis rebuilt consistently;redirectCallsreuses the existing call rewrite.isIdleCopycompares all parameter types and the result. Early return on an empty clone list keeps the old behaviour.Non-blocking: the pitfall noted in the doc comment (a body-only local peel is lost with the dropped copy) is covered by the nightly benchmark check you named; worth confirming on the first table after the merge.