Skip to main content

sim_lib_gc_tracing/
correctness.rs

1/// Independent correctness dimensions maintained by the collector conformance suite.
2///
3/// Determinism means identical allocation and safepoint schedules produce identical
4/// receipts. Receipt order is grounded in `ManagedId`'s allocation-deterministic
5/// ordinals; safety does not require different legal schedules to reclaim at the
6/// same safepoint.
7#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum CorrectnessDimension {
9    /// No rooted or transitively strong-reachable object is reclaimed.
10    Safety,
11    /// Unreachable strong cycles are reclaimed.
12    Reclamation,
13    /// Weak edges and ephemerons follow strong-liveness semantics.
14    WeakAndEphemeron,
15    /// Finalizers are admitted at most once and run outside collection.
16    Finalization,
17    /// The same allocation and safepoint schedule gives the same receipt.
18    SameScheduleDeterminism,
19    /// Every legal schedule preserves safety, even when reclamation timing differs.
20    ScheduleIndependenceSafety,
21    /// Every collection resource class is explicitly bounded.
22    BoundedWork,
23    /// Refused plans leave the arena and finalization state unchanged.
24    FailureAtomicity,
25    /// Collection runs synchronously inside a wasm-compatible closure without threads.
26    WasmClosure,
27}
28
29impl CorrectnessDimension {
30    /// The complete frozen correctness contract, in documentation order.
31    pub const ALL: [Self; 9] = [
32        Self::Safety,
33        Self::Reclamation,
34        Self::WeakAndEphemeron,
35        Self::Finalization,
36        Self::SameScheduleDeterminism,
37        Self::ScheduleIndependenceSafety,
38        Self::BoundedWork,
39        Self::FailureAtomicity,
40        Self::WasmClosure,
41    ];
42}