# Session save — 2026-09-22 (m2compiler-V3, step 7: syslib port) ## Where we are HEAD: `a9e1f77`. Milestone tags `v3-step7` and `v3-step7.1`. Suite **103/103** (all run via `qbe → cc → run`; 7 sessions, 4 session-output, 2 session-input, 4 trap-aborts, + rejects). Build is warning-free (only the known-benign Coco TypeBlock LL(1) advisory). Tree clean; `git.txt` untracked (ignored). No remote. ## Tag lineage (this session, all green at each tag) - `v3-step5.1`…`5.7` — FFI (`EXTERNAL`) + C shim; `SysIO`; HIGH/LEN; `Strings`/`TextIO`; `Math` (libm) + `WholeIO` + input; `Files`; module-qualified symbols + real qualified access; `ADDRESS`/`ADR`/ `SIZE` + `Storage`. - `v3-step6.1` (99) — `CHR`/`ORD`/`VAL`/`ABS`/`INC`/`DEC`. - `v3-step6.2` (100) — true 64-bit `LONGINT`/`LONGCARD`. - `v3-step7` (102) — value open-array formals; syslib gate; bootstrap ABI analysis. - `v3-step7.1` (103) — self-hosted `runtime/syslib/SysShim` + `FileIO` (V3-only). `stdlib/`: sysio, textio, strings, wholeio, math, files, storage. `runtime/syslib/`: shim.c, SysShim, FileIO. ## Language / toolchain status (short) Full scalar + composite types, pointers/NEW/DISPOSE, records+WITH, sets+IN, arrays (length-prefixed), procedures (value/VAR/array params, recursion, nested + static-link display), separate compilation (def/impl, FROM/IMPORT, qualified, opaque completion), `DEFINITION`/`IMPLEMENTATION`, `HIGH`/`LEN`/`SIZE`/`TSIZE`/`ADR`/ `NEW`/`DISPOSE`/`CHR`/`ORD`/`VAL`/`ABS`/`INC`/`DEC`, 64-bit longs, `ADDRESS` + `Storage`, FFI. 103 tests. ## Step 7 outcome (the important part) Goal was "port `FileIO` off gm2-only libs". Attempting it exposed a **fundamental bootstrap ABI conflict**: gm2's `ARRAY OF CHAR` is a NUL-terminated `char*` and its FFI is `DEFINITION MODULE FOR "C"` + `EXPORT UNQUALIFIED`; V3's is a length-prefixed descriptor with `PROCEDURE …; EXTERNAL;`. One `FileIO` can't serve both. Resolution taken: **bootstrap split** (as Blaise does with FPC) — stage 1 keeps the host `FileIO`; stage 2 links the self-hosted `runtime/syslib/FileIO` (over `SysShim`/`shim.c`). Delivered and tested (`FioProg` → 42). ## Remaining for step 8 (self-hosting fixpoint) 1. **Redux sweep of the compiler's own sources** so V3 can compile them: `0C`/`15C`/`177C`/`32C` char-code literals → `CHR(n)`; `&`/`~`/`<>` → `AND`/`NOT`/`#`. (Compiler sources are otherwise syslib-clean; only `FileIO` uses gm2-only libs, and it stays the stage-1 host lib.) 2. **FileIO selection between stages** in the build (stage 1 host, stage 2 `runtime/syslib`). 3. Then `bootstrap/fixpoint.sh`: Stage1 (gm2) → Stage2 (V3) → Stage3 (V3), `diff -r` all `.ssa` byte-identical, suite green on all three stages (rolling-bootstrap design per the Blaise map). Deferred everywhere: class lowering (vtable/`THIS`), procedure-type variables, cross-class `VAL`/`CAST`, `FLOAT`/`TRUNC`, `CAP`, long↔REAL conversions, strings escapes, `WITH`-field `VAR` actuals. ## Resume commands ```sh cd /home/eric/Projets/Projets-Modula2/MyWork/m2compiler-V3/compiler ./build.sh && ./run_tests.sh # expect 103/103, zero gm2 warnings ``` Recommended next: the compiler-source Redux sweep (step 8 prep).