Struct rustc_const_eval::const_eval::machine::CompileTimeInterpreter[][src]

pub struct CompileTimeInterpreter<'mir, 'tcx> {
    pub steps_remaining: usize,
    pub(crate) stack: Vec<Frame<'mir, 'tcx, AllocId, ()>>,
}
Expand description

Extra machine state for CTFE, and the Machine instance

Fields

steps_remaining: usize

For now, the number of terminators that can be evaluated before we throw a resource exhaustion error.

Setting this to 0 disables the limit and allows the interpreter to run forever.

stack: Vec<Frame<'mir, 'tcx, AllocId, ()>>

The virtual call stack.

Implementations

Trait Implementations

Pointers are “tagged” with provenance information; typically the AllocId they belong to.

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

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 tag_allocation (see below) returns an owned allocation that is added to the memory so that the work is not done twice. Read more

Extra data stored in every allocation.

Extra data stored in every call frame.

Whether memory accesses should be alignment-checked.

Whether, when checking alignment, we should force_int and thus support custom alignment logic based on whatever the integer address happens to be. Read more

Whether to enforce the validity invariant

Execute fn_val. It is the hook’s responsibility to advance the instruction pointer as appropriate. Read more

Called to initialize the “extra” state of an allocation and make the pointers it contains (in relocations) tagged. The way we construct allocations is to always first construct it without extra and then add the extra. This keeps uniform code paths for handling both allocations created by CTFE for globals, and allocations created by Miri during evaluation. Read more

Return the root pointer for the given extern static.

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”

Convert a pointer with provenance into an allocation-offset pair.

Additional memory kinds a machine wishes to distinguish from the builtin ones

Extra data stored in memory. A reference to this is available when AllocExtra gets initialized, so you can e.g., have an Rc here if there is global state you need access to in the AllocExtra hooks. Read more

Should the machine panic on allocation failures?

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

Entry point to all function calls. 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

Heap allocations via the box keyword.

Called before a basic block terminator is executed. You can use this to detect endlessly running programs. Read more

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 global allocation is accessed. def_id is Some if this is the “lazy” allocation of a static. Read more

Whether function calls should be ABI-checked.

Called to read the specified local from the frame. Since reading a ZST is not actually accessing memory or locals, this is never invoked for ZST reads. 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

Return the AllocId for the given thread-local static in the current thread.

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 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.

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

Performs the conversion.

Performs the conversion.

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