|
|
@@ -14,7 +14,7 @@ implement everything.
|
|
|
(3,845,439 bytes), per-object fixpoint OK (11 objects), corpus
|
|
|
521/612 compile-OK, 0 crashes, 64 `LANG` and 27 `LIB`.
|
|
|
|
|
|
-**Progress update 2026-10-27:** suite 327/327. The SQLite binding
|
|
|
+**Progress update 2026-10-27:** suite 328/328. The SQLite binding
|
|
|
is under `bindings/sqlite3` and has its own tests/showcases. Compiler
|
|
|
work completed since this note:
|
|
|
|
|
|
@@ -27,8 +27,8 @@ work completed since this note:
|
|
|
`VAL(ADDRESS, -1)`;
|
|
|
- `ADR(array)` remains descriptor-based for compatibility; C bindings
|
|
|
use `ADR(a[0])` for the data address;
|
|
|
-- absolute variables (`VAR x [addr] : T`) remain unimplemented; see
|
|
|
- section 2.1 below.
|
|
|
+- absolute variables (`VAR x [addr] : T`) are implemented at module level;
|
|
|
+ see section 2.1 below.
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -104,7 +104,7 @@ escape hatch.
|
|
|
|
|
|
---
|
|
|
|
|
|
-### 2.1 Absolute variables (`VAR x [address] : T`) — not implemented
|
|
|
+### 2.1 Absolute variables (`VAR x [address] : T`) — implemented 2026-10-27
|
|
|
|
|
|
GNU Modula-2 supports fixed-address variables:
|
|
|
|
|
|
@@ -119,36 +119,31 @@ memory-mapped I/O, firmware tables and embedded targets.
|
|
|
|
|
|
Current V3 status:
|
|
|
|
|
|
-- the syntax is rejected by `VarIdents` (`':' expected` / `'..' expected`);
|
|
|
-- gm2 corpus cases `varaddress`, `varaddress2`, `varaddress3` remain
|
|
|
- unsupported;
|
|
|
-- `docs/comparison-PIM4-gm2-V3.md` lists absolute variables as a V3
|
|
|
- missing feature.
|
|
|
-
|
|
|
-Implementation requirements:
|
|
|
-
|
|
|
-1. Parser: accept an optional `[constant-expression]` after each name in
|
|
|
- `VarIdents`; do not confuse it with the `[lo..hi]` type subrange.
|
|
|
-2. Constant folding: require a constant address, using the V3 `0x...`
|
|
|
- form (the gm2 `1000H` suffix is not currently accepted).
|
|
|
-3. Symbol table: add absolute-variable metadata (flag + address); expose
|
|
|
- it to `Lower`.
|
|
|
-4. AST/Lower: record the address; a designator of an absolute variable
|
|
|
- must produce the fixed address instead of `AddrOf`.
|
|
|
-5. QBE: do not emit a normal global data object or initializer for an
|
|
|
- absolute variable; emit direct loads/stores.
|
|
|
-6. `ADR(var)` must return the fixed address; passes to `VAR` formals and
|
|
|
- pointer-based access should remain addressable.
|
|
|
-7. Decide whether absolute variables are module-level only or also
|
|
|
- allowed locally.
|
|
|
-8. Document alignment/volatile limits: V3 has no `VOLATILE` annotation
|
|
|
- yet, so memory-mapped I/O still needs careful review.
|
|
|
-9. Tests: compile-only checks such as `ADR(var) = 0x1000`; avoid
|
|
|
- dereferencing arbitrary unmapped addresses in the normal suite.
|
|
|
- A runtime test needs a deliberately mapped address or an allocated
|
|
|
- buffer.
|
|
|
-
|
|
|
-Current workaround:
|
|
|
+- syntax accepted for module-level variables: `VAR v [0x1000] : CARDINAL`;
|
|
|
+- addresses are constant-folded; the V3 `0x...` form is required
|
|
|
+ (the gm2 `1000H` suffix is not accepted);
|
|
|
+- `SymTab` records the absolute flag/address;
|
|
|
+- `Lower` materializes the fixed address instead of `AddrOf`;
|
|
|
+- `QBE` emits no normal data object or initializer for the variable;
|
|
|
+- `ADR(v)` returns the fixed address;
|
|
|
+- absolute variables inside procedures are currently rejected with
|
|
|
+ `not supported yet`;
|
|
|
+- address materialization currently uses the 32-bit `IntStr` path;
|
|
|
+ addresses above `0x7FFFFFFF` need a long-address follow-up;
|
|
|
+- no `VOLATILE` annotation exists yet, so memory-mapped I/O still needs
|
|
|
+ careful review.
|
|
|
+
|
|
|
+Covered by:
|
|
|
+
|
|
|
+```text
|
|
|
+compiler/tests/t_varaddress.mod
|
|
|
+```
|
|
|
+
|
|
|
+The test checks `ADR(v) = VAL(ADDRESS, 0x1000)` without dereferencing an
|
|
|
+arbitrary unmapped address. A runtime read/write test needs a
|
|
|
+deliberately mapped page or an allocated buffer.
|
|
|
+
|
|
|
+Current workaround for addresses outside the implemented range:
|
|
|
|
|
|
```modula2
|
|
|
TYPE PCard = POINTER TO CARDINAL;
|
|
|
@@ -159,8 +154,7 @@ BEGIN
|
|
|
END
|
|
|
```
|
|
|
|
|
|
-This is not a named absolute variable, but it is usable today now that
|
|
|
-`VAL` supports integer-to-pointer conversion.
|
|
|
+---
|
|
|
|
|
|
---
|
|
|
|