Procházet zdrojové kódy

docs: hash index made session re-emit fast but trips V3 miscompiles (reverted)

Eric Streit před 6 dny
rodič
revize
8d31f24c6a
1 změnil soubory, kde provedl 22 přidání a 15 odebrání
  1. 22 15
      docs/summary_lower_l7.md

+ 22 - 15
docs/summary_lower_l7.md

@@ -68,18 +68,25 @@ failed, using an uninitialised `np` — so the loop ran ~forever inside
 `ParamInfo` is guarded.  Also grew the AST arena/pool (`caeeeb5`) — the
 arena/pool data lines are compact `z` runs, so this is nearly free.
 
-## What remains for the session re-emit
-- **Correctness:** `MaxProc`/`MaxSym` must be ≥ the session's proc/var
-  counts (the compiler has hundreds of procs; 64 is too small), so
-  procs beyond the cap are currently skipped.
-- **Performance:** `FindSym`/`FindProc` are linear scans, and `Lower`
-  looks up per node — O(nodes × table size).  A whole-session re-emit is
-  very slow.  A hash index (or reusing `SymTab` for module-level names)
-  would fix it.
-- **Size-dependent behaviour:** with `MaxProc = 1024` the same run
-  **segfaults** (in `CopySpan` via `ParamInfo`) — a size/layout-sensitive
-  latent bug, the same family as the earlier `ASTDUMP` fragility.
-
-So the session re-emit is capacity-fixable but needs (a) a fast lookup
-and (b) the size-dependent bug isolated.  The grammar rewrite remains the
-alternative flip path.
+## Hash index attempted — also trips V3 miscompiles
+Implemented an open-addressing name index (`HashName`/`HashGetSym`/
+`HashGetProc`) for `FindSym`/`FindProc` in `Lower`.  Results:
+
+- With the index, the session re-emit on the compiler's sources became
+  **fast** (`MaxProc=512` completed in <300 s; before it hung).
+- But the tables must hold the whole session (the compiler has **713**
+  functions, so `MaxProc ≥ 713`), and at `MaxProc ∈ {768,1024}` the same
+  run is **slow/segfaults** (`CopySpan` via `ParamInfo`) — the
+  size/layout-sensitive bug again.
+- Worse, the hash itself makes the **self-host fail**: with the index in
+  `Lower`, `m2s2` (built by `m1s1`) produces no output on the compiler
+  input (stage 3).  So the index triggers *another* latent V3 miscompile.
+
+Reverted to the green state (`a9a8ecd`).  Suite 204/204.
+
+## Conclusion
+Three separate latent V3 bugs now block the whole-session re-emit:
+(a) the `ProcInfo` garbage-`np` loop (fixed), (b) a size/layout-sensitive
+miscompile at large tables, (c) a miscompile triggered by the hash code.
+Until (b)/(c) are isolated, the session re-emit is impractical, and the
+**grammar rewrite** remains the more predictable flip path.