Lines
100 %
Functions
Branches
//! The compilation's measured counters: the store-scan and fold counters are
//! rendered in the behaviour snapshot, the rest are read by tests.
/// Compilation counters.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(crate) struct CompileStats {
/// Compound forms `eval_value` reduced to a constant datum, nested
/// reductions and discarded probes included (plan 0014 Stage 0).
pub(crate) folds: u64,
/// Macro expansions whose body read a variable the macro did not bind.
pub(crate) macro_bodies_reading_globals: u64,
/// Globals the unit's store scan found a direct store to (0014 Stage 2).
pub(crate) stored_globals: u64,
/// Whether the scan saw a `SETF` it could not tie to a place.
pub(crate) possibly_storing: bool,
/// Macro uses whose expansion the scan did not run.
pub(crate) opaque_macro_uses: u64,
/// `compile_for_stack` entries, speculative ones included.
pub(crate) stack_compiles: u64,
/// `eval_value` and `form_diverges` entries, discarded probes included.
pub(crate) probe_walks: u64,
/// The most passes any one BLOCK took.
pub(crate) block_passes_max: u64,
/// Passes over all BLOCKs.
pub(crate) block_passes_total: u64,
/// Attempts the unit took to settle its homes.
pub(crate) unit_attempts: u64,
}
impl CompileStats {
/// The counters after one more attempt: the compile-work counters add up,
/// the measured ones describe the latest attempt.
pub(crate) fn after_attempt(self, attempt: Self) -> Self {
Self {
stack_compiles: self.stack_compiles.saturating_add(attempt.stack_compiles),
block_passes_max: self.block_passes_max.max(attempt.block_passes_max),
block_passes_total: self
.block_passes_total
.saturating_add(attempt.block_passes_total),
unit_attempts: self.unit_attempts.saturating_add(1),
..attempt
pub(crate) fn note_stack_compile(&mut self) {
self.stack_compiles = self.stack_compiles.saturating_add(1);
pub(crate) fn note_block_passes(&mut self, passes: u64) {
self.block_passes_max = self.block_passes_max.max(passes);
self.block_passes_total = self.block_passes_total.saturating_add(passes);