Struct miri::Evaluator

source ·
pub struct Evaluator<'mir, 'tcx> {
Show 34 fields pub stacked_borrows: Option<RefCell<GlobalStateInner>>, pub data_race: Option<GlobalState>, pub intptrcast: RefCell<GlobalStateInner>, pub(crate) env_vars: EnvVars<'tcx>, pub(crate) argc: Option<MemPlace<Provenance>>, pub(crate) argv: Option<MemPlace<Provenance>>, pub(crate) cmd_line: Option<MemPlace<Provenance>>, pub(crate) tls: TlsData<'tcx>, pub(crate) isolated_op: IsolatedOp, pub(crate) validate: bool, pub(crate) enforce_abi: bool, pub(crate) file_handler: FileHandler, pub(crate) dir_handler: DirHandler, pub(crate) time_anchor: Instant, pub(crate) threads: ThreadManager<'mir, 'tcx>, pub(crate) layouts: PrimitiveLayouts<'tcx>, pub(crate) static_roots: Vec<AllocId>, profiler: Option<Profiler>, string_cache: FxHashMap<String, StringId>, pub(crate) exported_symbols_cache: FxHashMap<Symbol, Option<Instance<'tcx>>>, pub(crate) panic_on_unsupported: bool, pub(crate) backtrace_style: BacktraceStyle, pub(crate) local_crates: Vec<CrateNum>, extern_statics: FxHashMap<Symbol, Pointer<Provenance>>, pub(crate) rng: RefCell<StdRng>, tracked_alloc_ids: FxHashSet<AllocId>, pub(crate) check_alignment: AlignmentCheck, pub(crate) cmpxchg_weak_failure_rate: f64, pub(crate) mute_stdout_stderr: bool, pub(crate) weak_memory: bool, pub(crate) preemption_rate: f64, pub(crate) report_progress: Option<u32>, pub(crate) basic_block_count: u64, pub external_so_lib: Option<(Library, PathBuf)>,
}
Expand description

The machine itself.

Fields

stacked_borrows: Option<RefCell<GlobalStateInner>>data_race: Option<GlobalState>intptrcast: RefCell<GlobalStateInner>env_vars: EnvVars<'tcx>

Environment variables set by setenv. Miri does not expose env vars from the host to the emulated program.

argc: Option<MemPlace<Provenance>>

Program arguments (Option because we can only initialize them after creating the ecx). These are pointers to argc/argv because macOS. We also need the full command line as one string because of Windows.

argv: Option<MemPlace<Provenance>>cmd_line: Option<MemPlace<Provenance>>tls: TlsData<'tcx>

TLS state.

isolated_op: IsolatedOp

What should Miri do when an op requires communicating with the host, such as accessing host env vars, random number generation, and file system access.

validate: bool

Whether to enforce the validity invariant.

enforce_abi: bool

Whether to enforce ABI of function calls.

file_handler: FileHandler

The table of file descriptors.

dir_handler: DirHandler

The table of directory descriptors.

time_anchor: Instant

The “time anchor” for this machine’s monotone clock (for Instant simulation).

threads: ThreadManager<'mir, 'tcx>

The set of threads.

layouts: PrimitiveLayouts<'tcx>

Precomputed TyLayouts for primitive data types that are commonly used inside Miri.

static_roots: Vec<AllocId>

Allocations that are considered roots of static memory (that may leak).

profiler: Option<Profiler>

The measureme profiler used to record timing information about the emulated program.

string_cache: FxHashMap<String, StringId>

Used with profiler to cache the StringIds for event names uesd with measureme.

exported_symbols_cache: FxHashMap<Symbol, Option<Instance<'tcx>>>

Cache of Instance exported under the given Symbol name. None means no Instance exported under the given name is found.

panic_on_unsupported: bool

Whether to raise a panic in the context of the evaluated process when unsupported functionality is encountered. If false, an error is propagated in the Miri application context instead (default behavior)

backtrace_style: BacktraceStyle

Equivalent setting as RUST_BACKTRACE on encountering an error.

local_crates: Vec<CrateNum>

Crates which are considered local for the purposes of error reporting.

extern_statics: FxHashMap<Symbol, Pointer<Provenance>>

Mapping extern static names to their base pointer.

