summary_step6.2.md 1.8 KB

V3 step 6.2 — true 64-bit LONGINT/LONGCARD (done 2026-09-22)

LONGINT/LONGCARD were aliases of the 32-bit int family; now they are real 64-bit values (QBE l). Suite 100/100. LL(1)-clean, zero gm2 warnings.

Types (SymTab)

  • New form FLong and descriptor dLong; LONGINT/LONGCARD predefine to it. New class ClLong (13).
  • IsLongFamily; TypeSize(FLong) = 8.
  • Rules: ArithCheck promotes long/long and long/int → dLong; UnaryCheck long → dLong; Assignable allows int → long (widening) but not long → int; EqCheck/OrdCheck accept long pairs.

Backend (QbeGen)

  • ResClass(ClLong) = "l"; ElemSize/ElemLoad/ElemStore treat long as 8-byte (loadl/storel); AllocLocal gives long locals an 8-byte slot; module-level long data emits { l 0 }.
  • LoadLong/StoreLong (same-scope, up-level, and global paths); WidenLong (extsw, INTEGER → LONGINT); CmpLong (ceql/cnel/csltl/cslel/csgtl/csgel).

Grammar

  • Design loads long vars via LoadLong; assignment stores via StoreLong and widens int sources; SimExpr/Term use Op3L (add/sub/mul/div/rem at l width) and widen int operands; Expr uses CmpLong and widens int operands; VarDecl accepts ClLong.

Test

t_long → 42: 1_000_000 * 1_000_000 (= 10^12, past 32 bits), divide back, compare, and +5. Image shows extsw, =l mul/div, ceql/csgtl.

Notes / deferred

  • FOR bounds stay integer-family (IsIntFamily excludes long); the loop variable must be INTEGER/CARDINAL.
  • REAL ↔ LONGINT conversions and long→int narrowing (TRUNC/VAL) are not yet wired — assignment long → int is 210.
  • System call argument widths: only integer-sized args are passed to libc today (sizes/counts are small in current use).