Skip to content

Commit

Permalink
Merge pull request #40 from oli-obk/miri_upstream
Browse files Browse the repository at this point in the history
things priroda needs to be public or changed
  • Loading branch information
solson authored Jun 30, 2016
2 parents d309ab7 + b91338b commit 339e703
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}
}

pub fn memory(&self) -> &Memory {
pub fn memory(&self) -> &Memory<'a, 'tcx> {
&self.memory
}

pub fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx> {
&mut self.memory
}

pub fn stack(&self) -> &[Frame] {
pub fn stack(&self) -> &[Frame<'a, 'tcx>] {
&self.stack
}

Expand Down Expand Up @@ -235,7 +235,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
ty.is_sized(self.tcx, &self.tcx.empty_parameter_environment(), DUMMY_SP)
}

fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
pub fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
match self.tcx.map.as_local_node_id(def_id) {
Some(node_id) => CachedMir::Ref(self.mir_map.map.get(&node_id).unwrap()),
None => {
Expand All @@ -255,7 +255,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}
}

fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
pub fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
let substituted = ty.subst(self.tcx, substs);
self.tcx.normalize_associated_type(&substituted)
}
Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ pub use interpreter::{
eval_main,
};

pub use memory::Memory;
pub use memory::{
Memory,
Pointer,
AllocId,
};
8 changes: 6 additions & 2 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use primval::PrimVal;
////////////////////////////////////////////////////////////////////////////////

#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct AllocId(u64);
pub struct AllocId(pub u64);

impl fmt::Display for AllocId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -77,6 +77,10 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
}
}

pub fn allocations<'b>(&'b self) -> ::std::collections::hash_map::Iter<'b, AllocId, Allocation> {
self.alloc_map.iter()
}

pub fn create_fn_ptr(&mut self, def_id: DefId, substs: &'tcx Substs<'tcx>, fn_ty: &'tcx BareFnTy<'tcx>) -> Pointer {
let def = FunctionDefinition {
def_id: def_id,
Expand Down Expand Up @@ -576,7 +580,7 @@ impl UndefMask {
}

/// Check whether the range `start..end` (end-exclusive) is entirely defined.
fn is_range_defined(&self, start: usize, end: usize) -> bool {
pub fn is_range_defined(&self, start: usize, end: usize) -> bool {
if end > self.len { return false; }
for i in start..end {
if !self.get(i) { return false; }
Expand Down

0 comments on commit 339e703

Please sign in to comment.