use std::collections::HashSet;
use std::fmt;
use std::num::NonZeroU64;
+use std::rc::Rc;
use std::time::Instant;
use rand::rngs::StdRng;
write!(f, "{:?}", tag.sb)
}
- fn get_alloc_id(self) -> AllocId {
- self.alloc_id
+ fn get_alloc_id(self) -> Option<AllocId> {
+ Some(self.alloc_id)
}
}
pub(crate) backtrace_style: BacktraceStyle,
/// Crates which are considered local for the purposes of error reporting.
- pub(crate) local_crates: Vec<CrateNum>,
+ pub(crate) local_crates: Rc<[CrateNum]>,
/// Mapping extern static names to their base pointer.
extern_statics: FxHashMap<Symbol, Pointer<Tag>>,
}
#[inline(always)]
- fn enforce_number_validity(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
+ fn enforce_number_init(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
+ ecx.machine.enforce_number_validity
+ }
+
+ #[inline(always)]
+ fn enforce_number_no_provenance(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
ecx.machine.enforce_number_validity
}
let kind = kind.expect("we set our STATIC_KIND so this cannot be None");
let alloc = alloc.into_owned();
let stacks = if let Some(stacked_borrows) = &ecx.machine.stacked_borrows {
- Some(Stacks::new_allocation(id, alloc.size(), stacked_borrows, kind))
+ Some(Stacks::new_allocation(
+ id,
+ alloc.size(),
+ stacked_borrows,
+ kind,
+ &ecx.machine.threads,
+ ecx.machine.local_crates.clone(),
+ ))
} else {
None
};
}
#[inline(always)]
- fn ptr_from_addr(
+ fn ptr_from_addr_cast(
ecx: &MiriEvalContext<'mir, 'tcx>,
addr: u64,
) -> Pointer<Option<Self::PointerTag>> {
intptrcast::GlobalStateInner::ptr_from_addr(addr, ecx)
}
+ #[inline(always)]
+ fn ptr_from_addr_transmute(
+ ecx: &MiriEvalContext<'mir, 'tcx>,
+ addr: u64,
+ ) -> Pointer<Option<Self::PointerTag>> {
+ Self::ptr_from_addr_cast(ecx, addr)
+ }
+
+ #[inline(always)]
+ fn expose_ptr(
+ _ecx: &mut InterpCx<'mir, 'tcx, Self>,
+ _ptr: Pointer<Self::PointerTag>,
+ ) -> InterpResult<'tcx> {
+ Ok(())
+ }
+
/// Convert a pointer with provenance into an allocation-offset pair,
/// or a `None` with an absolute address if that conversion is not possible.
fn ptr_get_alloc(
ecx: &MiriEvalContext<'mir, 'tcx>,
ptr: Pointer<Self::PointerTag>,
- ) -> (AllocId, Size, Self::TagExtra) {
+ ) -> Option<(AllocId, Size, Self::TagExtra)> {
let rel = intptrcast::GlobalStateInner::abs_ptr_to_rel(ecx, ptr);
- (ptr.provenance.alloc_id, rel, ptr.provenance.sb)
+ Some((ptr.provenance.alloc_id, rel, ptr.provenance.sb))
}
#[inline(always)]
tag,
range,
machine.stacked_borrows.as_ref().unwrap(),
+ &machine.threads,
)
} else {
Ok(())
alloc_id,
tag,
range,
- machine.stacked_borrows.as_mut().unwrap(),
+ machine.stacked_borrows.as_ref().unwrap(),
+ &machine.threads,
)
} else {
Ok(())
alloc_id,
tag,
range,
- machine.stacked_borrows.as_mut().unwrap(),
+ machine.stacked_borrows.as_ref().unwrap(),
)
} else {
Ok(())