mmtk/util/
epilogue.rs

1//! Utilities for implementing epilogues.
2//!
3//! Epilogues are operations that are done when several other operations are done.
4
5use std::sync::atomic::{AtomicUsize, Ordering};
6
7/// A debugging method for detecting the case when the epilogue is never executed.
8pub fn debug_assert_counter_zero(counter: &AtomicUsize, what: &'static str) {
9    let value = counter.load(Ordering::SeqCst);
10    if value != 0 {
11        panic!("{what} is still {value}.");
12    }
13}