pub struct Machine {Show 15 fields
pub heap: Heap,
pub frame: Vec<Handle>,
pub base: usize,
pub s0: Vec<Handle>,
pub s1: Vec<Handle>,
pub assigned: usize,
pub opts: Opts,
pub memo: Memo,
pub stats: EvalStats,
pub warn: bool,
pub warnings: Vec<(u16, u32)>,
pub printed: Vec<String>,
pub draw: Option<Box<dyn DrawStream>>,
pub draws: u64,
pub level: i64,
/* private fields */
}Expand description
One worker’s evaluation state.
Fields§
§heap: HeapThe value regions.
frame: Vec<Handle>The frame stack.
base: usizeThe base of the current frame.
s0: Vec<Handle>The current state (s0).
s1: Vec<Handle>The successor buffer (s1); Handle::EMPTY is unassigned.
assigned: usizeAssigned variables in s1.
opts: OptsThe strategy switches.
memo: MemoThe memo tables.
stats: EvalStatsCounters.
warn: boolWhether the all-assigned shortcut runs for successors (TLC’s
TLCGlobals.warn; on in both profiles).
warnings: Vec<(u16, u32)>Warnings 2143 raised by the generator (UNCHANGED of a variable
already assigned another value), once per variable and site (an
ExprId index), in the order raised.
printed: Vec<String>What Print and PrintT printed, one line each, in evaluation
order.
draw: Option<Box<dyn DrawStream>>The random stream draws come from: the startup stream or the
expanded state’s (random.rs); None outside a search.
draws: u64How many draws were made, which the engine reads to refuse a draw in a check.
level: i64TLCGet("level"): 0 in Init, the expanded state’s level in the
next-state relation and action checks, the checked state’s level in
state checks (initial states are level 1). The engine sets it.
Implementations§
Source§impl Machine
impl Machine
Sourcepub fn without_debugger<T>(
&mut self,
operation: impl FnOnce(&mut Self) -> T,
) -> T
pub fn without_debugger<T>( &mut self, operation: impl FnOnce(&mut Self) -> T, ) -> T
Runs nonproducer reconstruction without this machine’s debugger capability. The original capability is restored when the operation returns or unwinds, including on errors. The controller and its stopped snapshots are untouched.
Source§impl Machine
impl Machine
Sourcepub fn new(store: Arc<Store>, nvars: usize, opts: Opts, memo: Memo) -> Self
pub fn new(store: Arc<Store>, nvars: usize, opts: Opts, memo: Memo) -> Self
A machine over store for states of nvars variables.
Sourcepub fn set_fuel(&mut self, units: u64)
pub fn set_fuel(&mut self, units: u64)
Bounds optional speculative work. Exhaustion yields unsupported and cannot be interpreted as a model verdict or a run-budget stop.
machine.set_fuel(4096);Sourcepub const fn fuel_exhausted(&self) -> bool
pub const fn fuel_exhausted(&self) -> bool
Whether a bounded machine has spent all of its fuel
(Machine::set_fuel), as the last charge that failed leaves it.
let _ = machine.fuel_exhausted();Sourcepub fn set_refuse_unrecorded_warnings(&mut self, enabled: bool)
pub fn set_refuse_unrecorded_warnings(&mut self, enabled: bool)
Makes every site where the dive-eval evaluator prints a warning that
this machine does not record in Machine::warnings fail as
unsupported instead: an EXCEPT key outside the function’s domain
(TLC warning 2144). An isolated optional machine sets it so that its
caller can fall back to the dive-eval evaluator, which prints the
warning. Ordinary machines keep TLC’s unchanged-function result.
machine.set_refuse_unrecorded_warnings(true);Sourcepub fn set_proven_materialized(
&mut self,
s0: &[Handle],
s1: &[Handle],
others: impl IntoIterator<Item = Handle>,
)
pub fn set_proven_materialized( &mut self, s0: &[Handle], s1: &[Handle], others: impl IntoIterator<Item = Handle>, )
Records handles the caller proved materialized in this machine’s
store with Heap::proved_concrete or Heap::materialized_within:
the rows s0 and s1 it is about to load, and others. It forgets
the previous ones. Identity tests that require materialized operands
(a SameVars subscript, set membership) then skip re-proving those
exact handles. Only persistent compound handles are kept: persistent
nodes never change, so the proof stays true. An isolated analysis
machine passes the rows and constants it admitted before each
evaluation.
Precondition, which this method does not check: every recorded handle
satisfies Heap::materialized_within in this machine’s store.
Recording any other handle (a lazy or symbolic set, say) makes
membership binary-search a non-canonical node and can give a wrong
answer. That walk has no depth limit, unlike the internal check it
replaces, which declines values nested 64 deep; the skipped check
would then have refused a value whose identity is nonetheless exact,
so the recorded proof only answers more of the same questions.
machine.set_proven_materialized(row, &[], []);Sourcepub fn set_work_control(&mut self, control: Option<Arc<dyn WorkControl>>)
pub fn set_work_control(&mut self, control: Option<Arc<dyn WorkControl>>)
Installs the optional caller-owned cooperative work checkpoint. Ordinary machines have no checkpoint and unbounded fuel.
machine.set_work_control(None);Sourcepub fn set_debugger(&mut self, observer: Option<Arc<dyn Observer>>)
pub fn set_debugger(&mut self, observer: Option<Arc<dyn Observer>>)
Installs explicit producer observation. Fresh replay/analysis machines remain unobserved unless a caller separately installs this capability.
Sourcepub fn with_deferred_reclamation<T>(
&mut self,
work: impl FnOnce(&mut Self) -> T,
) -> T
pub fn with_deferred_reclamation<T>( &mut self, work: impl FnOnce(&mut Self) -> T, ) -> T
Keeps generator continuation transients alive during one eager batch.
Internal rollback calls are deferred only inside work; normal rollback
behavior resumes before this method returns. The caller must retain any
required values after their semantic demands, clear transient receivers,
then roll back its enclosing batch mark. This does not persist or
normalize values and must not wrap a whole search or repeated iterations.
let mark = machine.heap.mark();
machine.with_deferred_reclamation(|_machine| ());
machine.heap.rollback(mark);Sourcepub fn deny_checker_access(&mut self)
pub fn deny_checker_access(&mut self)
Disables TLCGet/TLCSet in finite modes without a live checker context. Access refuses when reached; an untaken branch remains unevaluated.
Sourcepub fn allow_finite_level(&mut self)
pub fn allow_finite_level(&mut self)
Keeps TLCGet("level") available in a finite mode whose driver sets
Machine::level the way TLC does for that mode. Register reads and
writes still refuse.
Sourcepub fn set_output_limits(&mut self, events: usize, bytes: usize)
pub fn set_output_limits(&mut self, events: usize, bytes: usize)
Bounds retained Print events and UTF-8 bytes for a finite mode. The ordinary checker leaves this unset. Rendering occurs before admission.
Sourcepub const fn output_failure(&self) -> Option<&'static str>
pub const fn output_failure(&self) -> Option<&'static str>
The first output-admission limit reached by this machine.
Sourcepub fn enter(&mut self, size: u32) -> usize
pub fn enter(&mut self, size: u32) -> usize
Enters a frame of size slots for a role, returning the old base.
Sourcepub fn leave(&mut self, old: usize)
pub fn leave(&mut self, old: usize)
Leaves the frame entered by Machine::enter.
Sourcepub fn thunk_mark(&self) -> usize
pub fn thunk_mark(&self) -> usize
The point from which Machine::thunks_released considers the thunk
slots forced to a transient. Take it with the Heap::mark that a
later rollback frees to.
Sourcepub fn thunks_released(&mut self, since: usize) -> bool
pub fn thunks_released(&mut self, since: usize) -> bool
Whether no thunk slot still in the frame holds a transient forced
since since, so that a rollback
to the heap mark taken with it frees no value a live slot holds.
A slot forced in a frame that has since been left is gone: entering
a frame fills fresh slots with Handle::EMPTY. Forgets the
positions of slots that have left the frame; a true result forgets
every position recorded since since.
Source§impl Machine
impl Machine
Sourcepub fn clear_buffer(&mut self)
pub fn clear_buffer(&mut self)
Clears the successor buffer.
Sourcepub fn run_action(
&mut self,
code: &Code,
g: G,
sink: &mut dyn Sink,
) -> Result<(), Error>
pub fn run_action( &mut self, code: &Code, g: G, sink: &mut dyn Sink, ) -> Result<(), Error>
Runs one action (or initial predicate) from self.s0, emitting every
successor into sink. The caller has entered the action’s frame.
§Errors
Evaluation errors, refusals, and the sink’s stop.
Sourcepub fn run_action_generation(
&mut self,
code: &Code,
g: G,
sink: &mut dyn Sink,
choose: &mut dyn FnMut(u64) -> u64,
) -> Result<(), Error>
pub fn run_action_generation( &mut self, code: &Code, g: G, sink: &mut dyn Sink, choose: &mut dyn FnMut(u64) -> u64, ) -> Result<(), Error>
Runs actual Next traversal with bounded randomized disjunction and
existential ordering. The sink stops after its first admitted complete
row; continuing searches remaining alternatives. choose(n) must return
a value below the positive n. Ordinary predicate/ENABLED evaluation
never inherits these operational choices.
§Errors
The ordinary generation errors, unsupported indexed domains or an out-of-range caller index.