interp: trace collector values with explicit continuations
This commit is contained in:
1 parent
afc40f8502
commit
f92817b127
4 files changed
+286
-19
No files matched your search
@@ -478,3 +478,5 @@ The [executed runtime audit](runtime-value-depth-audit.md) confirms that a verif
|
||||
The [zero-materialization increment](runtime-value-depth-audit.md#zero-materialization-repair) removes recursion from zeroValue while preserving payload shape/order, whole-local publication and instruction accounting. Deep unit tests cover 32,768 anonymous/nominal levels and pending siblings; the original run now returns normally. Follow-up probes independently verify native-stack failures in deepCopy/copyAll on local.load and Copier.value/items with collection before every instruction. Those are remaining Q-060 work, not a new acceptance limit; value sizing and output serialization remain audit candidates.
|
||||
|
||||
The [storage/value-copy increment](runtime-value-depth-audit.md#storagevalue-copy-repair) removes recursion from deepCopy/copyAll while retaining per-occurrence payload independence, aggregate identities, shallow handles and failure publication rules. The previous 32,768-level local.load run now returns normally. An added local.store forces ordinary-threshold collection and independently confirms the remaining Copier.value/items native-stack failure, without collect-every-step instrumentation. Sharing-preserving collection/result copying, accounted-value queries and output serialization remain open; no accepted-depth or trap limit is introduced.
|
||||
|
||||
The [sharing-preserving copy increment](runtime-value-depth-audit.md#sharing-preserving-copy-repair) removes recursive collector/result copying while retaining forwarded identities, backing storage, cycles, slice paths/ranges, buffer metadata, race shadows and mutex views. Deep verified runs now pass ordinary and per-instruction collection, with unchanged fuel boundaries and returned payload lifetimes. Follow-up CLI probes independently confirm valueBytes native-stack exhaustion on own.new and output failure at std.json.Stringify's fixed nesting stack. The latter is not yet evidence of writeValue native-stack overflow. Q-060 stays open for sizing and serialization; no normative depth limit, feature or trap is introduced.
|
||||
@@ -21,7 +21,7 @@ Every array length is one. The accounted value/frame size is one byte, and `aji
|
||||
|
||||
This confirms native recursion in zeroValue on a verified input. An iterative fix must retain zero initialization, value shape, heap/root lifetimes, allocation failure handling, collection safety and instruction/fuel accounting. A new accepted-depth limit or trap would require a normative decision; none is added by compiler-side repairs.
|
||||
|
||||
At the initial baseline, deepCopy/copyAll, valueBytes and collection/serialization were inspection candidates only: the zero-materialization failure prevented probing them. The executed results below supersede that status for copying and collection. valueBytes and output serialization still need depth probes before claiming complete bounded native-stack behavior. Q-060 remains open.
|
||||
At the initial baseline, deepCopy/copyAll, valueBytes and collection/serialization were inspection candidates only: the zero-materialization failure prevented probing them. The executed results below supersede that status for copying, collection, value sizing and output serialization. Q-060 remains open for the latter two failures.
|
||||
|
||||
## Zero-materialization repair
|
||||
|
||||
@@ -49,3 +49,20 @@ The invariant is unchanged storage/SSA value independence, alongside unchanged o
|
||||
Unit tests copy 32,768 alternating array/aggregate levels with pending siblings, empty payloads, variant identities and signed integer bits. They mutate one of two complete copies, independently test reused source payloads within one value, preserve explicit owner/mutex/graph identities, and force a mid-copy payload allocation failure while retaining complete old local storage. A verified deep programme pins exact fuel 0–4 boundaries: local.load still consumes one instruction. Forty-two mixed-type old/new runs have identical records.
|
||||
|
||||
The previously crashing 32,768-level zero/local.load/ret programme now returns normally under fuel 8 at the ordinary collection threshold. Adding local.store back to the same local forces an ordinary threshold collection and aborts without JSON in Copier.value/items (4,997/4,998 symbolized frames, zero deepCopy frames). This confirms the next failure without collection instrumentation. The collector/result copier, accounted-value queries and output serialization remain Q-060 work.
|
||||
|
||||
## Sharing-preserving copy repair
|
||||
|
||||
The collector and run-result copier now use explicit continuation jobs for payload elements, cell values, graph objects, projection paths and mutex views. Each shell enters its existing forwarding map before descendants are visited. Completed roots therefore retain shared cells/payloads, SSA-backed storage, slice ranges, buffer identity/capacity, mutex/guard identity and graph cycles. Metadata, race shadows and weak-memory views are copied before the old execution heap is released. Result copying uses the same traversal. Unlike storage/value copying, repeated references intentionally resolve to the same new object. Temporary jobs/maps remain in the caller's temporary arena, while payloads remain in the destination heap; the original depth-first destination allocation order is retained.
|
||||
|
||||
The invariant is that all reachable execution state survives collection with identical identity relationships and values, and every externally returned root has completed copying. The original verifier type/ownership/initialization/loan rules and runtime safe points are unchanged. The positive mixed Copy-record/enum/array AIR/source examples still return 42; read_uninitialized and copy_overlapping remain E1010/E2101 rejection examples. No new diagnostic, effect, Aji allocation charge, feature, trap, accepted-depth limit, runtime rule, fuel step or schedule event is added. A failed copier is discarded and its arenas released; this does not introduce transactional collection or retry guarantees.
|
||||
|
||||
Unit tests free the old heap before inspecting forwarded backing cycles, shared payloads, places/slices, buffers, mutex guards/views, graph cycles and race-shadow paths/epochs. An allocator probe fails every copier allocation request in turn and checks propagated OutOfMemory and arena cleanup. Separate internal-representation tests traverse 32,768 payload/cell levels with siblings; these are not claimed as typed source programs. Verified deep-program tests pin exact fuel 0–5 boundaries, ordinary threshold collection, per-instruction collection, and returned payloads after the execution heap is freed. The formerly crashing deep CLI store programme now returns null, and the original zero programme also passes with per-instruction collection.
|
||||
|
||||
Validation: unit/format checks, test-extended and all 1,787 ordinary conformance cases pass. Per-instruction collection additionally passes 57 focused run cases across phases 1/2/4/5 and source runtime_values, plus all 26 phase-3 run cases with stress 16 (each applicable schedule quantum). Old/new records match exactly for 42 mixed-value runs and 104 runs across mutex/channel/graph/buffer/atomic fixtures and eight schedule seeds. The full per-instruction conformance run is additional validation, still running at this checkpoint.
|
||||
|
||||
Two follow-up failures are independently verified on the same ordinary native stack, disabling only child core capture:
|
||||
|
||||
- Returning the 32,768-level array succeeds through interpretation/result copying in unit tests, but CLI output aborts with exit -6 and no JSON. The trace starts at std.json.Stringify's fixed 256-level nesting stack (BitStack index 32, length 32) and contains 256 writeValue frames. This is a serialization failure, not a demonstrated native-stack overflow in writeValue; its recursion still needs removal or independent audit.
|
||||
- Allocating an owner for the same loaded array using own.new with fuel 16 and an eight-byte heap grant aborts with exit -6, no JSON and 10,001 valueBytes frames. The value's accounted size is one byte. This confirms native recursion in runtime value sizing after zeroing, loading and collection now complete.
|
||||
|
||||
Q-060 remains open for valueBytes and output serialization. No normative or agent-bundle text changes in this increment.
|
||||
Reference in new issue
Block a user