organize methods a bit better
This commit is contained in:
parent
956a3ef3bb
commit
52e6f859f1
|
@ -217,6 +217,23 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
&mut self.memory
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn force_ptr(
|
||||
&self,
|
||||
scalar: Scalar<M::PointerTag>,
|
||||
) -> InterpResult<'tcx, Pointer<M::PointerTag>> {
|
||||
self.memory.force_ptr(scalar)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn force_bits(
|
||||
&self,
|
||||
scalar: Scalar<M::PointerTag>,
|
||||
size: Size
|
||||
) -> InterpResult<'tcx, u128> {
|
||||
self.memory.force_bits(scalar, size)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn tag_static_base_pointer(&self, ptr: Pointer) -> Pointer<M::PointerTag> {
|
||||
self.memory.tag_static_base_pointer(ptr)
|
||||
|
@ -248,6 +265,27 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
self.frame().body
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn sign_extend(&self, value: u128, ty: TyLayout<'_>) -> u128 {
|
||||
assert!(ty.abi.is_signed());
|
||||
sign_extend(value, ty.size)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn truncate(&self, value: u128, ty: TyLayout<'_>) -> u128 {
|
||||
truncate(value, ty.size)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
|
||||
ty.is_sized(self.tcx, self.param_env)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
|
||||
ty.is_freeze(*self.tcx, self.param_env, DUMMY_SP)
|
||||
}
|
||||
|
||||
pub(super) fn subst_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
|
||||
&self,
|
||||
substs: T,
|
||||
|
@ -283,14 +321,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
).ok_or_else(|| InterpError::TooGeneric.into())
|
||||
}
|
||||
|
||||
pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
|
||||
ty.is_sized(self.tcx, self.param_env)
|
||||
}
|
||||
|
||||
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
|
||||
ty.is_freeze(*self.tcx, self.param_env, DUMMY_SP)
|
||||
}
|
||||
|
||||
pub fn load_mir(
|
||||
&self,
|
||||
instance: ty::InstanceDef<'tcx>,
|
||||
|
@ -761,32 +791,4 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
trace!("generate stacktrace: {:#?}, {:?}", frames, explicit_span);
|
||||
frames
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn sign_extend(&self, value: u128, ty: TyLayout<'_>) -> u128 {
|
||||
assert!(ty.abi.is_signed());
|
||||
sign_extend(value, ty.size)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn truncate(&self, value: u128, ty: TyLayout<'_>) -> u128 {
|
||||
truncate(value, ty.size)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn force_ptr(
|
||||
&self,
|
||||
scalar: Scalar<M::PointerTag>,
|
||||
) -> InterpResult<'tcx, Pointer<M::PointerTag>> {
|
||||
self.memory.force_ptr(scalar)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn force_bits(
|
||||
&self,
|
||||
scalar: Scalar<M::PointerTag>,
|
||||
size: Size
|
||||
) -> InterpResult<'tcx, u128> {
|
||||
self.memory.force_bits(scalar, size)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue