pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>;
Expand description

A rustc InterpCx for Miri.

Trait Implementations

Evaluation context extensions.

Atomic variant of read_scalar_at_offset.
Atomic variant of write_scalar_at_offset.
Perform an atomic read operation at the memory location.
Perform an atomic write operation at the memory location.
Perform an atomic operation on a memory location.
Perform an atomic exchange with a memory place and a new scalar value, the old value is returned. Read more
Perform an conditional atomic exchange with a memory place and a new scalar value, the old value is returned. Read more
Perform an atomic compare and exchange at a given memory location. On success an atomic RMW operation is performed and on failure only an atomic read occurs. If can_fail_spuriously is true, then we treat it as a “compare_exchange_weak” operation, and some portion of the time fail even when the values are actually identical. Read more
Update the data-race detector for an atomic fence on the current thread.
After all threads are done running, this allows data races to occur for subsequent ‘administrative’ machine accesses (that logically happen outside of the Abstract Machine). Read more
Create state for a new mutex.
Provides the closure with the next MutexId. Creates that mutex if the closure returns None, otherwise returns the value from the closure Read more
Get the id of the thread that currently owns this lock.
Check if locked.
Lock by setting the mutex owner and increasing the lock count.
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 expected_owner, return None. Read more
Put the thread into the queue waiting for the mutex.
Create state for a new read write lock.
Provides the closure with the next RwLockId. Creates that RwLock if the closure returns None, otherwise returns the value from the closure Read more
Check if locked.
Check if write locked.
Read-lock the lock by adding the reader the list of threads that own this lock. Read more
Try read-unlock the lock for reader and potentially give the lock to a new owner. Returns true if succeeded, false if this reader did not hold the lock. Read more
Put the reader in the queue waiting for the lock and block it.
Lock by setting the writer that owns the lock.
Try to unlock by removing the writer.
Put the writer in the queue waiting for the lock.
Create state for a new conditional variable.
Provides the closure with the next CondvarId. Creates that Condvar if the closure returns None, otherwise returns the value from the closure Read more
Is the conditional variable awaited?
Mark that the thread is waiting on the conditional variable.
Wake up some thread (if there is any) sleeping on the conditional variable. Read more
Remove the thread from the queue of threads waiting on this conditional variable.
Calls the simd intrinsic intrinsic; the simd_ prefix has already been removed.
Emulates a Miri-supported intrinsic (not supported by the core engine).
Get a thread-specific allocation id for the given thread-local static. If needed, allocate a new one. Read more
Execute a timeout callback on the callback’s thread.
Decide which action to take next and on which thread.
Handles thread termination of the active thread: wakes up threads joining on this one, and deallocated thread-local statics. Read more
Caller should never need to consult the store buffer for the latest value. This function is used exclusively for failed atomic_compare_exchange_scalar to perform load_impl on the latest store element Read more
Updates the environ static. The first time it gets called, also initializes extra.environ. Read more
Helper function to read an OsString from a null-terminated sequence of bytes, which is what the Unix APIs usually handle. Read more
Helper function to read an OsString from a 0x0000-terminated sequence of u16, which is what the Windows APIs usually handle. Read more
Helper function to write an OsStr as a null-terminated sequence of bytes, which is what the Unix APIs usually handle. This function returns Ok((false, length)) without trying to write if size is not large enough to fit the contents of os_string plus a null terminator. It returns Ok((true, length)) if the writing process was successful. The string length returned does include the null terminator. Read more
Helper function to write an OsStr as a 0x0000-terminated u16-sequence, which is what the Windows APIs usually handle. This function returns Ok((false, length)) without trying to write if size is not large enough to fit the contents of os_string plus a null terminator. It returns Ok((true, length)) if the writing process was successful. The string length returned does include the null terminator. Length is measured in units of u16. Read more
Allocate enough memory to store the given OsStr as a null-terminated sequence of bytes.
Allocate enough memory to store the given OsStr as a null-terminated sequence of u16.
Read a null-terminated sequence of bytes, and perform path separator conversion if needed.
Read a null-terminated sequence of u16s, and perform path separator conversion if needed.
Write a Path to the machine memory (as a null-terminated sequence of bytes), adjusting path separators if needed. Read more
Write a Path to the machine memory (as a null-terminated sequence of u16s), adjusting path separators if needed. Read more
Allocate enough memory to store a Path as a null-terminated sequence of bytes, adjusting path separators if needed. Read more
Handles the special miri_start_panic intrinsic, which is called by libpanic_unwind to delegate the actual unwinding process to Miri. Read more
Handles the try intrinsic, the underlying implementation of std::panicking::try.
Start a panic in the interpreter with the given message as payload.
Schedule an active thread’s TLS destructor to run on the active thread. Note that this function does not run the destructors itself, it just schedules them one by one each time it is called and reenables the thread so that it can be executed normally by the main execution loop. Read more
Returns true if the computation was performed, and false if we should just evaluate the actual MIR of align_offset. Read more
After a stack frame got pushed, retag the return place so that we are sure it does not alias with anything. Read more
Mark the given tag as exposed. It was found on a pointer with the given AllocId.
Emit all diagnostics that were registed with register_diagnostics
We had a panic in Miri itself, try to print something useful.
Gets an instance for a path; fails gracefully if the path does not exist.
Gets an instance for a path.
Evaluates the scalar at the specified path. Returns Some(val) if the path could be resolved, and None otherwise Read more
Helper function to get a libc constant as a Scalar.
Helper function to get a libc constant as an i32.
Helper function to get a windows constant as a Scalar.
Helper function to get a windows constant as a u64.
Helper function to get the TyAndLayout of a libc type
Helper function to get the TyAndLayout of a windows type
Project to the given named field of the mplace (which must be a struct or union type).
Write an int of the appropriate size to dest. The target type may be signed or unsigned, we try to do the right thing anyway. i128 can fit all integer types except for u128 so this method is fine for almost all integer types. Read more
Write the first N fields of the given place.
Write the given fields of the given place.
Write a 0 of the appropriate size to dest.
Test if this pointer equals 0.
Get the Place for a local
Generate some random bytes, and write them to dest.
Call a function: Push the stack frame and pass the arguments. For now, arguments must be scalars (so that the caller does not have to know the layout). Read more
Visits the memory covered by place, sensitive to freezing: the 2nd parameter of action will be true if this is frozen, false if this is in an UnsafeCell. The range is relative to place. Read more
Helper function used inside the shims of foreign functions to check that isolation is disabled. It returns an error using the name of the foreign function if this is not the case. Read more
Helper function used inside the shims of foreign functions which reject the op when isolation is enabled. It is used to print a warning/backtrace about the rejection. Read more
Helper function used inside the shims of foreign functions to assert that the target OS is target_os. It panics showing a message with the name of the foreign function if this is not the case. Read more
Helper function used inside the shims of foreign functions to assert that the target OS is part of the UNIX family. It panics showing a message with the name of the foreign function if this is not the case. Read more
Get last error variable as a place, lazily allocating thread-local storage for it if necessary. Read more
Sets the last error variable.
Gets the last error variable.
This function tries to produce the most similar OS error from the std::io::ErrorKind as a platform-specific errnum. Read more
The inverse of io_error_to_errnum.
Sets the last OS error using a std::io::ErrorKind.
Helper function that consumes an std::io::Result<T> and returns an InterpResult<'tcx,T>::Ok instead. In case the result is an error, this function returns Ok(-1) and sets the last OS error accordingly. Read more
Calculates the MPlaceTy given the offset and layout of an access on an operand
Parse a timespec struct and return it as a std::time::Duration. It returns None if the value in the timespec struct is invalid. Some libc functions will return EINVAL in this case. Read more
Check that the ABI is what we expect.
Handler that should be called when unsupported functionality is encountered. This function will either panic within the context of the emulated application or return an error in the Miri process context Read more
Mark a machine allocation that was just created as immutable.
Extract the scalar value from the result of reading a scalar from the machine, and convert it to a CArg. Read more
Call external C function and store output, depending on return type in the function signature. Read more
Get the pointer to the function of the specified name in the shared object file, if it exists. The function must be in the shared object file specified: we do not return pointers to functions in dependencies of the library. Read more
Call specified external C function, with supplied arguments. Need to convert all the arguments from their hir representations to a form compatible with C (through libffi call). Then, convert return from the C call into a corresponding form that can be stored in Miri internal memory. Read more
Returns the minimum alignment for the target architecture for allocations of the given size.
Lookup the body of a function that has link_name as the symbol name.
Emulates calling a foreign item, failing if the item is not supported. This function will handle goto_block if needed. Returns Ok(None) if the foreign item was completely handled by this function. Returns Ok(Some(body)) if processing the foreign item is delegated to another function. Read more
Emulates calling the internal _rust* allocator functions
Emulates calling a foreign item using its name.
Check some basic requirements for this allocation request: non-zero size, power-of-two alignment. Read more
Calls the atomic intrinsic intrinsic; the atomic_ prefix has already been removed.
Take a reader out of the queue waiting for the lock. Returns true if some thread got the rwlock. Read more
Take the writer out of the queue waiting for the lock. Returns true if some thread got the rwlock. Read more
Take a thread out of the queue waiting for the mutex, and lock the mutex for it. Returns true if some thread has the mutex now. Read more
Function used when a handle is not found inside FileHandler. It returns Ok(-1)and sets the last OS error to libc::EBADF (invalid file descriptor). This function uses T: From<i32> instead of i32 directly because some fs functions return different integer types (like read, that returns an i64). Read more

Retagging/reborrowing. There is some policy in here, such as which permissions to grant for which references, and when to add protectors.

Returns the AllocId the reborrow was done in, if some actual borrow stack manipulation happened. Read more
Retags an indidual pointer, returning the retagged version. mutbl can be None to make this a raw pointer. Read more
Temporarily allow data-races to occur. This should only be used in one of these cases: Read more
Same as allow_data_races_ref, this temporarily disables any data-race detection and so should only be used for atomic operations or internal state that the program cannot access. Read more
Checks that an atomic access is legal at the given place.
Update the data-race detector for an atomic read occurring at the associated memory-place and on the current thread. Read more
Update the data-race detector for an atomic write occurring at the associated memory-place and on the current thread. Read more
Update the data-race detector for an atomic read-modify-write occurring at the associated memory place and on the current thread. Read more
Generic atomic operation implementation
Schedule TLS destructors for Windows. On windows, TLS destructors are managed by std. Read more
Schedule the MacOS thread destructor of the thread local storage to be executed. Returns true if scheduled. Read more
Schedule a pthread TLS destructor. Returns true if found a destructor to schedule, and false otherwise. Read more

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: 2256 bytes