1 //! Global machine state as well as implementation of the interpreter engine
5 use std::cell::RefCell;
7 use std::num::NonZeroU64;
8 use std::time::Instant;
11 use rand::rngs::StdRng;
12 use rand::SeedableRng;
14 use rustc_data_structures::fx::FxHashMap;
19 layout::{LayoutCx, LayoutError, TyAndLayout},
23 use rustc_span::def_id::DefId;
24 use rustc_span::symbol::{sym, Symbol};
25 use rustc_target::abi::{LayoutOf, Size};
26 use rustc_target::spec::abi::Abi;
30 // Some global facts about the emulated machine.
31 pub const PAGE_SIZE: u64 = 4 * 1024; // FIXME: adjust to target architecture
32 pub const STACK_ADDR: u64 = 32 * PAGE_SIZE; // not really about the "stack", but where we start assigning integer addresses to allocations
33 pub const STACK_SIZE: u64 = 16 * PAGE_SIZE; // whatever
34 pub const NUM_CPUS: u64 = 1;
36 /// Extra data stored with each stack frame
37 pub struct FrameData<'tcx> {
38 /// Extra data for Stacked Borrows.
39 pub call_id: stacked_borrows::CallId,
41 /// If this is Some(), then this is a special "catch unwind" frame (the frame of `try_fn`
42 /// called by `try`). When this frame is popped during unwinding a panic,
43 /// we stop unwinding, use the `CatchUnwindData` to handle catching.
44 pub catch_unwind: Option<CatchUnwindData<'tcx>>,
46 /// If `measureme` profiling is enabled, holds timing information
47 /// for the start of this frame. When we finish executing this frame,
48 /// we use this to register a completed event with `measureme`.
49 pub timing: Option<measureme::DetachedTiming>,
52 impl<'tcx> std::fmt::Debug for FrameData<'tcx> {
53 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
54 // Omitting `timing`, it does not support `Debug`.
55 f.debug_struct("FrameData")
56 .field("call_id", &self.call_id)
57 .field("catch_unwind", &self.catch_unwind)
62 /// Extra memory kinds
63 #[derive(Debug, Copy, Clone, PartialEq, Eq)]
64 pub enum MiriMemoryKind {
65 /// `__rust_alloc` memory.
69 /// Windows `HeapAlloc` memory.
71 /// Memory for args, errno, and other parts of the machine-managed environment.
72 /// This memory may leak.
74 /// Memory for env vars. Separate from `Machine` because we clean it up and leak-check it.
76 /// Globals copied from `tcx`.
77 /// This memory may leak.
79 /// Memory for extern statics.
80 /// This memory may leak.
82 /// Memory for thread-local statics.
83 /// This memory may leak.
87 impl Into<MemoryKind<MiriMemoryKind>> for MiriMemoryKind {
89 fn into(self) -> MemoryKind<MiriMemoryKind> {
90 MemoryKind::Machine(self)
94 impl MayLeak for MiriMemoryKind {
96 fn may_leak(self) -> bool {
97 use self::MiriMemoryKind::*;
99 Rust | C | WinHeap | Env => false,
100 Machine | Global | ExternStatic | Tls => true,
105 impl fmt::Display for MiriMemoryKind {
106 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
107 use self::MiriMemoryKind::*;
109 Rust => write!(f, "Rust heap"),
110 C => write!(f, "C heap"),
111 WinHeap => write!(f, "Windows heap"),
112 Machine => write!(f, "machine-managed memory"),
113 Env => write!(f, "environment variable"),
114 Global => write!(f, "global (static or const)"),
115 ExternStatic => write!(f, "extern static"),
116 Tls => write!(f, "thread-local static"),
121 /// Extra per-allocation data
122 #[derive(Debug, Clone)]
123 pub struct AllocExtra {
124 /// Stacked Borrows state is only added if it is enabled.
125 pub stacked_borrows: Option<stacked_borrows::AllocExtra>,
126 /// Data race detection via the use of a vector-clock,
127 /// this is only added if it is enabled.
128 pub data_race: Option<data_race::AllocExtra>,
131 /// Extra global memory data
133 pub struct MemoryExtra {
134 pub stacked_borrows: Option<stacked_borrows::MemoryExtra>,
135 pub data_race: Option<data_race::MemoryExtra>,
136 pub intptrcast: intptrcast::MemoryExtra,
138 /// Mapping extern static names to their canonical allocation.
139 extern_statics: FxHashMap<Symbol, AllocId>,
141 /// The random number generator used for resolving non-determinism.
142 /// Needs to be queried by ptr_to_int, hence needs interior mutability.
143 pub(crate) rng: RefCell<StdRng>,
145 /// An allocation ID to report when it is being allocated
146 /// (helps for debugging memory leaks and use after free bugs).
147 tracked_alloc_id: Option<AllocId>,
149 /// Controls whether alignment of memory accesses is being checked.
150 pub(crate) check_alignment: AlignmentCheck,
152 /// Failure rate of compare_exchange_weak, between 0.0 and 1.0
153 pub(crate) cmpxchg_weak_failure_rate: f64,
157 pub fn new(config: &MiriConfig) -> Self {
158 let rng = StdRng::seed_from_u64(config.seed.unwrap_or(0));
159 let stacked_borrows = if config.stacked_borrows {
160 Some(RefCell::new(stacked_borrows::GlobalState::new(
161 config.tracked_pointer_tag,
162 config.tracked_call_id,
169 if config.data_race_detector { Some(data_race::GlobalState::new()) } else { None };
173 intptrcast: Default::default(),
174 extern_statics: FxHashMap::default(),
175 rng: RefCell::new(rng),
176 tracked_alloc_id: config.tracked_alloc_id,
177 check_alignment: config.check_alignment,
178 cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate,
182 fn add_extern_static<'tcx, 'mir>(
183 this: &mut MiriEvalContext<'mir, 'tcx>,
187 let ptr = ptr.assert_ptr();
188 assert_eq!(ptr.offset, Size::ZERO);
189 this.memory.extra.extern_statics.try_insert(Symbol::intern(name), ptr.alloc_id).unwrap();
192 /// Sets up the "extern statics" for this machine.
193 pub fn init_extern_statics<'tcx, 'mir>(
194 this: &mut MiriEvalContext<'mir, 'tcx>,
195 ) -> InterpResult<'tcx> {
196 match this.tcx.sess.target.os.as_str() {
198 // "__cxa_thread_atexit_impl"
199 // This should be all-zero, pointer-sized.
200 let layout = this.machine.layouts.usize;
201 let place = this.allocate(layout, MiriMemoryKind::ExternStatic.into());
202 this.write_scalar(Scalar::from_machine_usize(0, this), &place.into())?;
203 Self::add_extern_static(this, "__cxa_thread_atexit_impl", place.ptr);
205 Self::add_extern_static(
208 this.machine.env_vars.environ.unwrap().ptr,
213 // This is some obscure hack that is part of the Windows TLS story. It's a `u8`.
214 let layout = this.machine.layouts.u8;
215 let place = this.allocate(layout, MiriMemoryKind::ExternStatic.into());
216 this.write_scalar(Scalar::from_u8(0), &place.into())?;
217 Self::add_extern_static(this, "_tls_used", place.ptr);
219 _ => {} // No "extern statics" supported on this target
225 /// Precomputed layouts of primitive types
226 pub struct PrimitiveLayouts<'tcx> {
227 pub unit: TyAndLayout<'tcx>,
228 pub i8: TyAndLayout<'tcx>,
229 pub i32: TyAndLayout<'tcx>,
230 pub isize: TyAndLayout<'tcx>,
231 pub u8: TyAndLayout<'tcx>,
232 pub u32: TyAndLayout<'tcx>,
233 pub usize: TyAndLayout<'tcx>,
236 impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> {
237 fn new(layout_cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result<Self, LayoutError<'tcx>> {
239 unit: layout_cx.layout_of(layout_cx.tcx.mk_unit())?,
240 i8: layout_cx.layout_of(layout_cx.tcx.types.i8)?,
241 i32: layout_cx.layout_of(layout_cx.tcx.types.i32)?,
242 isize: layout_cx.layout_of(layout_cx.tcx.types.isize)?,
243 u8: layout_cx.layout_of(layout_cx.tcx.types.u8)?,
244 u32: layout_cx.layout_of(layout_cx.tcx.types.u32)?,
245 usize: layout_cx.layout_of(layout_cx.tcx.types.usize)?,
250 /// The machine itself.
251 pub struct Evaluator<'mir, 'tcx> {
252 /// Environment variables set by `setenv`.
253 /// Miri does not expose env vars from the host to the emulated program.
254 pub(crate) env_vars: EnvVars<'tcx>,
256 /// Program arguments (`Option` because we can only initialize them after creating the ecx).
257 /// These are *pointers* to argc/argv because macOS.
258 /// We also need the full command line as one string because of Windows.
259 pub(crate) argc: Option<Scalar<Tag>>,
260 pub(crate) argv: Option<Scalar<Tag>>,
261 pub(crate) cmd_line: Option<Scalar<Tag>>,
264 pub(crate) tls: TlsData<'tcx>,
266 /// What should Miri do when an op requires communicating with the host,
267 /// such as accessing host env vars, random number generation, and
268 /// file system access.
269 pub(crate) isolated_op: IsolatedOp,
271 /// Whether to enforce the validity invariant.
272 pub(crate) validate: bool,
274 /// Whether to enforce [ABI](Abi) of function calls.
275 pub(crate) enforce_abi: bool,
277 pub(crate) file_handler: shims::posix::FileHandler,
278 pub(crate) dir_handler: shims::posix::DirHandler,
280 /// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
281 pub(crate) time_anchor: Instant,
283 /// The set of threads.
284 pub(crate) threads: ThreadManager<'mir, 'tcx>,
286 /// Precomputed `TyLayout`s for primitive data types that are commonly used inside Miri.
287 pub(crate) layouts: PrimitiveLayouts<'tcx>,
289 /// Allocations that are considered roots of static memory (that may leak).
290 pub(crate) static_roots: Vec<AllocId>,
292 /// The `measureme` profiler used to record timing information about
293 /// the emulated program.
294 profiler: Option<measureme::Profiler>,
295 /// Used with `profiler` to cache the `StringId`s for event names
296 /// uesd with `measureme`.
297 string_cache: FxHashMap<String, measureme::StringId>,
299 /// Cache of `Instance` exported under the given `Symbol` name.
300 /// `None` means no `Instance` exported under the given name is found.
301 pub(crate) exported_symbols_cache: FxHashMap<Symbol, Option<Instance<'tcx>>>,
303 /// Whether to raise a panic in the context of the evaluated process when unsupported
304 /// functionality is encountered. If `false`, an error is propagated in the Miri application context
305 /// instead (default behavior)
306 pub(crate) panic_on_unsupported: bool,
309 impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
310 pub(crate) fn new(config: &MiriConfig, layout_cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Self {
312 PrimitiveLayouts::new(layout_cx).expect("Couldn't get layouts of primitive types");
313 let profiler = config.measureme_out.as_ref().map(|out| {
314 measureme::Profiler::new(out).expect("Couldn't create `measureme` profiler")
317 // `env_vars` could be initialized properly here if `Memory` were available before
318 // calling this method.
319 env_vars: EnvVars::default(),
323 tls: TlsData::default(),
324 isolated_op: config.isolated_op,
325 validate: config.validate,
326 enforce_abi: config.check_abi,
327 file_handler: Default::default(),
328 dir_handler: Default::default(),
329 time_anchor: Instant::now(),
331 threads: ThreadManager::default(),
332 static_roots: Vec::new(),
334 string_cache: Default::default(),
335 exported_symbols_cache: FxHashMap::default(),
336 panic_on_unsupported: config.panic_on_unsupported,
340 pub(crate) fn communicate(&self) -> bool {
341 self.isolated_op == IsolatedOp::Allow
345 /// A rustc InterpCx for Miri.
346 pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>;
348 /// A little trait that's useful to be inherited by extension traits.
349 pub trait MiriEvalContextExt<'mir, 'tcx> {
350 fn eval_context_ref<'a>(&'a self) -> &'a MiriEvalContext<'mir, 'tcx>;
351 fn eval_context_mut<'a>(&'a mut self) -> &'a mut MiriEvalContext<'mir, 'tcx>;
353 impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx> {
355 fn eval_context_ref(&self) -> &MiriEvalContext<'mir, 'tcx> {
359 fn eval_context_mut(&mut self) -> &mut MiriEvalContext<'mir, 'tcx> {
364 /// Machine hook implementations.
365 impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
366 type MemoryKind = MiriMemoryKind;
368 type FrameExtra = FrameData<'tcx>;
369 type MemoryExtra = MemoryExtra;
370 type AllocExtra = AllocExtra;
371 type PointerTag = Tag;
372 type ExtraFnVal = Dlsym;
375 MonoHashMap<AllocId, (MemoryKind<MiriMemoryKind>, Allocation<Tag, Self::AllocExtra>)>;
377 const GLOBAL_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::Global);
380 fn enforce_alignment(memory_extra: &MemoryExtra) -> bool {
381 memory_extra.check_alignment != AlignmentCheck::None
385 fn force_int_for_alignment_check(memory_extra: &Self::MemoryExtra) -> bool {
386 memory_extra.check_alignment == AlignmentCheck::Int
390 fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
395 fn enforce_abi(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
396 ecx.machine.enforce_abi
400 fn find_mir_or_eval_fn(
401 ecx: &mut InterpCx<'mir, 'tcx, Self>,
402 instance: ty::Instance<'tcx>,
404 args: &[OpTy<'tcx, Tag>],
405 ret: Option<(&PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
406 unwind: StackPopUnwind,
407 ) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
408 ecx.find_mir_or_eval_fn(instance, abi, args, ret, unwind)
413 ecx: &mut InterpCx<'mir, 'tcx, Self>,
416 args: &[OpTy<'tcx, Tag>],
417 ret: Option<(&PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
418 _unwind: StackPopUnwind,
419 ) -> InterpResult<'tcx> {
420 ecx.call_dlsym(fn_val, abi, args, ret)
425 ecx: &mut rustc_mir::interpret::InterpCx<'mir, 'tcx, Self>,
426 instance: ty::Instance<'tcx>,
427 args: &[OpTy<'tcx, Tag>],
428 ret: Option<(&PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
429 unwind: StackPopUnwind,
430 ) -> InterpResult<'tcx> {
431 ecx.call_intrinsic(instance, args, ret, unwind)
436 ecx: &mut InterpCx<'mir, 'tcx, Self>,
437 msg: &mir::AssertMessage<'tcx>,
438 unwind: Option<mir::BasicBlock>,
439 ) -> InterpResult<'tcx> {
440 ecx.assert_panic(msg, unwind)
444 fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
445 throw_machine_stop!(TerminationInfo::Abort(msg))
450 ecx: &rustc_mir::interpret::InterpCx<'mir, 'tcx, Self>,
452 left: &ImmTy<'tcx, Tag>,
453 right: &ImmTy<'tcx, Tag>,
454 ) -> InterpResult<'tcx, (Scalar<Tag>, bool, ty::Ty<'tcx>)> {
455 ecx.binary_ptr_op(bin_op, left, right)
459 ecx: &mut InterpCx<'mir, 'tcx, Self>,
460 dest: &PlaceTy<'tcx, Tag>,
461 ) -> InterpResult<'tcx> {
462 trace!("box_alloc for {:?}", dest.layout.ty);
463 let layout = ecx.layout_of(dest.layout.ty.builtin_deref(false).unwrap().ty)?;
464 // First argument: `size`.
465 // (`0` is allowed here -- this is expected to be handled by the lang item).
466 let size = Scalar::from_machine_usize(layout.size.bytes(), ecx);
468 // Second argument: `align`.
469 let align = Scalar::from_machine_usize(layout.align.abi.bytes(), ecx);
471 // Call the `exchange_malloc` lang item.
472 let malloc = ecx.tcx.lang_items().exchange_malloc_fn().unwrap();
473 let malloc = ty::Instance::mono(ecx.tcx.tcx, malloc);
477 &[size.into(), align.into()],
479 // Don't do anything when we are done. The `statement()` function will increment
480 // the old stack frame's stmt counter to the next statement, which means that when
481 // `exchange_malloc` returns, we go on evaluating exactly where we want to be.
482 StackPopCleanup::None { cleanup: true },
487 fn thread_local_static_alloc_id(
488 ecx: &mut InterpCx<'mir, 'tcx, Self>,
490 ) -> InterpResult<'tcx, AllocId> {
491 ecx.get_or_create_thread_local_alloc_id(def_id)
494 fn extern_static_alloc_id(
495 memory: &Memory<'mir, 'tcx, Self>,
497 ) -> InterpResult<'tcx, AllocId> {
498 let attrs = memory.tcx.get_attrs(def_id);
499 let link_name = match memory.tcx.sess.first_attr_value_str_by_name(&attrs, sym::link_name) {
501 None => memory.tcx.item_name(def_id),
503 if let Some(&id) = memory.extra.extern_statics.get(&link_name) {
506 throw_unsup_format!("`extern` static {:?} is not supported by Miri", def_id)
510 fn init_allocation_extra<'b>(
511 memory_extra: &MemoryExtra,
513 alloc: Cow<'b, Allocation>,
514 kind: Option<MemoryKind<Self::MemoryKind>>,
515 ) -> (Cow<'b, Allocation<Self::PointerTag, Self::AllocExtra>>, Self::PointerTag) {
516 if Some(id) == memory_extra.tracked_alloc_id {
517 register_diagnostic(NonHaltingDiagnostic::CreatedAlloc(id));
520 let kind = kind.expect("we set our STATIC_KIND so this cannot be None");
521 let alloc = alloc.into_owned();
522 let (stacks, base_tag) = if let Some(stacked_borrows) = &memory_extra.stacked_borrows {
523 let (stacks, base_tag) =
524 Stacks::new_allocation(id, alloc.size(), stacked_borrows, kind);
525 (Some(stacks), base_tag)
527 // No stacks, no tag.
528 (None, Tag::Untagged)
530 let race_alloc = if let Some(data_race) = &memory_extra.data_race {
531 Some(data_race::AllocExtra::new_allocation(&data_race, alloc.size(), kind))
535 let mut stacked_borrows = memory_extra.stacked_borrows.as_ref().map(|sb| sb.borrow_mut());
536 let alloc: Allocation<Tag, Self::AllocExtra> = alloc.with_tags_and_extra(
538 if let Some(stacked_borrows) = &mut stacked_borrows {
539 // Only globals may already contain pointers at this point
540 assert_eq!(kind, MiriMemoryKind::Global.into());
541 stacked_borrows.global_base_ptr(alloc)
546 AllocExtra { stacked_borrows: stacks, data_race: race_alloc },
548 (Cow::Owned(alloc), base_tag)
553 memory_extra: &Self::MemoryExtra,
554 alloc_extra: &AllocExtra,
557 ) -> InterpResult<'tcx> {
558 if let Some(data_race) = &alloc_extra.data_race {
559 data_race.read(ptr, size, memory_extra.data_race.as_ref().unwrap())?;
561 if let Some(stacked_borrows) = &alloc_extra.stacked_borrows {
562 stacked_borrows.memory_read(ptr, size, memory_extra.stacked_borrows.as_ref().unwrap())
570 memory_extra: &mut Self::MemoryExtra,
571 alloc_extra: &mut AllocExtra,
574 ) -> InterpResult<'tcx> {
575 if let Some(data_race) = &mut alloc_extra.data_race {
576 data_race.write(ptr, size, memory_extra.data_race.as_mut().unwrap())?;
578 if let Some(stacked_borrows) = &mut alloc_extra.stacked_borrows {
579 stacked_borrows.memory_written(
582 memory_extra.stacked_borrows.as_mut().unwrap(),
590 fn memory_deallocated(
591 memory_extra: &mut Self::MemoryExtra,
592 alloc_extra: &mut AllocExtra,
595 ) -> InterpResult<'tcx> {
596 if Some(ptr.alloc_id) == memory_extra.tracked_alloc_id {
597 register_diagnostic(NonHaltingDiagnostic::FreedAlloc(ptr.alloc_id));
599 if let Some(data_race) = &mut alloc_extra.data_race {
600 data_race.deallocate(ptr, size, memory_extra.data_race.as_mut().unwrap())?;
602 if let Some(stacked_borrows) = &mut alloc_extra.stacked_borrows {
603 stacked_borrows.memory_deallocated(
606 memory_extra.stacked_borrows.as_mut().unwrap(),
613 fn after_static_mem_initialized(
614 ecx: &mut InterpCx<'mir, 'tcx, Self>,
615 ptr: Pointer<Self::PointerTag>,
617 ) -> InterpResult<'tcx> {
618 if ecx.memory.extra.data_race.is_some() {
619 ecx.reset_vector_clocks(ptr, size)?;
625 fn tag_global_base_pointer(memory_extra: &MemoryExtra, id: AllocId) -> Self::PointerTag {
626 if let Some(stacked_borrows) = &memory_extra.stacked_borrows {
627 stacked_borrows.borrow_mut().global_base_ptr(id)
635 ecx: &mut InterpCx<'mir, 'tcx, Self>,
636 kind: mir::RetagKind,
637 place: &PlaceTy<'tcx, Tag>,
638 ) -> InterpResult<'tcx> {
639 if ecx.memory.extra.stacked_borrows.is_some() { ecx.retag(kind, place) } else { Ok(()) }
644 ecx: &mut InterpCx<'mir, 'tcx, Self>,
645 frame: Frame<'mir, 'tcx, Tag>,
646 ) -> InterpResult<'tcx, Frame<'mir, 'tcx, Tag, FrameData<'tcx>>> {
647 // Start recording our event before doing anything else
648 let timing = if let Some(profiler) = ecx.machine.profiler.as_ref() {
649 let fn_name = frame.instance.to_string();
650 let entry = ecx.machine.string_cache.entry(fn_name.clone());
651 let name = entry.or_insert_with(|| profiler.alloc_string(&*fn_name));
653 Some(profiler.start_recording_interval_event_detached(
655 measureme::EventId::from_label(*name),
656 ecx.get_active_thread().to_u32(),
662 let stacked_borrows = ecx.memory.extra.stacked_borrows.as_ref();
663 let call_id = stacked_borrows.map_or(NonZeroU64::new(1).unwrap(), |stacked_borrows| {
664 stacked_borrows.borrow_mut().new_call()
667 let extra = FrameData { call_id, catch_unwind: None, timing };
668 Ok(frame.with_extra(extra))
672 ecx: &'a InterpCx<'mir, 'tcx, Self>,
673 ) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
674 ecx.active_thread_stack()
678 ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
679 ) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
680 ecx.active_thread_stack_mut()
684 fn after_stack_push(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
685 if ecx.memory.extra.stacked_borrows.is_some() { ecx.retag_return_place() } else { Ok(()) }
690 ecx: &mut InterpCx<'mir, 'tcx, Self>,
691 mut frame: Frame<'mir, 'tcx, Tag, FrameData<'tcx>>,
693 ) -> InterpResult<'tcx, StackPopJump> {
694 let timing = frame.extra.timing.take();
695 let res = ecx.handle_stack_pop(frame.extra, unwinding);
696 if let Some(profiler) = ecx.machine.profiler.as_ref() {
697 profiler.finish_recording_interval_event(timing.unwrap());
704 memory: &Memory<'mir, 'tcx, Self>,
706 ) -> InterpResult<'tcx, Pointer<Self::PointerTag>> {
707 intptrcast::GlobalState::int_to_ptr(int, memory)
712 memory: &Memory<'mir, 'tcx, Self>,
713 ptr: Pointer<Self::PointerTag>,
714 ) -> InterpResult<'tcx, u64> {
715 intptrcast::GlobalState::ptr_to_int(ptr, memory)