@@ -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 > ;
@@ -322,6 +326,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
322326 memory_extra. check_alignment
323327 }
324328
329+ #[ inline( always) ]
330+ fn stack < ' a > (
331+ ecx : & ' a InterpCx < ' mir , ' tcx , Self > ,
332+ ) -> & ' a [ Frame < ' mir , ' tcx , Self :: PointerTag , Self :: FrameExtra > ] {
333+ & ecx. machine . stack
334+ }
335+
336+ #[ inline( always) ]
337+ fn stack_mut < ' a > (
338+ ecx : & ' a mut InterpCx < ' mir , ' tcx , Self > ,
339+ ) -> & ' a mut Vec < Frame < ' mir , ' tcx , Self :: PointerTag , Self :: FrameExtra > > {
340+ & mut ecx. machine . stack
341+ }
342+
325343 #[ inline( always) ]
326344 fn enforce_validity ( ecx : & InterpCx < ' mir , ' tcx , Self > ) -> bool {
327345 ecx. machine . validate
0 commit comments