Procházet zdrojové kódy

feat(symtab): nesting per call-graph, record views, prefix 7/14

Eric Streit před 4 dny
rodič
revize
a3fc3f39ab
2 změnil soubory, kde provedl 25 přidání a 1 odebrání
  1. 24 0
      SESSION.md
  2. 1 1
      src/compiler/SYMTAB.MOD

+ 24 - 0
SESSION.md

@@ -147,3 +147,27 @@ Next: GENZ80 media hunt; stage-2 pty-driven MCD diff per module.
 - Next: re-read prefix bodies (PutAttr/GetAttr/AllocSym/FindModule first)
   against symtab.txt statement-by-statement; keep heap discipline (flat,
   minimal nodes). VM path still open for full-module compile.
+
+## SYMTAB session 2026-10-07b (nesting model + record views, prefix 7/14)
+- CALL GRAPH (mnemonic-authoritative, unassemble.c): `ee`=sibling/self display
+  call (ZZ-proven under v1.00), `ec`=downward (parent->nested child), `ed/f/ef`
+  = display-free. FORCED nest map: AllocSym{CheckNode,NewString,PutAttr},
+  EnterIdent{GetName,GetAttr}, CompileDispatch{35,36,37/TryCompile}, + {32}@2,
+  {34}@33, {38}@6, {25}@24, {27}@26, {29,30,31}@28. Rest top-level. Gap-`ff`
+  bytes decode as phantom calls — ignore trailing-ff "calls". proc16 dead.
+- Restructured SYMTAB.MOD accordingly (nested, forwards trimmed to the 2
+  cycle-breakers). v1.00 emits ee/ec exactly like the original. Zero-cost:
+  transfers emit no code; view-field TYPES are byte-neutral (all 1-word).
+- Record-field views (LSW/SSW) replace Words indexing (LXW) everywhere:
+  new local Entry type (CARDINAL/WORD/BITSET per dominant use); T1 direct
+  for nodes. Proven: `i * 16` folds to `shl` (v1.00 peephole — swap all
+  `N * x` with power-of-2 N); open-array actuals push HIGH (GetName view
+  is [0..128], not [0..127]); declared exceptions emit small codes
+  (NodeErr=273 vs orig 272, 1B documented); `ADDRESS<CARDINAL` etc. need
+  CARDINAL() views; LSWn pops base (Indirect.mod); `=` on arrays = inline
+  string_comp with (addr,size) pairs.
+- Prefix score 7/14 exact (FINDMO/ENTERM/LOOKUP/MATCHS/NEWSTR/ENTERC/GETNAM).
+  CHECKN=1B (exception code). Left: PUTATT/ALLOCS/GETATT detail (frames,
+  guard polarity (accepted peephole class), leave-vs-jump (heap-driven flat
+  kept), stack-threaded temps (accepted)). ENTERI wall stands (full build).
+- Slot map COMPILER.DEF re-verified 1:1 (systemScopeDesc=23 etc.).

+ 1 - 1
src/compiler/SYMTAB.MOD

@@ -280,8 +280,8 @@ BEGIN
     SymbolAssert(i <= scopeCap, 86); (*{/*0137*/}*)
     scopeTop := i;
     e := EntryPtr(scpHeap + scopeTop * 16);
-    e^.w1 := CARDINAL(src); (*{/*0141*/}*)
     slot := scopeTop; (*{/*0149*/}*)
+    e^.w1 := CARDINAL(src); (*{/*0141*/}*)
     RETURN;
   END;
   SymbolAssert(scopeTop < scopeCap, 86); (*{/*014f*/}*)