rename GlobalEvalContext to EvalContext

This commit is contained in:
Oliver Schneider
2016-06-10 16:20:17 +02:00
parent b3c1713b89
commit 6af821f202
4 changed files with 12 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ extern crate syntax;
#[macro_use] extern crate log; #[macro_use] extern crate log;
use miri::{ use miri::{
GlobalEvalContext, EvalContext,
CachedMir, CachedMir,
step, step,
EvalError, EvalError,
@@ -59,7 +59,7 @@ fn interpret_start_points<'a, 'tcx>(
debug!("Interpreting: {}", item.name); debug!("Interpreting: {}", item.name);
let mut gecx = GlobalEvalContext::new(tcx, mir_map); let mut gecx = EvalContext::new(tcx, mir_map);
let substs = tcx.mk_substs(subst::Substs::empty()); let substs = tcx.mk_substs(subst::Substs::empty());
let return_ptr = gecx.alloc_ret_ptr(mir.return_ty, substs); let return_ptr = gecx.alloc_ret_ptr(mir.return_ty, substs);
@@ -86,7 +86,7 @@ fn interpret_start_points<'a, 'tcx>(
} }
} }
fn report(tcx: TyCtxt, gecx: &GlobalEvalContext, e: EvalError) { fn report(tcx: TyCtxt, gecx: &EvalContext, e: EvalError) {
let frame = gecx.stack().last().expect("stackframe was empty"); let frame = gecx.stack().last().expect("stackframe was empty");
let block = frame.mir.basic_block_data(frame.next_block); let block = frame.mir.basic_block_data(frame.next_block);
let span = if frame.stmt < block.statements.len() { let span = if frame.stmt < block.statements.len() {

View File

@@ -24,11 +24,11 @@ use std::collections::HashMap;
mod stepper; mod stepper;
pub fn step<'fncx, 'a: 'fncx, 'tcx: 'a>(gecx: &'fncx mut GlobalEvalContext<'a, 'tcx>) -> EvalResult<bool> { pub fn step<'fncx, 'a: 'fncx, 'tcx: 'a>(gecx: &'fncx mut EvalContext<'a, 'tcx>) -> EvalResult<bool> {
stepper::Stepper::new(gecx).step() stepper::Stepper::new(gecx).step()
} }
pub struct GlobalEvalContext<'a, 'tcx: 'a> { pub struct EvalContext<'a, 'tcx: 'a> {
/// The results of the type checker, from rustc. /// The results of the type checker, from rustc.
tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -123,9 +123,9 @@ enum ConstantKind {
Global, Global,
} }
impl<'a, 'tcx> GlobalEvalContext<'a, 'tcx> { impl<'a, 'tcx> EvalContext<'a, 'tcx> {
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir_map: &'a MirMap<'tcx>) -> Self { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir_map: &'a MirMap<'tcx>) -> Self {
GlobalEvalContext { EvalContext {
tcx: tcx, tcx: tcx,
mir_map: mir_map, mir_map: mir_map,
mir_cache: RefCell::new(DefIdMap()), mir_cache: RefCell::new(DefIdMap()),

View File

@@ -1,7 +1,7 @@
use super::{ use super::{
CachedMir, CachedMir,
ConstantId, ConstantId,
GlobalEvalContext, EvalContext,
ConstantKind, ConstantKind,
}; };
use error::EvalResult; use error::EvalResult;
@@ -13,11 +13,11 @@ use syntax::codemap::Span;
use std::rc::Rc; use std::rc::Rc;
pub(super) struct Stepper<'fncx, 'a: 'fncx, 'tcx: 'a>{ pub(super) struct Stepper<'fncx, 'a: 'fncx, 'tcx: 'a>{
gecx: &'fncx mut GlobalEvalContext<'a, 'tcx>, gecx: &'fncx mut EvalContext<'a, 'tcx>,
} }
impl<'fncx, 'a, 'tcx> Stepper<'fncx, 'a, 'tcx> { impl<'fncx, 'a, 'tcx> Stepper<'fncx, 'a, 'tcx> {
pub(super) fn new(gecx: &'fncx mut GlobalEvalContext<'a, 'tcx>) -> Self { pub(super) fn new(gecx: &'fncx mut EvalContext<'a, 'tcx>) -> Self {
Stepper { Stepper {
gecx: gecx, gecx: gecx,
} }
@@ -98,7 +98,7 @@ impl<'fncx, 'a, 'tcx> Stepper<'fncx, 'a, 'tcx> {
// The reason for this is, that `push_stack_frame` modifies the stack out of obvious reasons // The reason for this is, that `push_stack_frame` modifies the stack out of obvious reasons
struct ConstantExtractor<'a, 'b: 'a, 'tcx: 'b> { struct ConstantExtractor<'a, 'b: 'a, 'tcx: 'b> {
span: Span, span: Span,
gecx: &'a mut GlobalEvalContext<'b, 'tcx>, gecx: &'a mut EvalContext<'b, 'tcx>,
mir: &'a mir::Mir<'tcx>, mir: &'a mir::Mir<'tcx>,
def_id: DefId, def_id: DefId,
substs: &'tcx subst::Substs<'tcx>, substs: &'tcx subst::Substs<'tcx>,

View File

@@ -30,7 +30,7 @@ pub use error::{
}; };
pub use interpreter::{ pub use interpreter::{
GlobalEvalContext, EvalContext,
step, step,
Frame, Frame,
CachedMir, CachedMir,