@@ -217,6 +217,23 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
217
217
& mut self . memory
218
218
}
219
219
220
+ #[ inline( always) ]
221
+ pub fn force_ptr (
222
+ & self ,
223
+ scalar : Scalar < M :: PointerTag > ,
224
+ ) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
225
+ self . memory . force_ptr ( scalar)
226
+ }
227
+
228
+ #[ inline( always) ]
229
+ pub fn force_bits (
230
+ & self ,
231
+ scalar : Scalar < M :: PointerTag > ,
232
+ size : Size
233
+ ) -> InterpResult < ' tcx , u128 > {
234
+ self . memory . force_bits ( scalar, size)
235
+ }
236
+
220
237
#[ inline( always) ]
221
238
pub fn tag_static_base_pointer ( & self , ptr : Pointer ) -> Pointer < M :: PointerTag > {
222
239
self . memory . tag_static_base_pointer ( ptr)
@@ -248,6 +265,27 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
248
265
self . frame ( ) . body
249
266
}
250
267
268
+ #[ inline( always) ]
269
+ pub fn sign_extend ( & self , value : u128 , ty : TyLayout < ' _ > ) -> u128 {
270
+ assert ! ( ty. abi. is_signed( ) ) ;
271
+ sign_extend ( value, ty. size )
272
+ }
273
+
274
+ #[ inline( always) ]
275
+ pub fn truncate ( & self , value : u128 , ty : TyLayout < ' _ > ) -> u128 {
276
+ truncate ( value, ty. size )
277
+ }
278
+
279
+ #[ inline]
280
+ pub fn type_is_sized ( & self , ty : Ty < ' tcx > ) -> bool {
281
+ ty. is_sized ( self . tcx , self . param_env )
282
+ }
283
+
284
+ #[ inline]
285
+ pub fn type_is_freeze ( & self , ty : Ty < ' tcx > ) -> bool {
286
+ ty. is_freeze ( * self . tcx , self . param_env , DUMMY_SP )
287
+ }
288
+
251
289
pub ( super ) fn subst_and_normalize_erasing_regions < T : TypeFoldable < ' tcx > > (
252
290
& self ,
253
291
substs : T ,
@@ -283,14 +321,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
283
321
) . ok_or_else ( || InterpError :: TooGeneric . into ( ) )
284
322
}
285
323
286
- pub fn type_is_sized ( & self , ty : Ty < ' tcx > ) -> bool {
287
- ty. is_sized ( self . tcx , self . param_env )
288
- }
289
-
290
- pub fn type_is_freeze ( & self , ty : Ty < ' tcx > ) -> bool {
291
- ty. is_freeze ( * self . tcx , self . param_env , DUMMY_SP )
292
- }
293
-
294
324
pub fn load_mir (
295
325
& self ,
296
326
instance : ty:: InstanceDef < ' tcx > ,
@@ -761,32 +791,4 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
761
791
trace ! ( "generate stacktrace: {:#?}, {:?}" , frames, explicit_span) ;
762
792
frames
763
793
}
764
-
765
- #[ inline( always) ]
766
- pub fn sign_extend ( & self , value : u128 , ty : TyLayout < ' _ > ) -> u128 {
767
- assert ! ( ty. abi. is_signed( ) ) ;
768
- sign_extend ( value, ty. size )
769
- }
770
-
771
- #[ inline( always) ]
772
- pub fn truncate ( & self , value : u128 , ty : TyLayout < ' _ > ) -> u128 {
773
- truncate ( value, ty. size )
774
- }
775
-
776
- #[ inline( always) ]
777
- pub fn force_ptr (
778
- & self ,
779
- scalar : Scalar < M :: PointerTag > ,
780
- ) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
781
- self . memory . force_ptr ( scalar)
782
- }
783
-
784
- #[ inline( always) ]
785
- pub fn force_bits (
786
- & self ,
787
- scalar : Scalar < M :: PointerTag > ,
788
- size : Size
789
- ) -> InterpResult < ' tcx , u128 > {
790
- self . memory . force_bits ( scalar, size)
791
- }
792
794
}
0 commit comments