commit acedb457be1a08f21d74c95ab53cc0825455b2b6
parent 8199c01966dbfe93f649fe2d817329d1aa426b42
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Sun, 14 Jun 2026 06:02:56 -0700
doc(plan): FRONTEND-SHAPE §D — sharpen 'no fusion': module separability is the invariant; inter-module APIs/handoffs are in scope to redesign
Diffstat:
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/doc/plan/FRONTEND-SHAPE.md b/doc/plan/FRONTEND-SHAPE.md
@@ -76,14 +76,20 @@ to "crush," only a pervasive per-token / per-operation tax to remove everywhere.
representation's savings **compound when adopted wholesale** — the inner loop gets
uniformly cheaper across *all* phases at once — in a way the incremental spikes
(a lean *cache layered on top of* the heavy objects) structurally could not show.
-- **No layer fusion.** The pipeline stays factored: **lexer | preprocessor | parser
- | CG | emit remain distinct streaming modules**, boundaries intact. The shared
- cpp still backs `cc -E`/`cpp`; the parser stays separable; the `CgTarget` seam and
- the seven backends stay. We do **not** merge the stages' control flow. **The win
- comes from the data that flows, not from merging the loops.**
-
-In one line: **replace the heavy general data objects with lean ones on the hot
-path; leave the modules that pass them around exactly as separated as they are.**
+- **No layer fusion — but APIs and handoffs are fair game.** The pipeline stays
+ factored: **lexer | preprocessor | parser | CG | emit remain distinct,
+ separately-reusable modules** — the test is that the cpp still stands alone for
+ `cc -E`/`cpp`, the parser stays separable, and the `CgTarget` seam + seven
+ backends stay. What is preserved is module **separability**, *not* the current
+ interfaces: the **inter-module APIs and per-token handoffs are explicitly in scope
+ to redesign** (e.g. call/return-per-token → a shared cursor over a lean token
+ buffer, or a leaner pull). We do **not** merge the stages' control flow into one
+ pass. **The win comes from the data that flows and how it is handed off, not from
+ merging the loops.**
+
+In one line: **replace the heavy general data objects with lean ones, and the
+per-token handoffs with cheap ones; leave the modules themselves as separable as
+they are.**
### D.4 The load-bearing risk — validate before building the full lane
@@ -98,9 +104,11 @@ floor for a modular C compiler** and we stop there. This validation gates the sp
### D.5 Open design questions for the lean lane (after D.4 validates)
-- **Inter-layer handoff without fusion:** how separate modules pass the lean
- representation cheaply (a shared cursor over a lean token buffer? a leaner pull?)
- — killing the per-token call/copy tax *without* collapsing the loops.
+- **Inter-layer handoff (sanctioned lever, not just open):** redesign how separate
+ modules pass the lean representation — kill the per-token call/copy tax
+ (call/return-per-token → a shared cursor over a lean token buffer, or a leaner
+ pull) *without* collapsing the loops. Module **separability** is the only
+ invariant; the interfaces between modules are free to change.
- **Int-bitmask type on the hot path:** the encoding, and how it **falls back** to
the full `Type` / CG-type universe for what a bitmask can't carry (aggregates,
bitfields, VLAs, `_Atomic`, wide/`__int128`).