Expand description
Infinite recursion debugging tools (force chain, trace, depth limit, stats). Infinite recursion debugging tools for the tree-walker evaluator.
Five integrated tools:
- Force chain capture — always-on, captures the chain of thunk forces leading to a blackhole cycle.
- Trace mode (
SUI_TRACE_EVAL=1or=verbose) — logs every thunk force to stderr or a ring buffer. - Max force depth (
--max-force-depth N) — caps the force stack and reports early. - Thunk stats — extends
perf.rscounters with thunk-specific metrics (created, forced unique, max depth). - Static cycle detection — lives in the compiler; see
sui-bytecode/src/compiler.rs.
Structs§
- Force
Chain - The chain of forces that led to a cycle.
- Force
Frame - A single entry on the force stack.
Functions§
- add_
overlay_ flatten_ nanos - Add
nanosto the cumulative overlay-flatten-build timer. - add_
self_ rec_ walk_ nanos - Add
nanosto the cumulative Storm-A (referenced_idents) timer. - add_
sorted_ entries_ nanos - Add
nanosto the cumulative sorted_entries timer. - capture_
cycle - Capture the cycle portion of the force stack starting from the
frame whose
thunk_idmatches the blackholed thunk. - check_
force_ depth - Check whether the current force depth exceeds the configured limit.
Returns
Ok(())if within bounds or no limit is set. - current_
force_ depth - Get current force depth (debug).
- dump_
force_ stack_ ids - Diagnostic: dump the whole force stack’s thunk ids + files + descriptions.
- dump_
ring_ tail - Dump the last
nring-buffer entries to stderr (for inline diagnostics). - dump_
trace_ on_ error - Dump the trace ring buffer to stderr. Called on error paths.
- force_
stack_ contains - Diagnostic: is
thunk_idpresent anywhere on the current force stack? Atruemeans the SAME thunk pointer is being re-entered (a genuine self-cycle); afalsemeans the blackholed thunk is NOT on the stack (a re-created / distinct thunk — a sharing gap). - get_
overlay_ flatten_ nanos - Read the cumulative overlay-flatten-build nanoseconds.
- get_
self_ rec_ walk_ nanos - Read the cumulative Storm-A (
referenced_idents) nanoseconds. - get_
sorted_ entries_ nanos - Read the cumulative sorted_entries nanoseconds.
- get_
thunks_ created - Get thunks created count (for progress snapshots).
- get_
thunks_ forced - Get thunks forced count (for progress snapshots).
- inc_
maybe_ other_ kind - inc_
thunks_ created - Increment the thunks-created counter.
- inc_
thunks_ forced_ unique - Increment the thunks-forced-unique counter.
- init_
trace - Initialize tracing from the
SUI_TRACE_EVALenvironment variable. - pop_
force - Pop a frame from the force stack. Called when a thunk finishes forcing.
- push_
force - Push a frame onto the force stack. Called when a thunk begins forcing.
- report_
maybe_ other_ kinds - report_
thunk_ stats - Report thunk stats to stderr (called from
perf::report). - reset_
thunk_ stats - Zero the thunk-creation/force counters. Used by
perf::reset/perf::with_scopeto establish a clean measurement window. - set_
max_ force_ depth - Set the maximum allowed force depth. 0 means no limit.
- trace_
enabled - Whether any trace mode is active.
- trace_
force_ enter - Log a force-enter event. In verbose mode, prints immediately. In ring-buffer mode, stores for later dump.
- trace_
force_ exit - Log a force-exit event (decrements trace depth).