@@ -215,7 +215,7 @@ impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> {
215215}
216216
217217/// The machine itself.
218- pub struct Evaluator < ' tcx > {
218+ pub struct Evaluator < ' mir , ' tcx > {
219219 /// Environment variables set by `setenv`.
220220 /// Miri does not expose env vars from the host to the emulated program.
221221 pub ( crate ) env_vars : EnvVars < ' tcx > ,
@@ -251,11 +251,14 @@ pub struct Evaluator<'tcx> {
251251 /// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
252252 pub ( crate ) time_anchor : Instant ,
253253
254+ /// The call stack.
255+ pub ( crate ) stack : Vec < Frame < ' mir , ' tcx , Tag , FrameData < ' tcx > > > ,
256+
254257 /// Precomputed `TyLayout`s for primitive data types that are commonly used inside Miri.
255258 pub ( crate ) layouts : PrimitiveLayouts < ' tcx > ,
256259}
257260
258- impl < ' tcx > Evaluator < ' tcx > {
261+ impl < ' mir , ' tcx > Evaluator < ' mir , ' tcx > {
259262 pub ( crate ) fn new (
260263 communicate : bool ,
261264 validate : bool ,
@@ -279,12 +282,13 @@ impl<'tcx> Evaluator<'tcx> {
279282 panic_payload : None ,
280283 time_anchor : Instant :: now ( ) ,
281284 layouts,
285+ stack : Vec :: default ( ) ,
282286 }
283287 }
284288}
285289
286290/// A rustc InterpCx for Miri.
287- pub type MiriEvalContext < ' mir , ' tcx > = InterpCx < ' mir , ' tcx , Evaluator < ' tcx > > ;
291+ pub type MiriEvalContext < ' mir , ' tcx > = InterpCx < ' mir , ' tcx , Evaluator < ' mir , ' tcx > > ;
288292
289293/// A little trait that's useful to be inherited by extension traits.
290294pub trait MiriEvalContextExt < ' mir , ' tcx > {
@@ -303,7 +307,7 @@ impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx>
303307}
304308
305309/// Machine hook implementations.
306- impl < ' mir , ' tcx > Machine < ' mir , ' tcx > for Evaluator < ' tcx > {
310+ impl < ' mir , ' tcx > Machine < ' mir , ' tcx > for Evaluator < ' mir , ' tcx > {
307311 type MemoryKind = MiriMemoryKind ;
308312
309313 type FrameExtra = FrameData < ' tcx > ;
@@ -521,6 +525,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
521525 Ok ( frame. with_extra ( extra) )
522526 }
523527
528+ #[ inline( always) ]
529+ fn stack < ' a > (
530+ ecx : & ' a InterpCx < ' mir , ' tcx , Self > ,
531+ ) -> & ' a [ Frame < ' mir , ' tcx , Self :: PointerTag , Self :: FrameExtra > ] {
532+ & ecx. machine . stack
533+ }
534+
535+ #[ inline( always) ]
536+ fn stack_mut < ' a > (
537+ ecx : & ' a mut InterpCx < ' mir , ' tcx , Self > ,
538+ ) -> & ' a mut Vec < Frame < ' mir , ' tcx , Self :: PointerTag , Self :: FrameExtra > > {
539+ & mut ecx. machine . stack
540+ }
541+
524542 #[ inline( always) ]
525543 fn after_stack_push ( ecx : & mut InterpCx < ' mir , ' tcx , Self > ) -> InterpResult < ' tcx > {
526544 if ecx. memory . extra . stacked_borrows . is_some ( ) {
0 commit comments