docs: Q-063 profiling audit and harness, record Q-064

This commit is contained in:
dev committed 2026-10-14 15:31:35 +03:00
1 parent 17cbe3eb4e
commit 2fb882c704
3 files changed
+269 -5

No files matched your search

+46 -5
View File
@@ -649,11 +649,52 @@ levels, 108 s at 4,096 (then the ordinary E5101), and no result after more than
ten minutes and about 480 MB at 16,384, where the agent stopped it. No
native-stack aborts or observed correctness defects. This
tracks resilience to adversarial source input separately from Q-061's repaired
stack-exhaustion defect. Repeated scans of the remaining AST for live variables
are a suspected cause, not a profiled explanation of all four results.
stack-exhaustion defect.
Defer liveness caching or a broader `lower.zig` refactor until after Q-060's
full per-step GC validation. A later optimization needs profiling and exact
CFG/SSA, diagnostic-order, host-OOM and runtime/fuel compatibility checks.
The [2026-10-14 stage timings and sampled stacks](control-depth-performance-audit.md)
separate three causes: repeated enclosing-rest liveness searches dominate
mutable-match lowering (about 8× work per depth doubling at 256–512); textual
incoming-block-reference scans in `Lowerer.reaches` dominate no-mutation while
lowering and also appear for loop; shield relation maintenance dominates AIR
verification, independently of liveness. All 315 timed commands and five
profiled targets accept normally. This is a finite Debug profile, not a
portable timing bound or a whole-compiler complexity proof.
Q-060's full per-step validation is now closed by its composite audit.
Profiling for Q-063 is complete for these paths; optimization remains open.
The recommended first isolated change is explicit loop incoming-edge metadata,
followed by context-correct liveness indexing and a separately reviewed shield
relation optimization. A later optimization needs exact CFG/SSA,
diagnostic-order, host-OOM and runtime/fuel compatibility checks.
No source-depth limit, new diagnostic, verifier rule, AIR instruction or
language semantic change is introduced by recording this limitation.
## Q-064 — Loop-exit reference search confuses function and block names
**Open; confirmed existing frontend diagnostic defect (2026-10-14).** While
optimizing Q-063, a frozen pre-change Debug binary at `17cbe3e` accepts this
source in both `lower` and `check`, with exit 0:
```aji
module probe
fn after_2() -> void effects [] {}
fn main() -> u64 effects [] {
loop { after_2(); return 0u64; }
return 1u64;
}
```
Changing only the helper's name to `after_3` makes both commands reject the
statement after the loop with E7006 `unreachable`. Spec 15 §10 requires E7006
for expressions after unconditional divergence. The old `Lowerer.reaches`
searches instruction text for a generated exit name (`after_2` here), and
mistakes `call @after_2()` for an incoming reference to that block. Its
first-substring test also allows an earlier non-reference substring in one
instruction to mask a later genuine reference in that same instruction.
The Q-063 reference-index optimization deliberately preserves this behavior;
it does not make the collision a language rule. Replacing the compatibility
index with actual CFG-edge metadata belongs to a separate correctness change,
with source/AIR, naming-collision, unreachable-code and diagnostic-priority
coverage. Evidence is in `/tmp/aji-q063-reaches/collision-*.aji` and the frozen
CLI's output. No native-stack failure or unsafe execution is established here.