Skip to content
Permalink
Browse files

fat -> wide

  • Loading branch information
RalfJung committed Nov 30, 2019
1 parent 96ea142 commit 386a2bb3a0cf22c895dfd9ba21f92cde3b47aae0
Showing with 6 additions and 6 deletions.
  1. +3 −3 src/librustc_mir/interpret/operand.rs
  2. +3 −3 src/librustc_mir/interpret/place.rs
@@ -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
/// 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
/// defined on `Immediate`, and do not have to work with a `Place`.
#[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> {
match self {
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())
}

// 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(
&self,
mplace: MPlaceTy<'tcx, M::PointerTag>,
@@ -125,7 +125,7 @@ impl<Tag> MemPlace<Tag> {
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`.
#[inline(always)]
pub fn to_ref(self) -> Immediate<Tag> {
@@ -278,7 +278,7 @@ where
M::MemoryMap: AllocMap<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<Tag, M::AllocExtra>)>,
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()`.
///
/// 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)
}

/// Returns a fat MPlace.
/// Returns a wide MPlace.
pub fn allocate_str(
&mut self,
str: &str,

0 comments on commit 386a2bb

Please sign in to comment.
You can’t perform that action at this time.