miri value visitor: provide place when visiting a primitive
This commit is contained in:
parent
c5bc83b60d
commit
e4d03f82b5
@ -21,7 +21,7 @@ use rustc::mir::interpret::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
OpTy, MPlaceTy, ImmTy, Machine, EvalContext, ValueVisitor
|
OpTy, MPlaceTy, Machine, EvalContext, ValueVisitor
|
||||||
};
|
};
|
||||||
|
|
||||||
macro_rules! validation_failure {
|
macro_rules! validation_failure {
|
||||||
@ -281,8 +281,9 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_primitive(&mut self, value: ImmTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
|
fn visit_primitive(&mut self, value: OpTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
|
||||||
{
|
{
|
||||||
|
let value = self.ecx.read_immediate(value)?;
|
||||||
// Go over all the primitive types
|
// Go over all the primitive types
|
||||||
let ty = value.layout.ty;
|
let ty = value.layout.ty;
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
|
@ -8,7 +8,7 @@ use rustc::mir::interpret::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
Machine, EvalContext, MPlaceTy, OpTy, ImmTy,
|
Machine, EvalContext, MPlaceTy, OpTy,
|
||||||
};
|
};
|
||||||
|
|
||||||
// A thing that we can project into, and that has a layout.
|
// A thing that we can project into, and that has a layout.
|
||||||
@ -201,9 +201,11 @@ macro_rules! make_value_visitor {
|
|||||||
{ Ok(()) }
|
{ Ok(()) }
|
||||||
|
|
||||||
/// Called whenever we reach a value of primitive type. There can be no recursion
|
/// Called whenever we reach a value of primitive type. There can be no recursion
|
||||||
/// below such a value. This is the leave function.
|
/// below such a value. This is the leaf function.
|
||||||
|
/// We do *not* provide an `ImmTy` here because some implementations might want
|
||||||
|
/// to write to the place this primitive lives in.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn visit_primitive(&mut self, _val: ImmTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
|
fn visit_primitive(&mut self, _v: Self::V) -> EvalResult<'tcx>
|
||||||
{ Ok(()) }
|
{ Ok(()) }
|
||||||
|
|
||||||
// Default recursors. Not meant to be overloaded.
|
// Default recursors. Not meant to be overloaded.
|
||||||
@ -279,9 +281,7 @@ macro_rules! make_value_visitor {
|
|||||||
_ => v.layout().ty.builtin_deref(true).is_some(),
|
_ => v.layout().ty.builtin_deref(true).is_some(),
|
||||||
};
|
};
|
||||||
if primitive {
|
if primitive {
|
||||||
let op = v.to_op(self.ecx())?;
|
return self.visit_primitive(v);
|
||||||
let val = self.ecx().read_immediate(op)?;
|
|
||||||
return self.visit_primitive(val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proceed into the fields.
|
// Proceed into the fields.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user