1
Fork 0

Rename AbstractPtr to Ptr.

This commit is contained in:
Scott Olson 2016-09-21 23:23:50 -06:00
parent 840594115d
commit 5b012edc7a
5 changed files with 13 additions and 13 deletions

View file

@ -28,7 +28,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
U64(u) |
IntegerPtr(u) => self.cast_const_int(u, ty, false),
FnPtr(ptr) |
AbstractPtr(ptr) => self.cast_ptr(ptr, ty),
Ptr(ptr) => self.cast_ptr(ptr, ty),
}
}
@ -36,7 +36,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
use primval::PrimVal::*;
match ty.sty {
ty::TyRef(..) |
ty::TyRawPtr(_) => Ok(AbstractPtr(ptr)),
ty::TyRawPtr(_) => Ok(Ptr(ptr)),
ty::TyFnPtr(_) => Ok(FnPtr(ptr)),
_ => Err(EvalError::Unimplemented(format!("ptr to {:?} cast", ty))),
}

View file

@ -246,7 +246,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
self.memory.write_bytes(ptr, s.as_bytes())?;
self.memory.freeze(ptr.alloc_id)?;
Value::ByValPair(
PrimVal::AbstractPtr(ptr),
PrimVal::Ptr(ptr),
self.target_usize_primval(s.len() as u64)
)
}
@ -255,7 +255,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
let ptr = self.memory.allocate(bs.len(), 1)?;
self.memory.write_bytes(ptr, bs)?;
self.memory.freeze(ptr.alloc_id)?;
Value::ByVal(PrimVal::AbstractPtr(ptr))
Value::ByVal(PrimVal::Ptr(ptr))
}
Struct(_) => unimplemented!(),
@ -1050,7 +1050,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
&ty::TyRawPtr(ty::TypeAndMut { ty, .. }) => {
if self.type_is_sized(ty) {
match self.memory.read_ptr(ptr) {
Ok(p) => PrimVal::AbstractPtr(p),
Ok(p) => PrimVal::Ptr(p),
Err(EvalError::ReadBytesAsPointer) => {
PrimVal::IntegerPtr(self.memory.read_usize(ptr)?)
}

View file

@ -420,7 +420,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
// FIXME: this is a memory leak, should probably add the pointer to the
// current stack.
let first = self.value_to_ptr(args[0].0, args[0].1)?;
args[0].0 = Value::ByVal(PrimVal::AbstractPtr(first));
args[0].0 = Value::ByVal(PrimVal::Ptr(first));
args[0].1 = self.tcx.mk_mut_ptr(args[0].1);
}

View file

@ -530,7 +530,7 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
PrimVal::F32(f) => self.write_f32(ptr, f),
PrimVal::F64(f) => self.write_f64(ptr, f),
PrimVal::FnPtr(p) |
PrimVal::AbstractPtr(p) => self.write_ptr(ptr, p),
PrimVal::Ptr(p) => self.write_ptr(ptr, p),
}
}

View file

@ -12,7 +12,7 @@ pub enum PrimVal {
I8(i8), I16(i16), I32(i32), I64(i64),
U8(u8), U16(u16), U32(u32), U64(u64),
AbstractPtr(Pointer),
Ptr(Pointer),
FnPtr(Pointer),
IntegerPtr(u64),
Char(char),
@ -211,10 +211,10 @@ pub fn binary_op<'tcx>(bin_op: mir::BinOp, left: PrimVal, right: PrimVal) -> Eva
(IntegerPtr(l), IntegerPtr(r)) => int_binops!(IntegerPtr, l, r),
(AbstractPtr(_), IntegerPtr(_)) |
(IntegerPtr(_), AbstractPtr(_)) |
(FnPtr(_), AbstractPtr(_)) |
(AbstractPtr(_), FnPtr(_)) |
(Ptr(_), IntegerPtr(_)) |
(IntegerPtr(_), Ptr(_)) |
(FnPtr(_), Ptr(_)) |
(Ptr(_), FnPtr(_)) |
(FnPtr(_), IntegerPtr(_)) |
(IntegerPtr(_), FnPtr(_)) =>
unrelated_ptr_ops(bin_op)?,
@ -225,7 +225,7 @@ pub fn binary_op<'tcx>(bin_op: mir::BinOp, left: PrimVal, right: PrimVal) -> Eva
_ => return Err(EvalError::Unimplemented(format!("unimplemented fn ptr comparison: {:?}", bin_op))),
},
(AbstractPtr(l_ptr), AbstractPtr(r_ptr)) => {
(Ptr(l_ptr), Ptr(r_ptr)) => {
if l_ptr.alloc_id != r_ptr.alloc_id {
return Ok((unrelated_ptr_ops(bin_op)?, false));
}