Add size assertions for interpreter data structures
This commit is contained in:
parent
a143517d44
commit
6c9d7fbeed
@ -32,6 +32,9 @@ pub enum Immediate<Tag = ()> {
|
||||
ScalarPair(ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>),
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||
|
||||
impl<Tag> From<ScalarMaybeUninit<Tag>> for Immediate<Tag> {
|
||||
#[inline(always)]
|
||||
fn from(val: ScalarMaybeUninit<Tag>) -> Self {
|
||||
@ -92,6 +95,9 @@ pub struct ImmTy<'tcx, Tag = ()> {
|
||||
pub layout: TyAndLayout<'tcx>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||
|
||||
impl<Tag: Copy> std::fmt::Display for ImmTy<'tcx, Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
/// Helper function for printing a scalar to a FmtPrinter
|
||||
@ -156,6 +162,9 @@ pub struct OpTy<'tcx, Tag = ()> {
|
||||
pub layout: TyAndLayout<'tcx>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(OpTy<'_, ()>, 80);
|
||||
|
||||
impl<'tcx, Tag> std::ops::Deref for OpTy<'tcx, Tag> {
|
||||
type Target = Operand<Tag>;
|
||||
#[inline(always)]
|
||||
|
@ -33,6 +33,9 @@ pub enum MemPlaceMeta<Tag = ()> {
|
||||
Poison,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||
|
||||
impl<Tag> MemPlaceMeta<Tag> {
|
||||
pub fn unwrap_meta(self) -> Scalar<Tag> {
|
||||
match self {
|
||||
@ -71,6 +74,9 @@ pub struct MemPlace<Tag = ()> {
|
||||
pub meta: MemPlaceMeta<Tag>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(MemPlace, 56);
|
||||
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)]
|
||||
pub enum Place<Tag = ()> {
|
||||
/// A place referring to a value allocated in the `Memory` system.
|
||||
@ -81,12 +87,18 @@ pub enum Place<Tag = ()> {
|
||||
Local { frame: usize, local: mir::Local },
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(Place, 64);
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct PlaceTy<'tcx, Tag = ()> {
|
||||
place: Place<Tag>, // Keep this private; it helps enforce invariants.
|
||||
pub layout: TyAndLayout<'tcx>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80);
|
||||
|
||||
impl<'tcx, Tag> std::ops::Deref for PlaceTy<'tcx, Tag> {
|
||||
type Target = Place<Tag>;
|
||||
#[inline(always)]
|
||||
@ -102,6 +114,9 @@ pub struct MPlaceTy<'tcx, Tag = ()> {
|
||||
pub layout: TyAndLayout<'tcx>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 72);
|
||||
|
||||
impl<'tcx, Tag> std::ops::Deref for MPlaceTy<'tcx, Tag> {
|
||||
type Target = MemPlace<Tag>;
|
||||
#[inline(always)]
|
||||
|
Loading…
Reference in New Issue
Block a user