cli: lower unary spines and mark storage iteratively

This commit is contained in:
dev committed 2026-10-10 16:55:37 +03:00
1 parent c36b269289
commit dd73b84085
8 files changed
+762 -141

No files matched your search

+2
View File
@@ -523,4 +523,6 @@ Inspection during Q-059's closing inventory finds native recursion through sourc
Follow-up [expression-depth probes](source-expression-depth-audit.md) now confirm native-stack aborts without JSON diagnostics: 1,024 `not` prefixes fail in lowering; 16,384/65,536 fail earlier in the unary parser. The parser's direct prefix recursion is replaced by explicit continuations with unchanged grammar, AST spans, syntax errors and OOM propagation. Deep parse/format/missing-operand checks pass, but the confirmed lowering failure and other expression/statement paths remain open. The preceding inspection-only statement describes the initial checkpoint, not the current evidence.
The [unary lowering/addressability increment](source-expression-depth-audit.md#unary-lowering-and-addressability-continuations) removes direct not/neg/deref/cast descent and the separately confirmed recursive storage-marking prepass. Typed scalar checks/lowerings pass through 65,536 nodes; direct malformed dereferences return their inner E7005. Instruction order, signed-boundary literals, storage policy, diagnostics and host OOM propagation are retained. Q-061 remains open: a separate 16,384-dereference operand beneath a cast still aborts in `peekType` without stdout JSON, confirming the next query path; other expression/statement and generic paths remain to be audited. No normative depth limit is inferred from these repairs or tests.
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.
+67 -4
View File
@@ -61,13 +61,76 @@ suite passes 312 checks; the formatter suite passes 6,078 checks over 1,469 file
These are compiler regressions, not a model-capability measurement or full GC
validation.
## Unary lowering and addressability continuations
Direct `.not`, `.neg`, `.deref` and `.cast` operand descent now records explicit
lowering continuations. Negative zero constants still precede their operands;
loads, boolean operations, checked subtraction and casts resume afterwards.
The special negative-literal magnitude rule remains separate, including
`-128i8` and the overflow from negating that value. Cast target validation still
precedes operand lowering; narrowing advice, atomic-load E4202 and operand
type/failure positions are unchanged. `peekType` skips a leading negation spine
without allocating; other recursive query paths are outside this repair.
The first intermediate full 16,384-prefix check exposes another native-stack
failure, in the preliminary `markExpr` walk, before the new expression handler
is reached. Its record/frame excerpt is retained as
`source-address-mark-before.json`. Addressability now uses a separate worklist
for blocks, statements, expressions, roots and pending sibling slices. It
preserves root-bound-before-base order, left/right and statement/tail order,
callee/argument order and the final split_at root visit. The old skipped select
and lock-place inputs stay skipped; storage policy is not extended here.
Both worklists are host metadata, released on error/completion; finished values
and addressability facts retain their caller-arena lifetime. OOM propagates
without a source diagnostic or public partial AIR. The verifier's load/borrow,
initialization and atomic-access rules, runtime operations, ownership, lexical
ends, effects and source/AIR formats are unchanged. Borrowed scalar reads remain
valid; slice/array dereference and implicit atomic reads retain their existing
E7006/E4202 failures. No acceptance limit, code, feature or bundle text is added.
An independent old unary derivation checks 3,072 shallow context combinations,
including divergent operands, signed boundaries, borrowed/atomic values and
invalid targets. It compares values, complete instruction/span/constant records,
names/counters and diagnostics. It shares the unchanged non-unary handlers and
query implementation, so it is not an independent oracle for those paths.
Separate 32,768-node cases inspect inside-out boolean/cast spans, outside-in
negative zeros and inside-out subtractions, and inner dereference rejection.
The allocation test fails every arena backing request and compares complete
emitted instruction prefixes, no output publication and full arena release.
An independent old addressability walk compares 17 shallow fixtures, including
roots/bounds, branches, aggregates, calls, loops, scopes and skipped inputs.
32,768 mixed expression/block levels and every failing backing allocation are
tested separately. Full generated checks/lowerings now accept 65,536 typed
scalar boolean/negative/cast nodes, with independently counted instructions;
direct malformed dereference spines reject E7005 at their inner position.
These do not prove that every expression/query path is bounded.
The permanent `source_expression_depth.py` CI suite checks deep full lowering,
exact instruction counts, source/AIR and hosted results, fuel boundaries and
signed-minimum overflow. Baseline/current runtime records match exactly in 47
deterministic/hosted pairs. Full ordinary conformance passes 1,793 unique cases
with exact corpus coverage; units and Zig format checks pass. Q-060's full
per-step validation remains separate.
Final CLI validation passes 114 expression-depth checks, 635 non-value operand
checks, 33 atomic-access checks, 312 grammar checks and the existing 6,078
formatter checks. All 1,423 public source checks and 506 successful lowerings
retain byte-identical old/new results with fixed baseline/current executables.
## Remaining work
The confirmed `.not` lowering recursion remains unchanged. Other expression
and statement paths, including parenthesized/nested primary parsing,
`peekType`/`useIn`, generic `expression`/`walk` and lowering's other recursive
A follow-up check of `( * … 1i64 ) as i64` at 16,384 dereferences confirms a
native-stack abort in `peekType`, before the expected ordinary type error;
its stdout is empty and stderr repeats the dereference-query frames. Evidence:
`unary-cast-deref-query-16384.json/.stdout/.stderr`. General query continuation
work is still needed, beyond the negation-spine shortcut above.
Other expression and statement paths, including parenthesized/nested primary
parsing, `useIn`, generic `expression`/`walk` and lowering's other recursive
expression/block handlers, need separate probes and repairs. Their complete
depth behavior is unverified here. The formatter's expression-marking traversal
already uses a worklist, as inspected and exercised by the deep syntax-only
probes. Q-061 and Phase 6 remain open; Q-060's unfinished full GC validation is
independent. No fresh Claude review covers this parser increment.
independent. No fresh Claude review covers these expression increments.
+6
View File
@@ -526,3 +526,9 @@ The earlier Debug full GC process is also still live, as is ReleaseSafe; host na
[Q-061 probes](../design/source-expression-depth-audit.md) confirm native-stack aborts without JSON: 1,024 `not` prefixes fail in lowering, while 16,384/65,536 fail earlier in parsing. Direct unary-prefix parsing now uses explicit continuations, preserving the grammar, borrow/place boundary, AST spans, exact failures and host OOM propagation. Independent shallow-oracle (448 cases), 32,768 mixed-prefix, deep missing-operand and allocation-failure tests pass. Syntax-only formatting works through 65,536 prefixes; this does not close the confirmed lowering failure.
Build/units/format checks, all 1,793 ordinary conformance cases with exact coverage, 312 grammar CLI checks and 6,078 formatter checks pass. Old/new public source check/lower output remains identical (1,423/506). No normative/reference bundle, feature, code or acceptance-limit change; P6-2, Q-061's remaining expression/statement paths, Q-060 GC validation and Phase 6 exit review remain open. No fresh Claude review covers this increment.
## Source unary lowering and storage marking (2026-10-10)
[Q-061 unary operand lowering](../design/source-expression-depth-audit.md#unary-lowering-and-addressability-continuations) now uses explicit continuations for not/neg/deref/cast, preserving pre-operand negative zeros, the signed-minimum literal rule, operand/target checks, atomic-load diagnostics and instruction/span order. A separate confirmed storage-marking failure is repaired by a block/statement/expression/root worklist retaining the existing traversal order and storage policy. Generated full scalar checks/lowerings pass through 65,536 nodes; deep invalid direct dereferences retain inner E7005. Both worklists propagate host OOM without diagnostics or public partial AIR. No verifier/runtime/ownership/format/bundle/feature/code/acceptance-limit change.
Independent unary/addressability oracles, 32,768-node cases and allocation cleanup tests pass. Final build/units/format checks and all 1,793 ordinary conformance cases with exact coverage pass, as do 114 expression-depth, 635 non-value, 33 atomic-access, 312 grammar and 6,078 formatter CLI checks. Old/new public checks/lowerings (1,423/506) and 47 deterministic/hosted fuel/value records are exact. A new full check independently confirms the remaining 16,384-dereference query failure beneath a cast in peekType. Q-061's general queries, other expression/statement and generic paths remain open, as do Q-060's full per-step validation and Phase 6 exit review. No fresh Claude review covers this increment.