rng: RefCell<StdRng>

The random number generator used for resolving non-determinism. Needs to be queried by ptr_to_int, hence needs interior mutability.

tracked_alloc_ids: FxHashSet<AllocId>

The allocation IDs to report when they are being allocated (helps for debugging memory leaks and use after free bugs).

check_alignment: AlignmentCheck

Controls whether alignment of memory accesses is being checked.

cmpxchg_weak_failure_rate: f64

Failure rate of compare_exchange_weak, between 0.0 and 1.0

mute_stdout_stderr: bool

Corresponds to -Zmiri-mute-stdout-stderr and doesn’t write the output but acts as if it succeeded.

weak_memory: bool

Whether weak memory emulation is enabled

preemption_rate: f64

The probability of the active thread being preempted at the end of each basic block.

report_progress: Option<u32>

If Some, we will report the current stack every N basic blocks.

basic_block_count: u64external_so_lib: Option<(Library, PathBuf)>

Handle of the optional shared object file for external functions.

Implementations

Sets up the “extern statics” for this machine.

Check whether the stack frame that this FrameInfo refers to is part of a local crate.

Trait Implementations

Machine hook implementations.

Convert a pointer with provenance into an allocation-offset pair, or a None with an absolute address if that conversion is not possible.

Additional memory kinds a machine wishes to distinguish from the builtin ones
Machines can define extra (non-instance) things that represent values of function pointers. For example, Miri uses this to return a function pointer from dlsym that can later be called to execute the right thing. Read more
Extra data stored in every call frame.
Extra data stored in every allocation.
Pointers are “tagged” with provenance information; typically the AllocId they belong to.
When getting the AllocId of a pointer, some extra data is also obtained from the provenance that is passed to memory access hooks so they can do things with it. Read more
Memory’s allocation map
The memory kind to use for copied global memory (held in tcx) – or None if such memory should not be mutated and thus any such attempt will cause a ModifiedStatic error to be raised. Statics are copied under two circumstances: When they are mutated, and when adjust_allocation (see below) returns an owned allocation that is added to the memory so that the work is not done twice. Read more
Should the machine panic on allocation failures?
Whether memory accesses should be alignment-checked.
Whether, when checking alignment, we should look at the actual address and thus support custom alignment logic based on whatever the integer address happens to be. Read more
Whether to enforce the validity invariant
Whether function calls should be ABI-checked.
Whether CheckedBinOp MIR statements should actually check for overflow.
Entry point to all function calls. Read more
Execute fn_val. It is the hook’s responsibility to advance the instruction pointer as appropriate. Read more
Directly process an intrinsic without pushing a stack frame. It is the hook’s responsibility to advance the instruction pointer as appropriate. Read more
Called to evaluate Assert MIR terminators that trigger a panic.
Called to evaluate Abort MIR terminator.
Called for all binary operations where the LHS has pointer type. Read more
Return the AllocId for the given thread-local static in the current thread.
Return the root pointer for the given extern static.
Called to adjust allocations to the Provenance and AllocExtra of this machine. Read more
Return a “base” pointer for the given allocation: the one that is used for direct accesses to this static/const/fn allocation, or the one returned from the heap allocator. Read more
“Int-to-pointer cast”
Marks a pointer as exposed, allowing it’s provenance to be recovered. “Pointer-to-int cast” Read more
Hook for performing extra checks on a memory read access. Read more
Hook for performing extra checks on a memory write access.
Hook for performing extra operations on a memory deallocation.
Executes a retagging operation.
Called immediately before a new stack frame gets pushed.
Borrow the current thread’s stack.
Mutably borrow the current thread’s stack.
Called before a basic block terminator is executed. You can use this to detect endlessly running programs. Read more
Called immediately after a stack frame got pushed and its locals got initialized.
Called immediately after a stack frame got popped, but before jumping back to the caller. The locals have already been destroyed! Read more
Entry point for obtaining the MIR of anything that should get evaluated. So not just functions and shims, but also const/static initializers, anonymous constants, … Read more
Called to write the specified local from the frame. Since writing a ZST is not actually accessing memory or locals, this is never invoked for ZST reads. Read more
Called before a global allocation is accessed. def_id is Some if this is the “lazy” allocation of a static. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 2112 bytes