Trait rustc_mir::interpret::machine::Machine [−][src]
pub trait Machine<'mir, 'tcx>: Sized { type MemoryData; type MemoryKinds: Debug + PartialEq + Copy + Clone; fn eval_fn_call<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
destination: Option<(Place, BasicBlock)>,
args: &[ValTy<'tcx>],
span: Span,
sig: FnSig<'tcx>
) -> EvalResult<'tcx, bool>; fn call_intrinsic<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
args: &[ValTy<'tcx>],
dest: Place,
dest_layout: TyLayout<'tcx>,
target: BasicBlock
) -> EvalResult<'tcx>; fn try_ptr_op<'a>(
ecx: &EvalContext<'a, 'mir, 'tcx, Self>,
bin_op: BinOp,
left: Scalar,
left_ty: Ty<'tcx>,
right: Scalar,
right_ty: Ty<'tcx>
) -> EvalResult<'tcx, Option<(Scalar, bool)>>; fn mark_static_initialized<'a>(
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_mutability: Mutability
) -> EvalResult<'tcx, bool>; fn init_static<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
cid: GlobalId<'tcx>
) -> EvalResult<'tcx, AllocId>; fn box_alloc<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
ty: Ty<'tcx>,
dest: Place
) -> EvalResult<'tcx>; fn global_item_with_linkage<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
mutability: Mutability
) -> EvalResult<'tcx>; fn check_locks<'a>(
_mem: &Memory<'a, 'mir, 'tcx, Self>,
_ptr: Pointer,
_size: Size,
_access: AccessKind
) -> EvalResult<'tcx> { ... } fn add_lock<'a>(_mem: &mut Memory<'a, 'mir, 'tcx, Self>, _id: AllocId) { ... } fn free_lock<'a>(
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_len: u64
) -> EvalResult<'tcx> { ... } fn end_region<'a>(
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_reg: Option<Scope>
) -> EvalResult<'tcx> { ... } fn validation_op<'a>(
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_op: ValidationOp,
_operand: &ValidationOperand<'tcx, Place<'tcx>>
) -> EvalResult<'tcx> { ... } }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Methods of this trait signifies a point where CTFE evaluation would fail and some use case dependent behaviour can instead be applied
Associated Types
type MemoryData
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Additional data that can be accessed via the Memory
type MemoryKinds: Debug + PartialEq + Copy + Clone
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Additional memory kinds a machine wishes to distinguish from the builtin ones
Required Methods
fn eval_fn_call<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
destination: Option<(Place, BasicBlock)>,
args: &[ValTy<'tcx>],
span: Span,
sig: FnSig<'tcx>
) -> EvalResult<'tcx, bool>
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
destination: Option<(Place, BasicBlock)>,
args: &[ValTy<'tcx>],
span: Span,
sig: FnSig<'tcx>
) -> EvalResult<'tcx, bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Entry point to all function calls.
Returns Ok(true) when the function was handled completely e.g. due to missing mir
Returns Ok(false) if a new stack frame was pushed
fn call_intrinsic<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
args: &[ValTy<'tcx>],
dest: Place,
dest_layout: TyLayout<'tcx>,
target: BasicBlock
) -> EvalResult<'tcx>
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
args: &[ValTy<'tcx>],
dest: Place,
dest_layout: TyLayout<'tcx>,
target: BasicBlock
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
directly process an intrinsic without pushing a stack frame.
fn try_ptr_op<'a>(
ecx: &EvalContext<'a, 'mir, 'tcx, Self>,
bin_op: BinOp,
left: Scalar,
left_ty: Ty<'tcx>,
right: Scalar,
right_ty: Ty<'tcx>
) -> EvalResult<'tcx, Option<(Scalar, bool)>>
ecx: &EvalContext<'a, 'mir, 'tcx, Self>,
bin_op: BinOp,
left: Scalar,
left_ty: Ty<'tcx>,
right: Scalar,
right_ty: Ty<'tcx>
) -> EvalResult<'tcx, Option<(Scalar, bool)>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Called for all binary operations except on float types.
Returns None
if the operation should be handled by the integer
op code in order to share more code between machines
Returns a (value, overflowed) pair if the operation succeeded
fn mark_static_initialized<'a>(
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_mutability: Mutability
) -> EvalResult<'tcx, bool>
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_mutability: Mutability
) -> EvalResult<'tcx, bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Called when trying to mark machine defined MemoryKinds
as static
fn init_static<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
cid: GlobalId<'tcx>
) -> EvalResult<'tcx, AllocId>
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
cid: GlobalId<'tcx>
) -> EvalResult<'tcx, AllocId>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Called when requiring a pointer to a static. Non const eval can
create a mutable memory location for static mut
fn box_alloc<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
ty: Ty<'tcx>,
dest: Place
) -> EvalResult<'tcx>
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
ty: Ty<'tcx>,
dest: Place
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Heap allocations via the box
keyword
Returns a pointer to the allocated memory
fn global_item_with_linkage<'a>(
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
mutability: Mutability
) -> EvalResult<'tcx>
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
instance: Instance<'tcx>,
mutability: Mutability
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Called when trying to access a global declared with a linkage
attribute
Provided Methods
fn check_locks<'a>(
_mem: &Memory<'a, 'mir, 'tcx, Self>,
_ptr: Pointer,
_size: Size,
_access: AccessKind
) -> EvalResult<'tcx>
_mem: &Memory<'a, 'mir, 'tcx, Self>,
_ptr: Pointer,
_size: Size,
_access: AccessKind
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn add_lock<'a>(_mem: &mut Memory<'a, 'mir, 'tcx, Self>, _id: AllocId)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn free_lock<'a>(
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_len: u64
) -> EvalResult<'tcx>
_mem: &mut Memory<'a, 'mir, 'tcx, Self>,
_id: AllocId,
_len: u64
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn end_region<'a>(
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_reg: Option<Scope>
) -> EvalResult<'tcx>
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_reg: Option<Scope>
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn validation_op<'a>(
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_op: ValidationOp,
_operand: &ValidationOperand<'tcx, Place<'tcx>>
) -> EvalResult<'tcx>
_ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
_op: ValidationOp,
_operand: &ValidationOperand<'tcx, Place<'tcx>>
) -> EvalResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implementors
impl<'mir, 'tcx> Machine<'mir, 'tcx> for CompileTimeEvaluator type MemoryData = (); type MemoryKinds = !;