@@ -72,8 +72,8 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> {
72
72
////////////////////////////////////////////////////////////////////////////////
73
73
// Return place and locals
74
74
////////////////////////////////////////////////////////////////////////////////
75
- /// Work to perform when returning from this function.
76
- return_to_block : StackPopCleanup ,
75
+ /// Where to continue when returning from this function.
76
+ return_cont : ReturnContinuation ,
77
77
78
78
/// The location where the result of the current stack frame should be written to,
79
79
/// and its layout in the caller. This place is to be interpreted relative to the
@@ -106,19 +106,19 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> {
106
106
pub ( super ) loc : Either < mir:: Location , Span > ,
107
107
}
108
108
109
+ /// Where and how to continue when returning/unwinding from the current function.
109
110
#[ derive( Clone , Copy , Eq , PartialEq , Debug ) ] // Miri debug-prints these
110
- pub enum StackPopCleanup {
111
+ pub enum ReturnContinuation {
111
112
/// Jump to the next block in the caller, or cause UB if None (that's a function
112
- /// that may never return). Also store layout of return place so
113
- /// we can validate it at that layout.
113
+ /// that may never return).
114
114
/// `ret` stores the block we jump to on a normal return, while `unwind`
115
115
/// stores the block used for cleanup during unwinding.
116
116
Goto { ret : Option < mir:: BasicBlock > , unwind : mir:: UnwindAction } ,
117
- /// The root frame of the stack: nowhere else to jump to.
117
+ /// The root frame of the stack: nowhere else to jump to, so we stop .
118
118
/// `cleanup` says whether locals are deallocated. Static computation
119
119
/// wants them leaked to intern what they need (and just throw away
120
120
/// the entire `ecx` when it is done).
121
- Root { cleanup : bool } ,
121
+ Stop { cleanup : bool } ,
122
122
}
123
123
124
124
/// Return type of [`InterpCx::pop_stack_frame_raw`].
@@ -127,8 +127,8 @@ pub struct StackPopInfo<'tcx, Prov: Provenance> {
127
127
/// stack frame.
128
128
pub return_action : ReturnAction ,
129
129
130
- /// [`return_to_block `](Frame::return_to_block ) of the popped stack frame.
131
- pub return_to_block : StackPopCleanup ,
130
+ /// [`return_cont `](Frame::return_cont ) of the popped stack frame.
131
+ pub return_cont : ReturnContinuation ,
132
132
133
133
/// [`return_place`](Frame::return_place) of the popped stack frame.
134
134
pub return_place : PlaceTy < ' tcx , Prov > ,
@@ -255,7 +255,7 @@ impl<'tcx, Prov: Provenance> Frame<'tcx, Prov> {
255
255
Frame {
256
256
body : self . body ,
257
257
instance : self . instance ,
258
- return_to_block : self . return_to_block ,
258
+ return_cont : self . return_cont ,
259
259
return_place : self . return_place ,
260
260
locals : self . locals ,
261
261
loc : self . loc ,
@@ -350,20 +350,20 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
350
350
/// the arguments or local variables.
351
351
///
352
352
/// The high-level version of this is `init_stack_frame`.
353
- #[ instrument( skip( self , body, return_place, return_to_block ) , level = "debug" ) ]
353
+ #[ instrument( skip( self , body, return_place, return_cont ) , level = "debug" ) ]
354
354
pub ( crate ) fn push_stack_frame_raw (
355
355
& mut self ,
356
356
instance : ty:: Instance < ' tcx > ,
357
357
body : & ' tcx mir:: Body < ' tcx > ,
358
358
return_place : & PlaceTy < ' tcx , M :: Provenance > ,
359
- return_to_block : StackPopCleanup ,
359
+ return_cont : ReturnContinuation ,
360
360
) -> InterpResult < ' tcx > {
361
361
trace ! ( "body: {:#?}" , body) ;
362
362
363
363
// We can push a `Root` frame if and only if the stack is empty.
364
364
debug_assert_eq ! (
365
365
self . stack( ) . is_empty( ) ,
366
- matches!( return_to_block , StackPopCleanup :: Root { .. } )
366
+ matches!( return_cont , ReturnContinuation :: Stop { .. } )
367
367
) ;
368
368
369
369
// First push a stack frame so we have access to `instantiate_from_current_frame` and other
@@ -373,7 +373,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
373
373
let pre_frame = Frame {
374
374
body,
375
375
loc : Right ( body. span ) , // Span used for errors caused during preamble.
376
- return_to_block ,
376
+ return_cont ,
377
377
return_place : return_place. clone ( ) ,
378
378
locals,
379
379
instance,
@@ -429,15 +429,15 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
429
429
copy_ret_val ( self , & frame. return_place ) ?;
430
430
}
431
431
432
- let return_to_block = frame. return_to_block ;
432
+ let return_cont = frame. return_cont ;
433
433
let return_place = frame. return_place . clone ( ) ;
434
434
435
435
// Cleanup: deallocate locals.
436
436
// Usually we want to clean up (deallocate locals), but in a few rare cases we don't.
437
437
// We do this while the frame is still on the stack, so errors point to the callee.
438
- let cleanup = match return_to_block {
439
- StackPopCleanup :: Goto { .. } => true ,
440
- StackPopCleanup :: Root { cleanup, .. } => cleanup,
438
+ let cleanup = match return_cont {
439
+ ReturnContinuation :: Goto { .. } => true ,
440
+ ReturnContinuation :: Stop { cleanup, .. } => cleanup,
441
441
} ;
442
442
443
443
let return_action = if cleanup {
@@ -455,7 +455,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
455
455
ReturnAction :: NoCleanup
456
456
} ;
457
457
458
- interp_ok ( StackPopInfo { return_action, return_to_block , return_place } )
458
+ interp_ok ( StackPopInfo { return_action, return_cont , return_place } )
459
459
}
460
460
461
461
/// In the current stack frame, mark all locals as live that are not arguments and don't have
0 commit comments