pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 23 methods
// Provided methods
fn thread_id_try_from(
&self,
id: impl TryInto<u32>,
) -> Result<ThreadId, ThreadLookupError> { ... }
fn get_or_create_thread_local_alloc(
&mut self,
def_id: DefId,
) -> InterpResult<'tcx, StrictPointer> { ... }
fn start_regular_thread(
&mut self,
thread: Option<MPlaceTy<'tcx>>,
start_routine: Pointer,
start_abi: ExternAbi,
func_arg: ImmTy<'tcx>,
ret_layout: TyAndLayout<'tcx>,
) -> InterpResult<'tcx, ThreadId> { ... }
fn replace_active_thread_stack(
&mut self,
on_stack_empty: StackEmptyCallback<'tcx>,
) { ... }
fn terminate_active_thread(&mut self, for_exit: bool) -> InterpResult<'tcx> { ... }
fn block_thread(
&mut self,
reason: BlockReason,
deadline: Option<Deadline>,
callback: DynUnblockCallback<'tcx>,
) { ... }
fn unblock_thread(
&mut self,
thread: ThreadId,
reason: BlockReason,
) -> InterpResult<'tcx> { ... }
fn unblock_expired_deadlines(
&mut self,
) -> InterpResult<'tcx, Option<Duration>> { ... }
fn detach_thread(
&mut self,
thread_id: ThreadId,
allow_terminated_joined: bool,
) -> InterpResult<'tcx> { ... }
fn join_thread(
&mut self,
joined_thread_id: ThreadId,
success_retval: Scalar,
return_dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn join_thread_exclusive(
&mut self,
joined_thread_id: ThreadId,
success_retval: Scalar,
return_dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn active_thread(&self) -> ThreadId { ... }
fn active_thread_mut(&mut self) -> &mut Thread<'tcx> { ... }
fn active_thread_ref(&self) -> &Thread<'tcx> { ... }
fn get_total_thread_count(&self) -> usize { ... }
fn have_all_terminated(&self) -> bool { ... }
fn enable_thread(&mut self, thread_id: ThreadId) { ... }
fn active_thread_stack<'a>(
&'a self,
) -> &'a [Frame<'tcx, Provenance, FrameExtra<'tcx>>] { ... }
fn active_thread_stack_mut<'a>(
&'a mut self,
) -> &'a mut Vec<Frame<'tcx, Provenance, FrameExtra<'tcx>>> { ... }
fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>) { ... }
fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>
where 'tcx: 'c { ... }
fn yield_active_thread(&mut self) { ... }
fn maybe_preempt_active_thread(&mut self) { ... }
}Provided Methods§
fn thread_id_try_from( &self, id: impl TryInto<u32>, ) -> Result<ThreadId, ThreadLookupError>
Sourcefn get_or_create_thread_local_alloc(
&mut self,
def_id: DefId,
) -> InterpResult<'tcx, StrictPointer>
fn get_or_create_thread_local_alloc( &mut self, def_id: DefId, ) -> InterpResult<'tcx, StrictPointer>
Get a thread-specific allocation id for the given thread-local static. If needed, allocate a new one.
Sourcefn start_regular_thread(
&mut self,
thread: Option<MPlaceTy<'tcx>>,
start_routine: Pointer,
start_abi: ExternAbi,
func_arg: ImmTy<'tcx>,
ret_layout: TyAndLayout<'tcx>,
) -> InterpResult<'tcx, ThreadId>
fn start_regular_thread( &mut self, thread: Option<MPlaceTy<'tcx>>, start_routine: Pointer, start_abi: ExternAbi, func_arg: ImmTy<'tcx>, ret_layout: TyAndLayout<'tcx>, ) -> InterpResult<'tcx, ThreadId>
Start a regular (non-main) thread.
Sourcefn replace_active_thread_stack(
&mut self,
on_stack_empty: StackEmptyCallback<'tcx>,
)
fn replace_active_thread_stack( &mut self, on_stack_empty: StackEmptyCallback<'tcx>, )
Replace the active thread with an empty one, and a new on-empty handler.
The memory of the old stack is leaked.
Used to implement exit.
Sourcefn terminate_active_thread(&mut self, for_exit: bool) -> InterpResult<'tcx>
fn terminate_active_thread(&mut self, for_exit: bool) -> InterpResult<'tcx>
Handles thread termination of the active thread: wakes up threads joining on this one,
and frees the thread’s thread-local statics. for_exit indicates whether we are
about to exit the program; that changes some details.
This is called by the eval loop when a thread’s on_stack_empty returns Ready.
Sourcefn block_thread(
&mut self,
reason: BlockReason,
deadline: Option<Deadline>,
callback: DynUnblockCallback<'tcx>,
)
fn block_thread( &mut self, reason: BlockReason, deadline: Option<Deadline>, callback: DynUnblockCallback<'tcx>, )
Block the current thread, with an optional timeout. The callback will be invoked when the thread gets unblocked.
Sourcefn unblock_thread(
&mut self,
thread: ThreadId,
reason: BlockReason,
) -> InterpResult<'tcx>
fn unblock_thread( &mut self, thread: ThreadId, reason: BlockReason, ) -> InterpResult<'tcx>
Put the blocked thread into the enabled state. Sanity-checks that the thread previously was blocked for the right reason.
Sourcefn unblock_expired_deadlines(&mut self) -> InterpResult<'tcx, Option<Duration>>
fn unblock_expired_deadlines(&mut self) -> InterpResult<'tcx, Option<Duration>>
Find all threads with expired timeouts, unblock them and execute their timeout callbacks.
This method returns the minimum duration until the next thread deadline.
If all ready threads have no deadline set, None is returned.
fn detach_thread( &mut self, thread_id: ThreadId, allow_terminated_joined: bool, ) -> InterpResult<'tcx>
Sourcefn join_thread(
&mut self,
joined_thread_id: ThreadId,
success_retval: Scalar,
return_dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn join_thread( &mut self, joined_thread_id: ThreadId, success_retval: Scalar, return_dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Mark that the active thread tries to join the thread with joined_thread_id.
When the join is successful (immediately, or as soon as the joined thread finishes), success_retval will be written to return_dest.
Sourcefn join_thread_exclusive(
&mut self,
joined_thread_id: ThreadId,
success_retval: Scalar,
return_dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn join_thread_exclusive( &mut self, joined_thread_id: ThreadId, success_retval: Scalar, return_dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Mark that the active thread tries to exclusively join the thread with joined_thread_id.
If the thread is already joined by another thread, it will throw UB.
When the join is successful (immediately, or as soon as the joined thread finishes), success_retval will be written to return_dest.
fn active_thread(&self) -> ThreadId
fn active_thread_mut(&mut self) -> &mut Thread<'tcx>
fn active_thread_ref(&self) -> &Thread<'tcx>
fn get_total_thread_count(&self) -> usize
fn have_all_terminated(&self) -> bool
fn enable_thread(&mut self, thread_id: ThreadId)
fn active_thread_stack<'a>( &'a self, ) -> &'a [Frame<'tcx, Provenance, FrameExtra<'tcx>>]
fn active_thread_stack_mut<'a>( &'a mut self, ) -> &'a mut Vec<Frame<'tcx, Provenance, FrameExtra<'tcx>>>
Sourcefn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>)
fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>)
Set the name of the current thread. The buffer must not include the null terminator.
fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>where
'tcx: 'c,
fn yield_active_thread(&mut self)
fn maybe_preempt_active_thread(&mut self)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".