pub mod alias;
pub mod call;
pub mod display;
pub mod exec;
pub mod memory;
pub mod state;
use rustc_middle::ty::TyCtxt;
use z3::Context;
use crate::verify::slicer::RelevantMirItems;
use self::state::{UnsupportedReason, VmState};
pub struct SymbolicVm<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl<'tcx> SymbolicVm<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> Self {
Self { tcx }
}
pub fn execute<'ctx>(
&self,
ctx: &'ctx Context,
items: &RelevantMirItems<'tcx>,
) -> Result<VmState<'ctx, 'tcx>, UnsupportedReason> {
let body = self.tcx.optimized_mir(items.checkpoint.caller);
let mut state = VmState::new(ctx, self.tcx, body, items.checkpoint.caller);
state.path = Some(items.path.clone());
state.execute_items(&items.items)?;
state.propagate_from_checkpoint(items.checkpoint.block);
Ok(state)
}
}