|
|
@@ -1,33 +1,37 @@
|
|
|
-# Session checkpoint — Turbo-Modula-2 16→64 MCD translator + mc4x VM
|
|
|
+# SESSION.md — M2compiler mc64 VM (session close)
|
|
|
|
|
|
-Date: 13 sept. 17:4x. Working dir: `/home/eric/Projets/Projets-Modula2/MyWork/M2compiler/Resources/mc64`
|
|
|
-(real absolute roots vary; use `find` when resolving .MCD inputs).
|
|
|
+Tree: /home/eric/Projets/Projets-Modula2/MyWork/M2compiler (git root, committed)
|
|
|
+West: mc64/ (16bit->64bit translator + 64bit VM mcint). Locked translator:
|
|
|
+ trans8to64.mod md5 5f922946 (pristine, restored via git checkout, build rc=0
|
|
|
+ with FileIO.o Console.o; no corruption, no regression)
|
|
|
+git: clean; mc64/SESSION.md tracked; Resources/ never tracked (per bb5e767).
|
|
|
|
|
|
-## State: WORKING
|
|
|
-- `trans8to64` : 16-bit `Foo.MCD` -> 64-bit `Foo64.MCD` (mc64 VM image).
|
|
|
- - Build: `gm2 -fiso -o trans8to64 trans8to64.mod FileIO.o Console.o` (add `-g` for dbg build).
|
|
|
- - `Extended.MCD` -> clean rc=0 now (was aborting rc=134). All 9 spec modules translate;
|
|
|
- only `MCODE.MCD` fails BY DESIGN (114-B entry stub, no 304-byte descriptor plane).
|
|
|
-- `mcint` : 64-bit VM that loads a translated image and runs it.
|
|
|
- - Build (full object set — do NOT prune):
|
|
|
- `gm2 -fiso -o mcint mcint.mod Loader2.o Interpreter.o Instruction.o Local.o Stack.o
|
|
|
- Memory.o Global.o Extended.o Console.o FileIO.o`
|
|
|
- - Verified: `mcint /tmp/Stack64h.MCD` -> rc=0 (end-to-end).
|
|
|
+## Session result (HONEST: dependency-chain milestone NOT completed)
|
|
|
+Assigned: Loader2 dep-chain so Extended/Array/Local (dcnt=1, dep=STACK) run under mcint.
|
|
|
+Attempts: several assert-first literal patches to trans8to64.mod — most aborted on
|
|
|
+ literal mismatch (no writes); ONE landed but had LONGCARD/CARDINAL type bug at the
|
|
|
+ tail (imgLen : CARDINAL), caught by build rc=1 BEFORE any image emit → git checkout
|
|
|
+ restored pristine md5 5f922946. Net: no corruption, no regression, translator verified
|
|
|
+ re-buildable, git clean.
|
|
|
|
|
|
-## Last bug fixed (this session)
|
|
|
-gm2 `FOR j := 0 TO vcnt - 1` with `vcnt = 0` underflows an binds loop 65536x ->
|
|
|
-`Get16`/descriptor overrun on `Extended.MCD` (rc=134). Fix: wrap each of the two
|
|
|
-var-sizes loops in `IF vcnt > 0 THEN ... END` in `trans8to64.mod` (read+write both),
|
|
|
-and the proc-scan loop in `IF nEnt >= 2 THEN`. Also patched `Interpreter.mod` 0CDH:
|
|
|
-default/out-of-range case now `Push (eot + t)` (was `Push (eot)`) — honours 16-bit
|
|
|
-return offset.
|
|
|
+Why stopped: the 64-bit loader binds ONE module window into slot 0 and hard-fences
|
|
|
+ dcnt#0 at Loader2.mod:57. Real dep-chain = proper multi-module VM feature:
|
|
|
+ (1) translator carry dcnt + dcnt*8-byte dep-name table appended at image tail
|
|
|
+ (WB (DescDepCount, dcnt); imgLen := imgLen + dcnt*8; CARDINAL-typed all the way);
|
|
|
+ (2) Loader2 chain-load a sidecar dep image into module slot 1 before slot 0
|
|
|
+ (multi-window arena);
|
|
|
+ (3) MC64 already resolves cross-module procs (nw DIV 16 = module, nw MOD 16 = proc,
|
|
|
+ Interpreter.mod:743-744 via FindModuleBase) — VM side is ready; loader link missing.
|
|
|
|
|
|
-## Known limits / next
|
|
|
-- `Extended64`/`Array`/`Local` translate but are `dcnt=1` (depend on loader-chain
|
|
|
- modules); cannot run standalone under `mcint` yet -> needs dependency-chain loading.
|
|
|
-- Original 16-bit stack images themselves run under the 16-bit VM, not `mcint`.
|
|
|
+## NEXT SESSION — exact starting byte-verified state
|
|
|
+ cd /home/eric/Projets/Projets-Modula2/MyWork/M2compiler/mc64
|
|
|
+ md5sum trans8to64.mod # must print 5f922946 (locked)
|
|
|
+ git status # must be clean
|
|
|
+ gm2 -fiso -o trans8to64 trans8to64.mod FileIO.o Console.o # must rc=0
|
|
|
+ Then the Loader2 dep-chain milestone above. All writes go through FileIO.o Console.o
|
|
|
+ (NOT the foreign FIO.o used in a lost earlier glob). Build rc != 0 => stop, restore.
|
|
|
|
|
|
-## Files
|
|
|
-- `mc64/trans8to64.mod`, `mc64/Interpreter.mod`, `mc64/mcint.mod` — the code.
|
|
|
-- Binaries: `trans8to64`, `trans8to64dbg`, `mcint`.
|
|
|
-- Test outputs: `/tmp/Stack64h.MCD`, `/tmp/Extended64g.MCD`, `/tmp/Array64*.MCD`...
|
|
|
+## Regression that stayed green (from earlier verified runs this tree)
|
|
|
+ Stack.MCD -> trans8to64 -> Stack64.MCD -> mcint : rc=0
|
|
|
+ 9-spec translator regression: Stack, Array, Local, Extended, Instruction, Loader,
|
|
|
+ Console, FileIO, MCODE-stub: 8 ok / 1 skip (the translator never regresses these).
|