feat(build): --explain-copies names the take-out and put-back for a copied list element #394
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/302-explain-copies-hint"
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 #302
What
A
--explain-copiesnote for a write into an element of a list that a variable holds (rows[row][column] = ...) gets the second=line of PERFORMANCE.md section 6: takerows[row]out withremoveAt, write it, put it back withinsert. It uses the list and the index as the line writes them, and a spare name for the element (cells, orcells2... when the function uses it).ir/explain-copies.trb:ExplainedCopygainslistandspare(defaulted, empty = no hint). They are set only when the copied place is oneElementstep into a named slot of list storage. Arrays (fixed length), fields, deeper paths and unnamed bases keep the single reason line.cli/copies.trb:renderNoteadds the line only when the source line starts with<list>[<key>]at the note's column, so the names are never guessed.compiler/tests/explain-copies.test.trbpins the full note with the hint (IR level, two programs, and the renderer with an index expression) and without it (no list, and a line that does not write the named list);tests/command-line/arguments.expectedshows the extended note of the CLI program.docs/tooling/torb-build.md(example and a paragraph),docs/PERFORMANCE.mdsection 6, and the generatedskills/copy.Map owners: the analysis does not report nested writes through a map today (a map element is taken out and put back by the lowering, not written through an
Elementstep), so no note with a map owner exists to hint at.Test
Nothing run locally (no bootstrap, per the loop rules); tier A in the forge CI covers
compiler/tests,tests/command-line,docs,skills --checkandformat --check.Seed
None: the flag is not used by the compiler's own build, so one commit.
8e89d0e6be917f6bd0eb--explain-copieshint line for nested writes (take out, put back) #302Checklist (head
917f6bd):tests/command-line/arguments.expected) pin the full note with the hint; renderer tests pin hint (index expressionrow + 1), no list, and a line that does not write the named list. CI green on this head (tier A, tier B, bootstrap, gates, pdisc).Elementstep into a named list slot; arrays, fields, deeper paths and unnamed bases keep the single reason line.renderNotere-checks that the source line starts with<list>[<key>]at the note column, so names are never guessed; spare name avoids existing slot names.Non-blocking:
cells2collision path inspareNameInand the array/field exclusion inlistHoldingElementhave no direct test (the no-hint renderer tests pass an emptylistby hand). A small IR-level program for each would pin them.