diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-07-07 19:45:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-07 19:45:41 +0800 |
| commit | eed55947accb36fdd2af438aa599804aac7dd96b (patch) | |
| tree | 737ae2add9d1a120ac98dcfc30842b483a1f73d8 /src/tools | |
| parent | 02aa4ff12f09f8902b720ab7fc68d5ecfb84dda7 (diff) | |
| parent | 777516652887e3bdfb827bd9d1e83d442266adb1 (diff) | |
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?
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/miri/src/concurrency/thread.rs | 2 | ||||
| -rw-r--r-- | src/tools/miri/src/eval.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/src/helpers.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/src/machine.rs | 2 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/panic.rs | 14 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/tls.rs | 6 |
6 files changed, 16 insertions, 16 deletions
diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index 56c19794854..a4e93f9222c 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -894,7 +894,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { start_abi, &[func_arg], Some(&ret_place), - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; // Restore the old active thread frame. diff --git a/src/tools/miri/src/eval.rs b/src/tools/miri/src/eval.rs index 63578912c24..425a136dfa5 100644 --- a/src/tools/miri/src/eval.rs +++ b/src/tools/miri/src/eval.rs @@ -436,7 +436,7 @@ pub fn create_ecx<'tcx>( ImmTy::from_uint(sigpipe, ecx.machine.layouts.u8), ], Some(&ret_place), - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; } MiriEntryFnType::MiriStart => { @@ -445,7 +445,7 @@ pub fn create_ecx<'tcx>( ExternAbi::Rust, &[argc, argv], Some(&ret_place), - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; } } diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index b259243602e..c150dc16b07 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -444,7 +444,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { caller_abi: ExternAbi, args: &[ImmTy<'tcx>], dest: Option<&MPlaceTy<'tcx>>, - stack_pop: StackPopCleanup, + cont: ReturnContinuation, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -472,7 +472,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { &args.iter().map(|a| FnArg::Copy(a.clone().into())).collect::<Vec<_>>(), /*with_caller_location*/ false, &dest.into(), - stack_pop, + cont, ) } diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index 4f3dc485325..693b8916d89 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -1199,7 +1199,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { ExternAbi::Rust, &[], None, - StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable }, + ReturnContinuation::Goto { ret: None, unwind: mir::UnwindAction::Unreachable }, )?; interp_ok(()) } diff --git a/src/tools/miri/src/shims/panic.rs b/src/tools/miri/src/shims/panic.rs index a6bce830149..9490761d0c9 100644 --- a/src/tools/miri/src/shims/panic.rs +++ b/src/tools/miri/src/shims/panic.rs @@ -92,7 +92,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { &[data.clone()], None, // Directly return to caller. - StackPopCleanup::Goto { ret, unwind: mir::UnwindAction::Continue }, + ReturnContinuation::Goto { ret, unwind: mir::UnwindAction::Continue }, )?; // 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> { &[catch_unwind.data, payload], None, // Directly return to caller of `catch_unwind`. - StackPopCleanup::Goto { + ReturnContinuation::Goto { ret: catch_unwind.ret, // `catch_fn` must not unwind. unwind: mir::UnwindAction::Unreachable, @@ -172,7 +172,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::Rust, &[this.mplace_to_ref(&msg)?], None, - StackPopCleanup::Goto { ret: None, unwind }, + ReturnContinuation::Goto { ret: None, unwind }, ) } @@ -191,7 +191,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::Rust, &[this.mplace_to_ref(&msg)?], None, - StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable }, + ReturnContinuation::Goto { ret: None, unwind: mir::UnwindAction::Unreachable }, ) } @@ -220,7 +220,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::Rust, &[index, len], None, - StackPopCleanup::Goto { ret: None, unwind }, + ReturnContinuation::Goto { ret: None, unwind }, )?; } MisalignedPointerDereference { required, found } => { @@ -241,7 +241,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::Rust, &[required, found], None, - StackPopCleanup::Goto { ret: None, unwind }, + ReturnContinuation::Goto { ret: None, unwind }, )?; } @@ -254,7 +254,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::Rust, &[], None, - StackPopCleanup::Goto { ret: None, unwind }, + ReturnContinuation::Goto { ret: None, unwind }, )?; } } diff --git a/src/tools/miri/src/shims/tls.rs b/src/tools/miri/src/shims/tls.rs index 46a417689a2..7182637437a 100644 --- a/src/tools/miri/src/shims/tls.rs +++ b/src/tools/miri/src/shims/tls.rs @@ -325,7 +325,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::System { unwind: false }, &[null_ptr.clone(), ImmTy::from_scalar(reason, this.machine.layouts.u32), null_ptr], None, - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; interp_ok(()) } @@ -346,7 +346,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::C { unwind: false }, &[ImmTy::from_scalar(data, this.machine.layouts.mut_raw_ptr)], None, - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; return interp_ok(Poll::Pending); @@ -383,7 +383,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ExternAbi::C { unwind: false }, &[ImmTy::from_scalar(ptr, this.machine.layouts.mut_raw_ptr)], None, - StackPopCleanup::Root { cleanup: true }, + ReturnContinuation::Stop { cleanup: true }, )?; return interp_ok(Poll::Pending); |
