|
@@ -0,0 +1,115 @@
|
|
|
|
|
+# Next session — plan (from 2026-10-23)
|
|
|
|
|
+
|
|
|
|
|
+**Branch:** `master`. **Feature state:** `v3-rangechecks`.
|
|
|
|
|
+**Gates:** suite **262/262**, fixpoint **OK (4,032,793 bytes)**,
|
|
|
|
|
+corpus **511/612, 0 crashes**.
|
|
|
|
|
+
|
|
|
|
|
+Read first: `docs/STATUS.md`, `docs/features.md`,
|
|
|
|
|
+`docs/gaps/README.md`, `docs/summary_session-2026-10-23.md`.
|
|
|
|
|
+
|
|
|
|
|
+## Policy reminder
|
|
|
|
|
+
|
|
|
|
|
+V3 follows **PIM/ISO Modula-2**, not gm2 leniencies. Declaration before
|
|
|
|
|
+use is required for data; only a `POINTER`'s base may forward-reference.
|
|
|
|
|
+gm2 compatibility is accepted only where documented in `docs/gaps/`.
|
|
|
|
|
+
|
|
|
|
|
+## 1. `PACKEDSET` — 3 files (`onebyte`, `onebyte2`, `onebyte3`)
|
|
|
|
|
+
|
|
|
|
|
+Inspected 2026-10-23; **not** a safe alias to `SET`:
|
|
|
|
|
+
|
|
|
|
|
+- `SIZE(PACKEDSET OF [0..7]) = SIZE(BYTE) = 1` (asserted);
|
|
|
|
|
+- `ORD(set)` is used (`ORD(si) = 2`, `ORD(se) = 32`);
|
|
|
|
|
+- arrays of packed sets (`onebyte3`) check neighbouring bytes.
|
|
|
|
|
+
|
|
|
|
|
+A faithful implementation needs:
|
|
|
|
|
+
|
|
|
|
|
+- a type form/class for packed sets with a **byte width**
|
|
|
|
|
+ (`ceil(span / 8)`; 1/2/4 bytes for the corpus, possibly an impl limit
|
|
|
|
|
+ beyond 32 bits);
|
|
|
|
|
+- `TypeSize`/`ElemBytes` = width; `SIZE` = width;
|
|
|
|
|
+- packed loads/stores (`loadub`/`loaduh`/`loadw` + `storeb`/`storeh`/
|
|
|
|
|
+ `storew`) for variables, fields, arrays and parameters;
|
|
|
|
|
+- set operations on packed masks: literal, assignment, `INCL`/`EXCL`,
|
|
|
|
|
+ `IN`, `=/#`, union/diff/intersection, `ORD` of a set;
|
|
|
|
|
+- range/mask checks consistent with the set span.
|
|
|
|
|
+
|
|
|
|
|
+Until then, the three corpus files stay `LANG` (documented in
|
|
|
|
|
+`docs/gaps/README.md`). Do not map `PACKEDSET` to `SET` merely to raise
|
|
|
|
|
+the compile count.
|
|
|
|
|
+
|
|
|
|
|
+## 2. ISO exceptions — 7 files (`except2/4/5/7/8/9`, `lazyunique`)
|
|
|
|
|
+
|
|
|
|
|
+A dedicated feature session, not a small fix:
|
|
|
|
|
+
|
|
|
|
|
+- `EXCEPT` / `RETRY` after a normal statement sequence (procedures and
|
|
|
|
|
+ module bodies);
|
|
|
|
|
+- `EXCEPTIONS` (`AllocateSource`, `RAISE`, `CurrentNumber`,
|
|
|
|
|
+ `GetMessage`, `IsCurrentSource`, `IsExceptionalExecution`) and
|
|
|
|
|
+ `M2EXCEPTION`;
|
|
|
|
|
+- runtime handler model (handler stack / `setjmp`-`longjmp` or
|
|
|
|
|
+ equivalent), re-raise on unhandled;
|
|
|
|
|
+- `lazyunique` additionally needs ISO `UNIQUE`.
|
|
|
|
|
+
|
|
|
|
|
+Design the handler model first; then implement with trap tests.
|
|
|
|
|
+
|
|
|
|
|
+## 3. Multi-dimensional open arrays — 8 files
|
|
|
|
|
+
|
|
|
|
|
+`unbounded`, `unbounded2/3/4/6/8`, `array9`, `adrunbounded3`. **Do not
|
|
|
|
|
+just accept them**: V3 uses a descriptor per level; gm2 passes a flat
|
|
|
|
|
+block with strides, and the corpus checks `ADR(m) = ADR(m[0])` and flat
|
|
|
|
|
+`SIZE`. Decide on an ABI (flat/strided descriptor) before implementing;
|
|
|
|
|
+otherwise leave parked. `unbounded5` is a declaration-order case, not
|
|
|
|
|
+this feature.
|
|
|
|
|
+
|
|
|
|
|
+## 4. Runtime range checks — done, follow-ups
|
|
|
|
|
+
|
|
|
|
|
+`Lower.CheckSub` covers assignment, value actuals, `RETURN` and
|
|
|
|
|
+`INC`/`DEC`; the `FOR` final increment is exempt. Possible follow-ups:
|
|
|
|
|
+
|
|
|
|
|
+- `LONGINT`/`CARDINAL` subranges (currently skipped);
|
|
|
|
|
+- `FOR` control variables (decide whether to range-check the initial
|
|
|
|
|
+ bound only, as now);
|
|
|
|
|
+- trap tests for CHAR/enum subranges (currently integer).
|
|
|
|
|
+
|
|
|
|
|
+## 5. Library folders / separate compilation — deferred plans
|
|
|
|
|
+
|
|
|
|
|
+- `docs/plan-separate-compilation.md` — stable symbols, per-unit
|
|
|
|
|
+ objects, init order, linker; and the appendix on dialect folders.
|
|
|
|
|
+- Library-folder layout (`lib/pim`, `lib/iso`, `lib/m2r10`, shared
|
|
|
|
|
+ `runtime/syslib`) is a low-risk build change, to do after the
|
|
|
|
|
+ compiler language work; no need to mix dialects in one session.
|
|
|
|
|
+
|
|
|
|
|
+## 6. Corpus leftovers (classify first)
|
|
|
|
|
+
|
|
|
|
|
+`ptrarray3` (open-array actual), `unbounded7` (2-D actual for
|
|
|
|
|
+`ARRAY OF BYTE`), `adraddress` (ADDRESS/pointer compare), `proc` /
|
|
|
|
|
+`shift3` / `shift4` (decl-order), `constprocedure`/`constvec3`/
|
|
|
|
|
+`conststrarray` (mostly ordered decls). Park gm2 extensions, wide sets
|
|
|
|
|
+(`settest1/3`) and `CHAR.mod` as before.
|
|
|
|
|
+
|
|
|
|
|
+## Gates for every step
|
|
|
|
|
+
|
|
|
|
|
+```sh
|
|
|
|
|
+cd compiler && ./build.sh && ./run_tests.sh # 262/262
|
|
|
|
|
+cd .. && TMP="$PWD/.scratch/fixpoint" ./bootstrap/fixpoint.sh
|
|
|
|
|
+tools/v3-corpus/corpus.sh # 511 OK, 0 crash
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Update `STATUS.md`, `features.md`, `gaps/`, the comparison table and a
|
|
|
|
|
+session summary; commit with a `v3-*` tag. Do not push without asking.
|
|
|
|
|
+
|
|
|
|
|
+## Resume
|
|
|
|
|
+
|
|
|
|
|
+```sh
|
|
|
|
|
+cd .../m2compiler-V3
|
|
|
|
|
+git checkout master
|
|
|
|
|
+cd compiler && ./build.sh && ./run_tests.sh # 262/262
|
|
|
|
|
+cd .. && TMP="$PWD/.scratch/fixpoint" ./bootstrap/fixpoint.sh
|
|
|
|
|
+tools/v3-corpus/corpus.sh # 511 OK, 0 crash
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+**Recommendation:** implement `PACKEDSET` properly (it is the only
|
|
|
|
|
+small, self-contained language feature left in the current handoff), or
|
|
|
|
|
+take the ISO exceptions design if you want a larger block. Leave
|
|
|
|
|
+multi-dimensional open arrays and library/separate-compilation work for
|
|
|
|
|
+their own sessions.
|