diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-01 12:01:57 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-01 12:01:57 -0700 |
| commit | 5ea32e69433d0c850d02bbc1e6c4a260bc095fec (patch) | |
| tree | ba4917ded278097332ee8f9f33227be74d3ac104 /skills | |
| parent | bf7f603dd4e8ec781fe578243cdc18180322420b (diff) | |
| download | Simple-5ea32e69433d0c850d02bbc1e6c4a260bc095fec.tar.gz Simple-5ea32e69433d0c850d02bbc1e6c4a260bc095fec.zip | |
Move debug printing into shared space
Same as the graph viewer, moves a lot of code out of all Nodes
Diffstat (limited to 'skills')
| -rw-r--r-- | skills/chapter25-codex-notes.md | 29 | ||||
| -rw-r--r-- | skills/graph-viewer-codex-notes.md | 8 |
2 files changed, 27 insertions, 10 deletions
diff --git a/skills/chapter25-codex-notes.md b/skills/chapter25-codex-notes.md index 041eba8f..c93266ab 100644 --- a/skills/chapter25-codex-notes.md +++ b/skills/chapter25-codex-notes.md @@ -648,15 +648,24 @@ Consequences: ## Side-effect-free diagnostics: B09 lessons -- Chapter 21's pre-scheduling `CodeGen.toString()` uses a separate CFG-only - RPO walk, then printer-local data placement. Walking CFG and data uses in - the same DFS can move a loop's closing Region before its body via Phi - backedges, even when CFG uses are visited first. Keep Loop/Region Phis - contiguous with their header, without pulling their backedge definitions - up to the header. Preserve function boundaries at Calls/Returns. This - correction remains queued for 22-25; 25 supplied the grouping approach but - still mixes CFG and data traversal. All printer bookkeeping uses identity - maps and raw edges, without invoking actual scheduling or dominator queries. +- Shared debug printing lives in `print/`; see its README for the API. All + chapter Nodes extend `BaseNode<Node>`, which owns the ID field, unique naming, + print/toString, and default expression formatting. Compiler constructors pass + IDs from their existing allocator to super; clone still assigns a fresh ID. + Simple hooks override `format()` with input slots (`%1`, `%10`, literal `%%`). + Custom protected `_print1` hooks use `p.p(...)`, `p.n(...)`, open/close, and + matching-suffix unchar. Every print tracks repeats; short constant types expand + repeatedly. Both IR and graph adapters consume the common indexed edge and + dependency accessors. Graph record/edge construction belongs in GraphAdapter; + chapters supply only their semantic roles, names, projections and grouping. +- Shared IR ordering finishes CFG RPO before placing data. Walking control and + data uses together can move a loop's closing Region before its body via Phi + backedges. Keep Loop/Region Phis contiguous with their header without pulling + backedge definitions up. Parm inputs belong to callers; stop at function + boundaries, and print globally shared floating expressions once with globals. + All traversal/placement state uses private identity maps and raw edges, without + invoking scheduling or dominator queries. Machine hooks must format correctly + into an initially empty buffer; multiline expansions are laid out centrally. - `Node._inputs` remains allocated after `kill()`. Use `isDead()` when printing or filtering dead nodes; an empty input array alone does not imply death. @@ -673,7 +682,7 @@ Consequences: display that recorded layout instead of asking Types to compute one. - Use the `_` prefix for no-side-effect variants of accessors: `CodeGen._link`, `RegAlloc._lrg`, `Var._type`, and the existing leaf `_isConstant` predicates. - The printer's local `_idepth` does not populate compiler dominator caches. + Shared printer placement must not populate compiler dominator caches. Keep mutating compiler accessors available for their normal jobs. - Audit the whole call chain from `Node.p(depth)`, `print`/`toString`, labels, scope/graph viewers, and machine `asm` methods. `link` prunes dead functions diff --git a/skills/graph-viewer-codex-notes.md b/skills/graph-viewer-codex-notes.md index 5b06bd6a..e4775e91 100644 --- a/skills/graph-viewer-codex-notes.md +++ b/skills/graph-viewer-codex-notes.md @@ -51,6 +51,14 @@ chapter25 Chapter13Test (16). This was NOT an all-chapter full test-suite run. ## Durable design and owner preferences +- Printer/viewer consolidation: all chapters' Node classes now extend + `com.seaofnodes.print.BaseNode<Node>`. GraphAdapter reads identity, raw indexed + edges, dependencies, labels, deadness and type text from that common contract. + It constructs node/edge records centrally. Chapter adapters retain semantic + kind/role rules, scope binding names, projection indices, call jumps and folding + state. The graph IDEA module depends on print; both Make source sets are already + compiled together. Browser protocol and grouping algorithms are unchanged. + - Shared Java capture/model and browser code live in graph/. Each chapter keeps a small SimpleGraphAdapter and SimpleGraphObserver, plus compiler callbacks. No Maven requirement. DOT compiler/viewer support is gone; existing docs GV/SVG |
