mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 13:40:15 +03:00
rename InterpretCx -> InterpCx
This commit is contained in:
+4
-4
@@ -8,7 +8,7 @@
|
||||
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);
|
||||
|
||||
+11
-11
@@ -105,8 +105,8 @@ pub(crate) fn new() -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 @@ fn find_fn(
|
||||
|
||||
#[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 @@ fn call_intrinsic(
|
||||
|
||||
#[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 @@ fn ptr_op(
|
||||
}
|
||||
|
||||
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 @@ fn find_foreign_static(
|
||||
}
|
||||
|
||||
#[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 @@ fn tag_static_base_pointer(
|
||||
|
||||
#[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 @@ fn retag(
|
||||
|
||||
#[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 @@ fn emulate_foreign_item(
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user