Skip to content

Commit aa9c42b

Browse files
authored
Rollup merge of #143528 - RalfJung:stack-pop-cleanup, r=oli-obk
interpret: rename StackPopCleanup The name `StackPopCleanup` stopped making sense a long time ago IMO -- in the common case, it has nothing to do with "cleanup", and everything with where the program should jump next. If we didn't have unwinding this would be just the return block, but given that we do have unwinding I figured maybe "continuation" would be a good name. This comes up in [continuation-passing style](https://en.wikipedia.org/wiki/Continuation-passing_style) and refers to where the program will *continue* when a function is done. So from a PL perspective it is the most fitting term I think -- but it may be too jargony. r? `@oli-obk` what do you think?
2 parents 406ebbc + 86e4b56 commit aa9c42b

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/concurrency/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
894894
start_abi,
895895
&[func_arg],
896896
Some(&ret_place),
897-
StackPopCleanup::Root { cleanup: true },
897+
ReturnContinuation::Stop { cleanup: true },
898898
)?;
899899

900900
// Restore the old active thread frame.

src/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ pub fn create_ecx<'tcx>(
436436
ImmTy::from_uint(sigpipe, ecx.machine.layouts.u8),
437437
],
438438
Some(&ret_place),
439-
StackPopCleanup::Root { cleanup: true },
439+
ReturnContinuation::Stop { cleanup: true },
440440
)?;
441441
}
442442
MiriEntryFnType::MiriStart => {
@@ -445,7 +445,7 @@ pub fn create_ecx<'tcx>(
445445
ExternAbi::Rust,
446446
&[argc, argv],
447447
Some(&ret_place),
448-
StackPopCleanup::Root { cleanup: true },
448+
ReturnContinuation::Stop { cleanup: true },
449449
)?;
450450
}
451451
}

src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
444444
caller_abi: ExternAbi,
445445
args: &[ImmTy<'tcx>],
446446
dest: Option<&MPlaceTy<'tcx>>,
447-
stack_pop: StackPopCleanup,
447+
cont: ReturnContinuation,
448448
) -> InterpResult<'tcx> {
449449
let this = self.eval_context_mut();
450450

@@ -472,7 +472,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
472472
&args.iter().map(|a| FnArg::Copy(a.clone().into())).collect::<Vec<_>>(),
473473
/*with_caller_location*/ false,
474474
&dest.into(),
475-
stack_pop,
475+
cont,
476476
)
477477
}
478478

src/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11991199
ExternAbi::Rust,
12001200
&[],
12011201
None,
1202-
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
1202+
ReturnContinuation::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
12031203
)?;
12041204
interp_ok(())
12051205
}

src/shims/panic.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9292
&[data.clone()],
9393
None,
9494
// Directly return to caller.
95-
StackPopCleanup::Goto { ret, unwind: mir::UnwindAction::Continue },
95+
ReturnContinuation::Goto { ret, unwind: mir::UnwindAction::Continue },
9696
)?;
9797

9898
// We ourselves will return `0`, eventually (will be overwritten if we catch a panic).
@@ -143,7 +143,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
143143
&[catch_unwind.data, payload],
144144
None,
145145
// Directly return to caller of `catch_unwind`.
146-
StackPopCleanup::Goto {
146+
ReturnContinuation::Goto {
147147
ret: catch_unwind.ret,
148148
// `catch_fn` must not unwind.
149149
unwind: mir::UnwindAction::Unreachable,
@@ -172,7 +172,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
172172
ExternAbi::Rust,
173173
&[this.mplace_to_ref(&msg)?],
174174
None,
175-
StackPopCleanup::Goto { ret: None, unwind },
175+
ReturnContinuation::Goto { ret: None, unwind },
176176
)
177177
}
178178

@@ -191,7 +191,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
191191
ExternAbi::Rust,
192192
&[this.mplace_to_ref(&msg)?],
193193
None,
194-
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
194+
ReturnContinuation::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
195195
)
196196
}
197197

@@ -220,7 +220,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
220220
ExternAbi::Rust,
221221
&[index, len],
222222
None,
223-
StackPopCleanup::Goto { ret: None, unwind },
223+
ReturnContinuation::Goto { ret: None, unwind },
224224
)?;
225225
}
226226
MisalignedPointerDereference { required, found } => {
@@ -241,7 +241,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
241241
ExternAbi::Rust,
242242
&[required, found],
243243
None,
244-
StackPopCleanup::Goto { ret: None, unwind },
244+
ReturnContinuation::Goto { ret: None, unwind },
245245
)?;
246246
}
247247

@@ -254,7 +254,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
254254
ExternAbi::Rust,
255255
&[],
256256
None,
257-
StackPopCleanup::Goto { ret: None, unwind },
257+
ReturnContinuation::Goto { ret: None, unwind },
258258
)?;
259259
}
260260
}

src/shims/tls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
325325
ExternAbi::System { unwind: false },
326326
&[null_ptr.clone(), ImmTy::from_scalar(reason, this.machine.layouts.u32), null_ptr],
327327
None,
328-
StackPopCleanup::Root { cleanup: true },
328+
ReturnContinuation::Stop { cleanup: true },
329329
)?;
330330
interp_ok(())
331331
}
@@ -346,7 +346,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
346346
ExternAbi::C { unwind: false },
347347
&[ImmTy::from_scalar(data, this.machine.layouts.mut_raw_ptr)],
348348
None,
349-
StackPopCleanup::Root { cleanup: true },
349+
ReturnContinuation::Stop { cleanup: true },
350350
)?;
351351

352352
return interp_ok(Poll::Pending);
@@ -383,7 +383,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
383383
ExternAbi::C { unwind: false },
384384
&[ImmTy::from_scalar(ptr, this.machine.layouts.mut_raw_ptr)],
385385
None,
386-
StackPopCleanup::Root { cleanup: true },
386+
ReturnContinuation::Stop { cleanup: true },
387387
)?;
388388

389389
return interp_ok(Poll::Pending);

0 commit comments

Comments
 (0)