use rustc_data_structures::indexed_vec::IndexVec;
use rustc::mir::interpret::{
ErrorHandled,
- GlobalId, Scalar, FrameInfo, AllocId,
+ GlobalId, Scalar, Pointer, FrameInfo, AllocId,
EvalResult, InterpError,
truncate, sign_extend,
};
pub(crate) stack: Vec<Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>>,
/// A cache for deduplicating vtables
- pub(super) vtables: FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), AllocId>,
+ pub(super) vtables: FxHashMap<
+ (Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>),
+ Pointer<M::PointerTag>
+ >,
}
/// A stack frame.
// Function and callsite information
////////////////////////////////////////////////////////////////////////////////
/// The MIR for the function called on this frame.
- pub mir: &'mir mir::Mir<'tcx>,
+ pub mir: &'mir mir::Body<'tcx>,
/// The def_id and substs of the current function.
pub instance: ty::Instance<'tcx>,
&mut self.memory
}
+ #[inline(always)]
+ pub fn tag_static_base_pointer(&self, ptr: Pointer) -> Pointer<M::PointerTag> {
+ self.memory.tag_static_base_pointer(ptr)
+ }
+
#[inline(always)]
pub fn stack(&self) -> &[Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>] {
&self.stack
}
#[inline(always)]
- pub(super) fn mir(&self) -> &'mir mir::Mir<'tcx> {
+ pub(super) fn mir(&self) -> &'mir mir::Body<'tcx> {
self.frame().mir
}
pub fn load_mir(
&self,
instance: ty::InstanceDef<'tcx>,
- ) -> EvalResult<'tcx, &'tcx mir::Mir<'tcx>> {
+ ) -> EvalResult<'tcx, &'tcx mir::Body<'tcx>> {
// do not continue if typeck errors occurred (can only occur in local crate)
let did = instance.def_id();
if did.is_local()
}
}
- pub fn str_to_immediate(&mut self, s: &str) -> EvalResult<'tcx, Immediate<M::PointerTag>> {
- let ptr = self.memory.allocate_static_bytes(s.as_bytes()).with_default_tag();
- Ok(Immediate::new_slice(Scalar::Ptr(ptr), s.len() as u64, self))
- }
-
/// Returns the actual dynamic size and alignment of the place at the given type.
/// Only the "meta" (metadata) part of the place matters.
/// This can fail to provide an answer for extern types.
&mut self,
instance: ty::Instance<'tcx>,
span: source_map::Span,
- mir: &'mir mir::Mir<'tcx>,
+ mir: &'mir mir::Body<'tcx>,
return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
return_to_block: StackPopCleanup,
) -> EvalResult<'tcx> {
// statics and constants don't have `Storage*` statements, no need to look for them
Some(DefKind::Static)
| Some(DefKind::Const)
- | Some(DefKind::AssociatedConst) => {},
+ | Some(DefKind::AssocConst) => {},
_ => {
trace!("push_stack_frame: {:?}: num_bbs: {}", span, mir.basic_blocks().len());
for block in mir.basic_blocks() {