pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 21 methods
// Provided methods
fn lazy_sync_init<T: 'static + Copy>(
&mut self,
primitive: &MPlaceTy<'tcx>,
init_offset: Size,
data: T,
) -> InterpResult<'tcx> { ... }
fn lazy_sync_get_data<T: 'static + Copy>(
&mut self,
primitive: &MPlaceTy<'tcx>,
init_offset: Size,
missing_data: impl FnOnce() -> InterpResult<'tcx, T>,
new_data: impl FnOnce(&mut MiriInterpCx<'tcx>) -> InterpResult<'tcx, T>,
) -> InterpResult<'tcx, T> { ... }
fn get_sync_or_init<'a, T: 'static>(
&'a mut self,
ptr: Pointer,
new: impl FnOnce(&'a mut MiriMachine<'tcx>) -> T,
) -> Option<&'a T>
where 'tcx: 'a { ... }
fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId { ... }
fn mutex_is_locked(&self, id: MutexId) -> bool { ... }
fn mutex_lock(&mut self, id: MutexId) { ... }
fn mutex_unlock(&mut self, id: MutexId) -> InterpResult<'tcx, Option<usize>> { ... }
fn mutex_enqueue_and_block(
&mut self,
id: MutexId,
retval_dest: Option<(Scalar, MPlaceTy<'tcx>)>,
) { ... }
fn rwlock_is_locked(&self, id: RwLockId) -> bool { ... }
fn rwlock_is_write_locked(&self, id: RwLockId) -> bool { ... }
fn rwlock_reader_lock(&mut self, id: RwLockId) { ... }
fn rwlock_reader_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool> { ... }
fn rwlock_enqueue_and_block_reader(
&mut self,
id: RwLockId,
retval: Scalar,
dest: MPlaceTy<'tcx>,
) { ... }
fn rwlock_writer_lock(&mut self, id: RwLockId) { ... }
fn rwlock_writer_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool> { ... }
fn rwlock_enqueue_and_block_writer(
&mut self,
id: RwLockId,
retval: Scalar,
dest: MPlaceTy<'tcx>,
) { ... }
fn condvar_is_awaited(&mut self, id: CondvarId) -> bool { ... }
fn condvar_wait(
&mut self,
condvar: CondvarId,
mutex: MutexId,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
retval_succ: Scalar,
retval_timeout: Scalar,
dest: MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn condvar_signal(&mut self, id: CondvarId) -> InterpResult<'tcx, bool> { ... }
fn futex_wait(
&mut self,
futex_ref: FutexRef,
bitset: u32,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
retval_succ: Scalar,
retval_timeout: Scalar,
dest: MPlaceTy<'tcx>,
errno_timeout: IoError,
) { ... }
fn futex_wake(
&mut self,
futex_ref: &FutexRef,
bitset: u32,
) -> InterpResult<'tcx, bool> { ... }
}
Provided Methods§
Sourcefn lazy_sync_init<T: 'static + Copy>(
&mut self,
primitive: &MPlaceTy<'tcx>,
init_offset: Size,
data: T,
) -> InterpResult<'tcx>
fn lazy_sync_init<T: 'static + Copy>( &mut self, primitive: &MPlaceTy<'tcx>, init_offset: Size, data: T, ) -> InterpResult<'tcx>
Helper for lazily initialized alloc_extra.sync
data:
this forces an immediate init.
Sourcefn lazy_sync_get_data<T: 'static + Copy>(
&mut self,
primitive: &MPlaceTy<'tcx>,
init_offset: Size,
missing_data: impl FnOnce() -> InterpResult<'tcx, T>,
new_data: impl FnOnce(&mut MiriInterpCx<'tcx>) -> InterpResult<'tcx, T>,
) -> InterpResult<'tcx, T>
fn lazy_sync_get_data<T: 'static + Copy>( &mut self, primitive: &MPlaceTy<'tcx>, init_offset: Size, missing_data: impl FnOnce() -> InterpResult<'tcx, T>, new_data: impl FnOnce(&mut MiriInterpCx<'tcx>) -> InterpResult<'tcx, T>, ) -> InterpResult<'tcx, T>
Helper for lazily initialized alloc_extra.sync
data:
Checks if the primitive is initialized:
- If yes, fetches the data from
alloc_extra.sync
, or callsmissing_data
if that fails and stores that inalloc_extra.sync
. - Otherwise, calls
new_data
to initialize the primitive.
Sourcefn get_sync_or_init<'a, T: 'static>(
&'a mut self,
ptr: Pointer,
new: impl FnOnce(&'a mut MiriMachine<'tcx>) -> T,
) -> Option<&'a T>where
'tcx: 'a,
fn get_sync_or_init<'a, T: 'static>(
&'a mut self,
ptr: Pointer,
new: impl FnOnce(&'a mut MiriMachine<'tcx>) -> T,
) -> Option<&'a T>where
'tcx: 'a,
Get the synchronization primitive associated with the given pointer, or initialize a new one.
Return None
if this pointer does not point to at least 1 byte of mutable memory.
Sourcefn mutex_get_owner(&mut self, id: MutexId) -> ThreadId
fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId
Get the id of the thread that currently owns this lock.
Sourcefn mutex_is_locked(&self, id: MutexId) -> bool
fn mutex_is_locked(&self, id: MutexId) -> bool
Check if locked.
Sourcefn mutex_lock(&mut self, id: MutexId)
fn mutex_lock(&mut self, id: MutexId)
Lock by setting the mutex owner and increasing the lock count.
Sourcefn mutex_unlock(&mut self, id: MutexId) -> InterpResult<'tcx, Option<usize>>
fn mutex_unlock(&mut self, id: MutexId) -> InterpResult<'tcx, Option<usize>>
Try unlocking by decreasing the lock count and returning the old lock
count. If the lock count reaches 0, release the lock and potentially
give to a new owner. If the lock was not locked by the current thread,
return None
.
Sourcefn mutex_enqueue_and_block(
&mut self,
id: MutexId,
retval_dest: Option<(Scalar, MPlaceTy<'tcx>)>,
)
fn mutex_enqueue_and_block( &mut self, id: MutexId, retval_dest: Option<(Scalar, MPlaceTy<'tcx>)>, )
Put the thread into the queue waiting for the mutex.
Once the Mutex becomes available and if it exists, retval_dest.0
will
be written to retval_dest.1
.
Sourcefn rwlock_is_locked(&self, id: RwLockId) -> bool
fn rwlock_is_locked(&self, id: RwLockId) -> bool
Check if locked.
Sourcefn rwlock_is_write_locked(&self, id: RwLockId) -> bool
fn rwlock_is_write_locked(&self, id: RwLockId) -> bool
Check if write locked.
Sourcefn rwlock_reader_lock(&mut self, id: RwLockId)
fn rwlock_reader_lock(&mut self, id: RwLockId)
Read-lock the lock by adding the reader
the list of threads that own
this lock.
Sourcefn rwlock_reader_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>
fn rwlock_reader_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>
Try read-unlock the lock for the current threads and potentially give the lock to a new owner.
Returns true
if succeeded, false
if this reader
did not hold the lock.
Sourcefn rwlock_enqueue_and_block_reader(
&mut self,
id: RwLockId,
retval: Scalar,
dest: MPlaceTy<'tcx>,
)
fn rwlock_enqueue_and_block_reader( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, )
Put the reader in the queue waiting for the lock and block it.
Once the lock becomes available, retval
will be written to dest
.
Sourcefn rwlock_writer_lock(&mut self, id: RwLockId)
fn rwlock_writer_lock(&mut self, id: RwLockId)
Lock by setting the writer that owns the lock.
Sourcefn rwlock_writer_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>
fn rwlock_writer_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>
Try to unlock an rwlock held by the current thread.
Return false
if it is held by another thread.
Sourcefn rwlock_enqueue_and_block_writer(
&mut self,
id: RwLockId,
retval: Scalar,
dest: MPlaceTy<'tcx>,
)
fn rwlock_enqueue_and_block_writer( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, )
Put the writer in the queue waiting for the lock.
Once the lock becomes available, retval
will be written to dest
.
Sourcefn condvar_is_awaited(&mut self, id: CondvarId) -> bool
fn condvar_is_awaited(&mut self, id: CondvarId) -> bool
Is the conditional variable awaited?
Sourcefn condvar_wait(
&mut self,
condvar: CondvarId,
mutex: MutexId,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
retval_succ: Scalar,
retval_timeout: Scalar,
dest: MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn condvar_wait( &mut self, condvar: CondvarId, mutex: MutexId, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Release the mutex and let the current thread wait on the given condition variable.
Once it is signaled, the mutex will be acquired and retval_succ
will be written to dest
.
If the timeout happens first, retval_timeout
will be written to dest
.
Sourcefn condvar_signal(&mut self, id: CondvarId) -> InterpResult<'tcx, bool>
fn condvar_signal(&mut self, id: CondvarId) -> InterpResult<'tcx, bool>
Wake up some thread (if there is any) sleeping on the conditional
variable. Returns true
iff any thread was woken up.
Sourcefn futex_wait(
&mut self,
futex_ref: FutexRef,
bitset: u32,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
retval_succ: Scalar,
retval_timeout: Scalar,
dest: MPlaceTy<'tcx>,
errno_timeout: IoError,
)
fn futex_wait( &mut self, futex_ref: FutexRef, bitset: u32, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, errno_timeout: IoError, )
Wait for the futex to be signaled, or a timeout.
On a signal, retval_succ
is written to dest
.
On a timeout, retval_timeout
is written to dest
and errno_timeout
is set as the last error.
Sourcefn futex_wake(
&mut self,
futex_ref: &FutexRef,
bitset: u32,
) -> InterpResult<'tcx, bool>
fn futex_wake( &mut self, futex_ref: &FutexRef, bitset: u32, ) -> InterpResult<'tcx, bool>
Wake up the first thread in the queue that matches any of the bits in the bitset. Returns whether anything was woken.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.