cli: lower ordinary call arguments iteratively

This commit is contained in:
dev committed 2026-10-10 22:53:35 +03:00
1 parent bda43d2ecb
commit 0791a50eb9
5 files changed
+648 -126

No files matched your search

+3 -1
View File
@@ -539,6 +539,8 @@ The [generic transformation increment](source-expression-depth-audit.md#generic-
The [parser constructor-path increment](source-expression-depth-audit.md#parser-qualified-constructor-paths) repairs Parser.exprPath independently of generic/lowering paths. Frozen baseline probes confirm enum and struct constructor aborts at 16,384 fields; the repaired CLI returns exact E7002 through 65,536. Named-root classification, spelling, type arguments, spans, syntax errors and host OOM propagation are preserved, with one complete string allocation. Q-061 remains open for the confirmed parenthesized/mixed-call parser failures and the remaining lowering/liveness inventory; no new acceptance limit or external review is claimed.
The [shared expression parser increment](source-expression-depth-audit.md#shared-expression-parser-continuations) removes native re-entry through grouping, call arguments, arrays, index bounds and struct fields, sharing binary/cast/unary/postfix/primary continuations. Token/AST/spans, grammar/error priority and scoped advice remain unchanged; host OOM propagates without diagnostics or partial AST. Reused work storage and stable driver frames retain caller-arena lifetime. Block/control callbacks still recurse outside the large dispatch frame; their bounded regression probes pass, without an arbitrary-depth claim. Grouped programs check through 65,536; mixed calls format through 65,536 but now abort in lowerer `call` at 1,024. Q-061 remains open for that confirmed path and remaining control/liveness traversal; no new limit or external review is claimed.
The [shared expression parser increment](source-expression-depth-audit.md#shared-expression-parser-continuations) removes native re-entry through grouping, call arguments, arrays, index bounds and struct fields, sharing binary/cast/unary/postfix/primary continuations. Token/AST/spans, grammar/error priority and scoped advice remain unchanged; host OOM propagates without diagnostics or partial AST. Reused work storage and stable driver frames retain caller-arena lifetime. Block/control callbacks still recurse outside the large dispatch frame; their bounded regression probes pass, without an arbitrary-depth claim. Grouped programs check through 65,536; mixed calls format through 65,536 but checking at that checkpoint still aborted in lowerer `call` at 1,024. Q-061 remains open for that confirmed path and remaining control/liveness traversal; no new limit or external review is claimed.
Audit these paths separately with finite public/generated source inputs before claiming whole-frontend bounded native-stack processing. Prefer explicit continuations preserving existing syntax, evaluation/query order, diagnostics and OOM behavior. A new depth rejection requires a normative decision; Q-059's type-traversal resolution does not authorize one.
The [ordinary-call increment](source-expression-depth-audit.md#ordinary-call-argument-continuations) shares call arguments with scalar continuations, preserving signature/error priority, left-to-right consumption, loans, retained parents, CFG and host OOM behavior. Stable arena-owned states retain bounded builtin/control regression capacity. Build/units/format checks, exact ordinary conformance coverage and call-related CLI suites pass. A separate alternating struct/field program still aborts at 1,024 before and after; builtin/variant/place, aggregate/control and remaining liveness/read/assignment paths keep Q-061 open. No semantic or depth limit changes and no fresh external review are claimed.
+48 -2
View File
@@ -473,7 +473,7 @@ empty work, restored depth/advice/call scopes and no diagnostic; persistent
backing failures through public parse check arena cleanup and no partial AST.
Final probes accept checks at 65,536 grouped levels and formatting at 65,536
mixed-call levels. Full mixed-call checking still aborts at 1,024, now in lowerer
mixed-call levels. At this checkpoint mixed-call checking still aborted at 1,024, in lowerer
`call` rather than parsing (`expression-parser-final-probes.json` and
`expression-parser-*.after.final.*.stdout/.stderr`). Permanent CLI tests separate
full accepted grouped/scalar programs with exact AIR/fuel from syntax-only
@@ -494,6 +494,52 @@ ownership/runtime rule changes. Q-061 remains open for block/control parsing,
non-scalar lowering and the remaining liveness/read/assignment inventory.
This increment has no external review yet.
## Ordinary-call argument continuations
Ordinary local/module/std/generic call arguments now suspend in the scalar
expression driver. Callee normalization, signature/arity and named-`from`
checks still precede arguments; values are consumed left to right, exact type
checks precede the next argument, and temporary loans end after `call` as
before. Returned-borrow provenance, void/never exits, generated names, spans
and short-circuit CFG are unchanged (spec 15 §5, §19).
Stable call states and worklist backing belong to the caller's arena; they
remain until that arena is destroyed, including after an error. Keeping only
state pointers in continuations avoids large native frame copies. An initial
by-value implementation regressed nested `assert` diagnostics at 256 levels;
final before/after probes retain identical outputs for `assert`, blocks and
`if` at 16/64/256 (`call-continuations-callback-pointer.json`). This is bounded
regression coverage, not arbitrary builtin/control depth safety.
The copied shallow recursive call/scalar oracle compares emission, CFG,
diagnostic priority, transfers, temporary cleanup and retained parents. Place,
byte-materialization and builtin helpers are shared, outside its independence.
Separate 32,768-level direct/mixed call tests and recovering direct/public plus
persistent backing-OOM tests pass. Host OOM remains an error union, without a
source diagnostic or public partial AIR; output-arena backing is freed.
Build/unit/format checks and all 1,793 ordinary conformance cases pass with
terminal exit 0 and exact unique coverage (`call-continuations-conformance`
artifacts). Borrow-return/array-argument/generic/static-function/non-value/
independent-error CLI suites pass 133/85/42/25/635/234 checks. Frozen old/new
CLIs retain exact exit/stdout/stderr for 1,423 public source checks and 506
accepted lowerings (`call-continuations-cli-compatibility-pointer.json`).
Full direct/mixed arithmetic/negation and generic call checks, lowerings and
formatting now accept through 65,536 levels; bounded runs retain exact AIR
values and independently counted fuel. All 262 focused call-depth CLI checks
pass against the frozen final binary (`call-continuations-focused-depth.log`),
including exact innermost E7002 records across check/lower/run/report/explore.
The former 1,024-level mixed-call
abort is repaired. A separate alternating
`Box { n: expression }.n` probe still aborts at 1,024 before and after this
increment, while 16 levels accept (`call-followup-field-struct-probes.json`).
Builtin/variant/place callbacks, aggregate/control lowering and remaining
liveness/read/assignment walks are further Q-061 work. No normative, language/
AIR format, feature, diagnostic, bundle, limit or ownership/runtime change;
Q-060 full per-step GC validation and Phase 6 exit gates remain separate.
This increment has no external review yet.
## Remaining work
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
@@ -508,7 +554,7 @@ includes a confirmed lowerer failure and inspection-only risks:
| Production path | Evidence and next scope |
|---|---|
| Parser `ifExpr`, block/statement and match/arm expression entry | Native callback re-entry remains. Bounded block/if regression probes above pass; arbitrary and alternating control/statement depth is unverified. |
| Lowerer non-scalar `expr` callbacks: calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Mixed scalar/call source now has a confirmed native abort in `call` at 1,024 after parsing succeeds. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| Lowerer non-scalar `expr` callbacks: builtin/variant calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Ordinary-call argument descent is repaired above. Alternating struct/field lowering still aborts at 1,024 in both binaries. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| Lowerer use-after-region/liveness and assignment scans (`After`, first-use/read scans, `blockAssigns`/`stmtAssigns`/`exprAssigns`, match/select helpers) | Recursive AST walks inspected; audit their callers and finite deep inputs separately. |
The formatter's expression-marking traversal already uses a worklist, as
+23 -2
View File
@@ -632,7 +632,28 @@ formatter passes 6,078 checks; frozen old/new public checks/lowerings remain
exact (1,423/506). Grouped source checks reach 65,536; mixed-call formatting reaches
65,536. Block/if regression probes preserve accepted baseline output, including
256 levels; explicit-return forms improve from baseline aborts to formatting
at 256. These are bounded probes, not a whole-parser depth guarantee. Full
mixed-call checking now confirms a lowerer `call` abort at 1,024; control/block
at 256. These are bounded probes, not a whole-parser depth guarantee. At this
checkpoint, full mixed-call checking confirmed a lowerer `call` abort at 1,024; control/block
parsing, remaining expression/statement/liveness walks, Q-060 validation and
Phase 6 exit gates remain open. No external review covers this increment yet.
### Ordinary-call depth increment
The [Q-061 ordinary-call increment](../design/source-expression-depth-audit.md#ordinary-call-argument-continuations)
shares argument continuations with scalar operands. Signature/arity/origin
checks, left-to-right consumption, exact argument checks, temporary endings,
retained parents and instruction/span/CFG order are preserved. Stable states
live in the caller's arena; recovering/persistent OOM remains a host error and
arena backing is freed. No semantic/bundle/feature/code/limit changes.
Independent shallow/deep call and OOM tests, build/units/format checks and all
1,793 ordinary conformance cases with exact coverage pass. Call-related CLI
suites pass 133/85/42/25/635/234 checks. Frozen public checks/lowerings remain
exact (1,423/506). Bounded native `assert`/block/if probes
retain exact baseline outputs through 256; this does not claim whole-callback
safety. Direct/mixed/generic call checks and lowerings now reach 65,536 with
exact bounded values/fuel; 262 focused depth CLI checks pass. The mixed-call
abort at 1,024 is repaired, while a separate alternating
struct/field program still aborts there in both binaries. Remaining Q-061
callbacks/walks, Q-060 validation and Phase 6 exit gates remain open. No fresh
external review covers this increment.