verifier: cache structural properties and nominal size queries
This commit is contained in:
1 parent
41f3afbf05
commit
48b9b42fed
31 files changed
+1399
-166
No files matched your search
@@ -91,6 +91,10 @@ These hold for the whole toolchain, not only deterministic mode:
|
||||
- `std.testing.allocator` in unit tests to catch leaks.
|
||||
- No global mutable state; pass allocators and `std.Io` explicitly.
|
||||
|
||||
Structural queries share a per-module table over resolved nominal declarations. A reverse-dependency worklist computes the existing boolean predicates, saturated traversal height and nearest forbidden source-element depth; named queries then read that immutable table. Existential properties start false, universal properties true, height increases and witness distance decreases to their existing depth limits. Cycles therefore terminate without a traversal timeout; existing layout/type checks still decide rejection. The verifier rebuilds the table rather than trusting one supplied by a caller. Source lowering builds it after finite-layout checking, preserves diagnostic order and uses the same declaration snapshot. The witness search retains field order and its depth-32 boundary, pruning subtrees with no reachable witness. Tests count evaluations and compare the cached predicates against uncached derivations on small acyclic modules. This changes implementation cost, not AIR meaning, ownership classes or runtime behavior.
|
||||
|
||||
The budget stage separately memoizes accounted sizes by nominal index and depth. Including depth preserves the previous cutoff and overflow diagnostics exactly, with at most V × (V + 2) nominal states; shared paths no longer expand exponentially. Verification returns a module carrying read-only caches for subsequent report/interpreter queries. Replacing a module's declarations invalidates its caches. Standalone uncached property/size helpers retain their recursive derivations for small differential tests.
|
||||
|
||||
## Zig conventions
|
||||
|
||||
- Zig 0.17.0, formatted with `zig fmt`.
|
||||
|
||||
Reference in new issue
Block a user