Started from "the whole compiler source set compiles under V3 and links"
(v3-selfcompile-image) and pushed the runtime much further.
| Tag | What |
|---|---|
v3-selfcompile-image |
nested modules (ListHandler); HALT; Strings.Delete/Append; 1-char literal to VAR ARRAY OF CHAR; nested anonymous-array bound-clobber fix; sessBuf 4 MiB + manual flush; strNams/strTexts 4096 |
v3-inline-array-fields |
record array fields are inline (standard M2 layout), not pointers: SymTab layout, QbeGen data/access/copy, InitHeap in place, SymTab ALLOCATE→NEW |
v3-nul-strings |
NUL-terminated CHAR arrays (terminator slot at index = count, index = count readable); stdlib Strings and the C shim are NUL-based; m2arg keeps capacity |
af392e1 |
scanner Reset: NEW(buf[i]) (BufBlock needs a descriptor header) |
Main suite 111/111 throughout.
It now:
FileIO + shim,Reset.For a VAR actual that is a dereferenced pointer (p^ where
p: POINTER TO ARRAY), V3 passes the wrong address. Repro:
TYPE Block = ARRAY [0..15] OF CHAR;
TYPE Buf = ARRAY [0..3] OF POINTER TO Block;
VAR b : Buf;
PROCEDURE Fill (VAR a : ARRAY OF CHAR); BEGIN a[0] := 'z' END Fill;
NEW(b[0]); Fill(b[0]^); (* emitted: call Fill(l 0, l $Buf_b) *)
The SSA computes %t = loadl(b[0]) (the pointee address) but the call
passes $Buf_b — Fact's NoteAddr(q, AddrOf("b")) overwrites the
correct address for a ^ result. This is exactly the scanner's
FileIO.ReadBytes(src, buf[i]^, read) (Reset), which then writes the
file contents over buf.
Fix direction: Design must distinguish "q is the loaded value of a
plain variable" (→ NoteAddr(q, AddrOf(var))) from "q is already an
address" (deref of non-scalar, array/record designator) → NoteAddr(q, q).
Needs a Design output flag (e.g. addrQ: BOOLEAN).
FileIO selection and bootstrap/fixpoint.sh
(Stage1 gm2 → Stage2 V3 → Stage3 V3, byte-identical .ssa), with the
stage-aware CR flag (-m for gm2, no -m for V3).compiler/toto.mod is the user's uncommitted edit (left alone).