Struct Machine
pub struct Machine<M>where
M: Memory + Obj,{
prog: Program,
mem: ConcurrentMemory<M>,
intptrcast: IntPtrCast<<M as Memory>::Provenance>,
threads: List<Thread<M>>,
active_thread: Int,
synchronized_threads: Set<Int>,
locks: List<LockState>,
global_ptrs: Map<GlobalName, ThinPointer<<M as Memory>::Provenance>>,
fn_ptrs: Map<FnName, ThinPointer<<M as Memory>::Provenance>>,
vtable_ptrs: Map<VTableName, ThinPointer<<M as Memory>::Provenance>>,
stdout: DynWrite,
stderr: DynWrite,
}Expand description
This type contains everything that needs to be tracked during the execution of a MiniRust program.
Fields§
§prog: Program§mem: ConcurrentMemory<M>§intptrcast: IntPtrCast<<M as Memory>::Provenance>§threads: List<Thread<M>>§active_thread: Int§synchronized_threads: Set<Int>§locks: List<LockState>§global_ptrs: Map<GlobalName, ThinPointer<<M as Memory>::Provenance>>§fn_ptrs: Map<FnName, ThinPointer<<M as Memory>::Provenance>>§vtable_ptrs: Map<VTableName, ThinPointer<<M as Memory>::Provenance>>§stdout: DynWrite§stderr: DynWriteImplementations§
§impl<M> Machine<M>where
M: Memory + Obj,
impl<M> Machine<M>where
M: Memory + Obj,
pub fn new( prog: Program, mem_params: <M as Memory>::Params, stdout: DynWrite, stderr: DynWrite, ) -> NdResult<Machine<M>, TerminationInfo>
pub fn step(&mut self) -> NdResult<(), TerminationInfo>
pub fn step(&mut self) -> NdResult<(), TerminationInfo>
To run a MiniRust program, call this in a loop until it throws an Err (UB or termination).
pub fn lock_create(&mut self) -> Int
pub fn lock_acquire(&mut self, lock_id: Int) -> Result<(), TerminationInfo>
pub fn lock_release(&mut self, lock_id: Int) -> NdResult<(), TerminationInfo>
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Machine<M>
impl<M> !Send for Machine<M>
impl<M> !Sync for Machine<M>
impl<M> !UnwindSafe for Machine<M>
impl<M> Freeze for Machine<M>where
ConcurrentMemory<M>: Freeze,
IntPtrCast<<M as Memory>::Provenance>: Freeze,
List<Thread<M>>: Freeze,
Map<GlobalName, ThinPointer<<M as Memory>::Provenance>>: Freeze,
Map<FnName, ThinPointer<<M as Memory>::Provenance>>: Freeze,
Map<VTableName, ThinPointer<<M as Memory>::Provenance>>: Freeze,
impl<M> Unpin for Machine<M>where
ConcurrentMemory<M>: Unpin,
IntPtrCast<<M as Memory>::Provenance>: Unpin,
List<Thread<M>>: Unpin,
Map<GlobalName, ThinPointer<<M as Memory>::Provenance>>: Unpin,
Map<FnName, ThinPointer<<M as Memory>::Provenance>>: Unpin,
Map<VTableName, ThinPointer<<M as Memory>::Provenance>>: Unpin,
impl<M> UnsafeUnpin for Machine<M>where
ConcurrentMemory<M>: UnsafeUnpin,
IntPtrCast<<M as Memory>::Provenance>: UnsafeUnpin,
List<Thread<M>>: UnsafeUnpin,
Map<GlobalName, ThinPointer<<M as Memory>::Provenance>>: UnsafeUnpin,
Map<FnName, ThinPointer<<M as Memory>::Provenance>>: UnsafeUnpin,
Map<VTableName, ThinPointer<<M as Memory>::Provenance>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more