summary_session-2026-10-23-open-arrays.md 5.0 KB

Session 2026-10-23 — multi-dimensional open arrays (M1–M4)

Continued on 2026-10-24 with record fields and constructors: see summary_session-2026-10-24-open-arrays-m5.md.

Same-day continuation of the range-check/PACKEDSET and ISO-exception sessions. This session implemented the open-array ABI in four steps: fixed storage, open views/calls, and payload SIZE/ADR.

Branch: master. Feature state: open-array M4 (v3-open-arrays-m4), on top of v3-finally. Gates at the end: suite 295/295, fixpoint OK (3,480,366 bytes), corpus 518/612 compile-OK, 0 crashes.


Numbers

gate start (M1) end (M4)
suite (compiler/run_tests.sh) 283/283 295/295
fixpoint (bootstrap/fixpoint.sh) 4,198,600 B 3,480,366 B
corpus (tools/v3-corpus/corpus.sh) 512/612 518/612, 0 crashes

Corpus additions: unbounded, unbounded2, unbounded3, unbounded4 and array9 compile; the first four also run. unbounded6/unbounded8/adrunbounded3 remain declaration-order cases under V3 policy (their variables are declared after the procedures). The corpus is compile-only; it is not a run gate.


What landed

M1 — type/ABI helpers (2cc6776)

  • SymTab.ArrayRank, SymTab.IsMultiArray.
  • SymTab.ArrayLeafBytes, SymTab.ArrayStride, and SymTab.ArrayPayloadSize.
  • MaxDefer 256 → 512 and the session SSA buffer 4 → 8 MiB.
  • Design document: docs/design-open-arrays.md.

M2 — fixed multi-dimensional storage (4616e51)

  • Rank-2/3 fixed arrays use one contiguous payload and a chain of 40-byte views: {count, elemBytes, stride, base, next}.
  • Static multi arrays emit a view chain, per-level templates and a flat zero payload. Locals allocate views/templates + payload and initialize them in the frame.
  • ViewIndex returns a copied next-level view for array selectors and a scalar address at the leaf.
  • Pointer-to-multi indexing and NEW initialization work.
  • Whole-array copy uses the flat payload; old nested static constructors are converted by CopyOldNestedToView.
  • Rank-1 row views are adapted to the legacy 1-D {count,data} descriptor (copy-in/copy-back for VAR) as an interim ABI bridge.
  • Regression: t_multidim_local; existing t_multidim, t_array, t_ctor3, t_nestidx, t_nestarr, t_ptrnest and showcase6 stay green.
  • Tag v3-open-arrays-m2.

M3 — open view descriptors (557addb)

  • Nested open formals (ARRAY OF ARRAY OF …) parse.
  • Type compatibility accepts same-rank fixed/open arrays with the same leaf type, and ARRAY OF BYTE/SBYTE accepts any array rank for flattening.
  • Fixed/open multi actuals and rank-2/3 subviews pass as ArrayView pointers; open-to-open forwarding and VAR writes go straight to base.
  • Open formals index through count/stride/base/next; HIGH/LEN read the view count.
  • Added: t_open2d, t_open2d_value, t_open2d_high, t_open2d_nested, t_open3d, t_open3d_row, t_open_row_to_1d, t_open_flatten_byte.
  • Tag v3-open-arrays-m3.

M4 — array builtins (df72d03)

  • SIZE/TSIZE now use payload bytes for arrays:
    • fixed 1-D count * leaf;
    • open 1-D count * element;
    • multi views runtime count * elemBytes;
    • descriptor headers and the hidden 1-D CHAR terminator are excluded.
  • ADR:
    • multi view/row → view.base;
    • 1-D open descriptor → descriptor + 8;
    • fixed 1-D → existing descriptor address (pointer-to-array compatibility);
    • scalar/selected element → its address.
  • External 1-D compatibility descriptors include the CHAR/UCHAR terminator; the temporary descriptor is still freed after VAR copy-back.
  • Added: t_open2d_size, t_open2d_adr, t_open1d_size_adr. unbounded3 runs with SIZE 60/12/2/2.
  • Tag v3-open-arrays-m4.

Remaining

  • M5 (done 2026-10-24): multi-dimensional record fields, arrays of records with multi fields, and constructors using the flat/view layout; see summary_session-2026-10-24-open-arrays-m5.md.
  • Optional follow-up: migrate the legacy 1-D descriptor itself to a pointer-based view. Row → 1-D still uses a copy-in/copy-back bridge, so row ADR identity through an internal 1-D call is not preserved. Writes are preserved.
  • unbounded6/unbounded8/adrunbounded3 still fail declaration order by policy; do not relax it for corpus count.
  • Comparison/README/STATUS/features/INDEX were refreshed for M4.

Commits and tags

commit tag work
2cc6776 — M1 type/ABI helpers
0f422ae — open-array design document
4616e51 v3-open-arrays-m2 fixed rank-2/3 flat storage + views
7c02646 — M2 docs/tag map
557addb v3-open-arrays-m3 open multi-array views + call conversion
fb90c8f — M3 docs/tag map
df72d03 v3-open-arrays-m4 payload SIZE/TSIZE, view ADR
this docs commit v3-open-arrays-m4-summary session summary
final docs commit v3-session-2026-10-23-open-arrays-end session tag

No push was performed.