1
Fork 0

fat -> wide

This commit is contained in:
Ralf Jung 2019-11-30 10:28:01 +01:00
parent 96ea142c89
commit 386a2bb3a0
2 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ use rustc_macros::HashStable;
/// ///
/// For optimization of a few very common cases, there is also a representation for a pair of /// For optimization of a few very common cases, there is also a representation for a pair of
/// primitive values (`ScalarPair`). It allows Miri to avoid making allocations for checked binary /// primitive values (`ScalarPair`). It allows Miri to avoid making allocations for checked binary
/// operations and fat pointers. This idea was taken from rustc's codegen. /// operations and wide pointers. This idea was taken from rustc's codegen.
/// In particular, thanks to `ScalarPair`, arithmetic operations and casts can be entirely /// In particular, thanks to `ScalarPair`, arithmetic operations and casts can be entirely
/// defined on `Immediate`, and do not have to work with a `Place`. /// defined on `Immediate`, and do not have to work with a `Place`.
#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, Hash)] #[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, Hash)]
@ -74,7 +74,7 @@ impl<'tcx, Tag> Immediate<Tag> {
pub fn to_scalar_or_undef(self) -> ScalarMaybeUndef<Tag> { pub fn to_scalar_or_undef(self) -> ScalarMaybeUndef<Tag> {
match self { match self {
Immediate::Scalar(val) => val, Immediate::Scalar(val) => val,
Immediate::ScalarPair(..) => bug!("Got a fat pointer where a scalar was expected"), Immediate::ScalarPair(..) => bug!("Got a wide pointer where a scalar was expected"),
} }
} }
@ -331,7 +331,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Ok(self.read_immediate(op)?.to_scalar_or_undef()) Ok(self.read_immediate(op)?.to_scalar_or_undef())
} }
// Turn the fat MPlace into a string (must already be dereferenced!) // Turn the wide MPlace into a string (must already be dereferenced!)
pub fn read_str( pub fn read_str(
&self, &self,
mplace: MPlaceTy<'tcx, M::PointerTag>, mplace: MPlaceTy<'tcx, M::PointerTag>,

View file

@ -125,7 +125,7 @@ impl<Tag> MemPlace<Tag> {
Self::from_scalar_ptr(ptr.into(), align) Self::from_scalar_ptr(ptr.into(), align)
} }
/// Turn a mplace into a (thin or fat) pointer, as a reference, pointing to the same space. /// Turn a mplace into a (thin or wide) pointer, as a reference, pointing to the same space.
/// This is the inverse of `ref_to_mplace`. /// This is the inverse of `ref_to_mplace`.
#[inline(always)] #[inline(always)]
pub fn to_ref(self) -> Immediate<Tag> { pub fn to_ref(self) -> Immediate<Tag> {
@ -278,7 +278,7 @@ where
M::MemoryMap: AllocMap<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<Tag, M::AllocExtra>)>, M::MemoryMap: AllocMap<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<Tag, M::AllocExtra>)>,
M::AllocExtra: AllocationExtra<Tag>, M::AllocExtra: AllocationExtra<Tag>,
{ {
/// Take a value, which represents a (thin or fat) reference, and make it a place. /// Take a value, which represents a (thin or wide) reference, and make it a place.
/// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`. /// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`.
/// ///
/// Only call this if you are sure the place is "valid" (aligned and inbounds), or do not /// Only call this if you are sure the place is "valid" (aligned and inbounds), or do not
@ -1034,7 +1034,7 @@ where
MPlaceTy::from_aligned_ptr(ptr, layout) MPlaceTy::from_aligned_ptr(ptr, layout)
} }
/// Returns a fat MPlace. /// Returns a wide MPlace.
pub fn allocate_str( pub fn allocate_str(
&mut self, &mut self,
str: &str, str: &str,