miri: track the Align instead of packedness in PtrAndAlign.

This commit is contained in:
Eduard-Mihai Burtescu 2017-12-16 14:07:04 +02:00
parent 5cab0bf0ad
commit ff080d389d
7 changed files with 152 additions and 182 deletions

View file

@ -1,6 +1,6 @@
#![allow(unknown_lints)]
use ty::layout::HasDataLayout;
use ty::layout::{Align, HasDataLayout};
use super::{EvalResult, MemoryPointer, PointerArithmetic};
use syntax::ast::FloatTy;
@ -9,8 +9,7 @@ use rustc_const_math::ConstFloat;
#[derive(Copy, Clone, Debug)]
pub struct PtrAndAlign {
pub ptr: Pointer,
/// Remember whether this place is *supposed* to be aligned.
pub aligned: bool,
pub align: Align,
}
impl PtrAndAlign {
@ -20,7 +19,7 @@ impl PtrAndAlign {
pub fn offset<'tcx, C: HasDataLayout>(self, i: u64, cx: C) -> EvalResult<'tcx, Self> {
Ok(PtrAndAlign {
ptr: self.ptr.offset(i, cx)?,
aligned: self.aligned,
align: self.align,
})
}
}
@ -182,13 +181,6 @@ pub enum PrimValKind {
Char,
}
impl<'a, 'tcx: 'a> Value {
#[inline]
pub fn by_ref(ptr: Pointer) -> Self {
Value::ByRef(PtrAndAlign { ptr, aligned: true })
}
}
impl<'tcx> PrimVal {
pub fn from_u128(n: u128) -> Self {
PrimVal::Bytes(n)