@@ -215,7 +215,7 @@ impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> {
215
215
}
216
216
217
217
/// The machine itself.
218
- pub struct Evaluator < ' tcx > {
218
+ pub struct Evaluator < ' mir , ' tcx > {
219
219
/// Environment variables set by `setenv`.
220
220
/// Miri does not expose env vars from the host to the emulated program.
221
221
pub ( crate ) env_vars : EnvVars < ' tcx > ,
@@ -251,11 +251,14 @@ pub struct Evaluator<'tcx> {
251
251
/// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
252
252
pub ( crate ) time_anchor : Instant ,
253
253
254
+ /// The call stack.
255
+ pub ( crate ) stack : Vec < Frame < ' mir , ' tcx , Tag , FrameData < ' tcx > > > ,
256
+
254
257
/// Precomputed `TyLayout`s for primitive data types that are commonly used inside Miri.
255
258
pub ( crate ) layouts : PrimitiveLayouts < ' tcx > ,
256
259
}
257
260
258
- impl < ' tcx > Evaluator < ' tcx > {
261
+ impl < ' mir , ' tcx > Evaluator < ' mir , ' tcx > {
259
262
pub ( crate ) fn new (
260
263
communicate : bool ,
261
264
validate : bool ,
@@ -279,12 +282,13 @@ impl<'tcx> Evaluator<'tcx> {
279
282
panic_payload : None ,
280
283
time_anchor : Instant :: now ( ) ,
281
284
layouts,
285
+ stack : Vec :: default ( ) ,
282
286
}
283
287
}
284
288
}
285
289
286
290
/// 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 > > ;
288
292
289
293
/// A little trait that's useful to be inherited by extension traits.
290
294
pub trait MiriEvalContextExt < ' mir , ' tcx > {
@@ -303,7 +307,7 @@ impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx>
303
307
}
304
308
305
309
/// Machine hook implementations.
306
- impl < ' mir , ' tcx > Machine < ' mir , ' tcx > for Evaluator < ' tcx > {
310
+ impl < ' mir , ' tcx > Machine < ' mir , ' tcx > for Evaluator < ' mir , ' tcx > {
307
311
type MemoryKind = MiriMemoryKind ;
308
312
309
313
type FrameExtra = FrameData < ' tcx > ;
@@ -521,6 +525,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
521
525
Ok ( frame. with_extra ( extra) )
522
526
}
523
527
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
+
524
542
#[ inline( always) ]
525
543
fn after_stack_push ( ecx : & mut InterpCx < ' mir , ' tcx , Self > ) -> InterpResult < ' tcx > {
526
544
if ecx. memory . extra . stacked_borrows . is_some ( ) {
0 commit comments