1
Fork 0

Auto merge of #115184 - saethlin:local-allocated-spans, r=RalfJung

Record allocation spans inside force_allocation

This expands https://github.com/rust-lang/miri/pull/2940 to cover locals

r? `@RalfJung`
This commit is contained in:
bors 2023-08-25 17:03:33 +00:00
commit 296c7a683c
10 changed files with 110 additions and 10 deletions

View file

@ -18,7 +18,7 @@ use crate::const_eval::CheckAlignment;
use super::{
AllocBytes, AllocId, AllocRange, Allocation, ConstAllocation, FnArg, Frame, ImmTy, InterpCx,
InterpResult, MemoryKind, OpTy, Operand, PlaceTy, Pointer, Provenance, Scalar,
InterpResult, MPlaceTy, MemoryKind, OpTy, Operand, PlaceTy, Pointer, Provenance, Scalar,
};
/// Data returned by Machine::stack_pop,
@ -475,6 +475,18 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
assert!(!unwinding);
Ok(StackPopJump::Normal)
}
/// Called immediately after actual memory was allocated for a local
/// but before the local's stack frame is updated to point to that memory.
#[inline(always)]
fn after_local_allocated(
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
_frame: usize,
_local: mir::Local,
_mplace: &MPlaceTy<'tcx, Self::Provenance>,
) -> InterpResult<'tcx> {
Ok(())
}
}
/// A lot of the flexibility above is just needed for `Miri`, but all "compile-time" machines