rename InterpretCx -> InterpCx
This commit is contained in:
parent
f23b782101
commit
1729965808
3 changed files with 16 additions and 16 deletions
|
|
@ -8,7 +8,7 @@ use rustc::hir::def_id::DefId;
|
|||
use rustc::mir;
|
||||
|
||||
use crate::{
|
||||
InterpResult, InterpError, InterpretCx, StackPopCleanup, struct_error,
|
||||
InterpResult, InterpError, InterpCx, StackPopCleanup, struct_error,
|
||||
Scalar, Tag, Pointer,
|
||||
MemoryExtra, MiriMemoryKind, Evaluator, TlsEvalContextExt,
|
||||
};
|
||||
|
|
@ -28,8 +28,8 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
main_id: DefId,
|
||||
config: MiriConfig,
|
||||
) -> InterpResult<'tcx, InterpretCx<'mir, 'tcx, Evaluator<'tcx>>> {
|
||||
let mut ecx = InterpretCx::new(
|
||||
) -> InterpResult<'tcx, InterpCx<'mir, 'tcx, Evaluator<'tcx>>> {
|
||||
let mut ecx = InterpCx::new(
|
||||
tcx.at(syntax::source_map::DUMMY_SP),
|
||||
ty::ParamEnv::reveal_all(),
|
||||
Evaluator::new(),
|
||||
|
|
@ -43,7 +43,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
|||
config.validate
|
||||
};
|
||||
|
||||
// FIXME: InterpretCx::new should take an initial MemoryExtra
|
||||
// FIXME: InterpCx::new should take an initial MemoryExtra
|
||||
ecx.memory_mut().extra = MemoryExtra::new(config.seed.map(StdRng::seed_from_u64), validate);
|
||||
|
||||
let main_instance = ty::Instance::mono(ecx.tcx.tcx, main_id);
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ impl<'tcx> Evaluator<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A rustc InterpretCx for Miri.
|
||||
pub type MiriEvalContext<'mir, 'tcx> = InterpretCx<'mir, 'tcx, Evaluator<'tcx>>;
|
||||
/// A rustc InterpCx for Miri.
|
||||
pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'tcx>>;
|
||||
|
||||
/// A little trait that's useful to be inherited by extension traits.
|
||||
pub trait MiriEvalContextExt<'mir, 'tcx> {
|
||||
|
|
@ -138,14 +138,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
const STATIC_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::Static);
|
||||
|
||||
#[inline(always)]
|
||||
fn enforce_validity(ecx: &InterpretCx<'mir, 'tcx, Self>) -> bool {
|
||||
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
|
||||
ecx.memory().extra.validate
|
||||
}
|
||||
|
||||
/// Returns `Ok()` when the function was handled; fail otherwise.
|
||||
#[inline(always)]
|
||||
fn find_fn(
|
||||
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
instance: ty::Instance<'tcx>,
|
||||
args: &[OpTy<'tcx, Tag>],
|
||||
dest: Option<PlaceTy<'tcx, Tag>>,
|
||||
|
|
@ -156,7 +156,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
|
||||
#[inline(always)]
|
||||
fn call_intrinsic(
|
||||
ecx: &mut rustc_mir::interpret::InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut rustc_mir::interpret::InterpCx<'mir, 'tcx, Self>,
|
||||
instance: ty::Instance<'tcx>,
|
||||
args: &[OpTy<'tcx, Tag>],
|
||||
dest: PlaceTy<'tcx, Tag>,
|
||||
|
|
@ -166,7 +166,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
|
||||
#[inline(always)]
|
||||
fn ptr_op(
|
||||
ecx: &rustc_mir::interpret::InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &rustc_mir::interpret::InterpCx<'mir, 'tcx, Self>,
|
||||
bin_op: mir::BinOp,
|
||||
left: ImmTy<'tcx, Tag>,
|
||||
right: ImmTy<'tcx, Tag>,
|
||||
|
|
@ -175,7 +175,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
}
|
||||
|
||||
fn box_alloc(
|
||||
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
dest: PlaceTy<'tcx, Tag>,
|
||||
) -> InterpResult<'tcx> {
|
||||
trace!("box_alloc for {:?}", dest.layout.ty);
|
||||
|
|
@ -241,7 +241,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn before_terminator(_ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx>
|
||||
fn before_terminator(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx>
|
||||
{
|
||||
// We are not interested in detecting loops.
|
||||
Ok(())
|
||||
|
|
@ -311,7 +311,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
|
||||
#[inline(always)]
|
||||
fn retag(
|
||||
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
kind: mir::RetagKind,
|
||||
place: PlaceTy<'tcx, Tag>,
|
||||
) -> InterpResult<'tcx> {
|
||||
|
|
@ -325,14 +325,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
|||
|
||||
#[inline(always)]
|
||||
fn stack_push(
|
||||
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
) -> InterpResult<'tcx, stacked_borrows::CallId> {
|
||||
Ok(ecx.memory().extra.stacked_borrows.borrow_mut().new_call())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn stack_pop(
|
||||
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
extra: stacked_borrows::CallId,
|
||||
) -> InterpResult<'tcx> {
|
||||
Ok(ecx.memory().extra.stacked_borrows.borrow_mut().end_call(extra))
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||
trace!("__rust_maybe_catch_panic: {:?}", f_instance);
|
||||
|
||||
// Now we make a function call.
|
||||
// TODO: consider making this reusable? `InterpretCx::step` does something similar
|
||||
// TODO: consider making this reusable? `InterpCx::step` does something similar
|
||||
// for the TLS destructors, and of course `eval_main`.
|
||||
let mir = this.load_mir(f_instance.def)?;
|
||||
let ret_place = MPlaceTy::dangling(this.layout_of(this.tcx.mk_unit())?, this).into();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue