lang: struct consts migrate to const globals, inline fallback (PLAN-CONST-AGG step 4)

A struct constant whose every field serializes — literals, enum tags,
nested aggregates, and (new) const EXPRESSIONS over named consts /
const-aggregate leaves ('r = K + 1', 'g = LIT.r', 'b = A[1]') — becomes
an immutable global: one storage, reads load/GEP it, '@LIT' is
addressable, dead-global elimination drops unused ones. constExprValue
gained a fold-through tail (evalConstIntExpr/evalConstFloatExpr,
source-aware), which also enables const-expression ELEMENTS in array
consts.

A const with a NON-serializable field (a call, a runtime read) keeps
inline re-lowering, and that per-use evaluation is now the documented
contract for the class (pinned: 'CALL.r' reads 1 then 2, side effects
run per use; '#run' is the evaluate-once tool).

Examples: 0180 (migrated shapes + @ptr + copy independence),
0181 (the inline-fallback contract). m3te (23/23) + game rebuilt green.
This commit is contained in:
agra
2026-06-11 12:58:17 +03:00
parent c23b76c7d6
commit 679653fda8
11 changed files with 97 additions and 3 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
lit=255 expr=11 20 8 ref=255
via-ptr=255
copy=9 const=255

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
use1=1
use2=2
counter=2