@@ -71,15 +71,15 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
7171 sym:: pref_align_of => {
7272 // Correctly handles non-monomorphic calls, so there is no need for ensure_monomorphic_enough.
7373 let layout = tcx. layout_of ( param_env. and ( tp_ty) ) . map_err ( |e| err_inval ! ( Layout ( e) ) ) ?;
74- ConstValue :: from_machine_usize ( layout. align . pref . bytes ( ) , & tcx)
74+ ConstValue :: from_target_usize ( layout. align . pref . bytes ( ) , & tcx)
7575 }
7676 sym:: type_id => {
7777 ensure_monomorphic_enough ( tcx, tp_ty) ?;
7878 ConstValue :: from_u64 ( tcx. type_id_hash ( tp_ty) )
7979 }
8080 sym:: variant_count => match tp_ty. kind ( ) {
8181 // Correctly handles non-monomorphic calls, so there is no need for ensure_monomorphic_enough.
82- ty:: Adt ( adt, _) => ConstValue :: from_machine_usize ( adt. variants ( ) . len ( ) as u64 , & tcx) ,
82+ ty:: Adt ( adt, _) => ConstValue :: from_target_usize ( adt. variants ( ) . len ( ) as u64 , & tcx) ,
8383 ty:: Alias ( ..) | ty:: Param ( _) | ty:: Placeholder ( _) | ty:: Infer ( _) => {
8484 throw_inval ! ( TooGeneric )
8585 }
@@ -104,7 +104,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
104104 | ty:: GeneratorWitnessMIR ( _, _)
105105 | ty:: Never
106106 | ty:: Tuple ( _)
107- | ty:: Error ( _) => ConstValue :: from_machine_usize ( 0u64 , & tcx) ,
107+ | ty:: Error ( _) => ConstValue :: from_target_usize ( 0u64 , & tcx) ,
108108 } ,
109109 other => bug ! ( "`{}` is not a zero arg intrinsic" , other) ,
110110 } )
@@ -156,7 +156,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
156156 _ => bug ! ( ) ,
157157 } ;
158158
159- self . write_scalar ( Scalar :: from_machine_usize ( result, self ) , dest) ?;
159+ self . write_scalar ( Scalar :: from_target_usize ( result, self ) , dest) ?;
160160 }
161161
162162 sym:: pref_align_of
@@ -302,15 +302,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
302302 }
303303 sym:: offset => {
304304 let ptr = self . read_pointer ( & args[ 0 ] ) ?;
305- let offset_count = self . read_machine_isize ( & args[ 1 ] ) ?;
305+ let offset_count = self . read_target_isize ( & args[ 1 ] ) ?;
306306 let pointee_ty = substs. type_at ( 0 ) ;
307307
308308 let offset_ptr = self . ptr_offset_inbounds ( ptr, pointee_ty, offset_count) ?;
309309 self . write_pointer ( offset_ptr, dest) ?;
310310 }
311311 sym:: arith_offset => {
312312 let ptr = self . read_pointer ( & args[ 0 ] ) ?;
313- let offset_count = self . read_machine_isize ( & args[ 1 ] ) ?;
313+ let offset_count = self . read_target_isize ( & args[ 1 ] ) ?;
314314 let pointee_ty = substs. type_at ( 0 ) ;
315315
316316 let pointee_size = i64:: try_from ( self . layout_of ( pointee_ty) ?. size . bytes ( ) ) . unwrap ( ) ;
@@ -376,7 +376,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
376376 // The signed form of the intrinsic allows this. If we interpret the
377377 // difference as isize, we'll get the proper signed difference. If that
378378 // seems *positive*, they were more than isize::MAX apart.
379- let dist = val. to_machine_isize ( self ) ?;
379+ let dist = val. to_target_isize ( self ) ?;
380380 if dist >= 0 {
381381 throw_ub_format ! (
382382 "`{}` called when first pointer is too far before second" ,
@@ -386,7 +386,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
386386 dist
387387 } else {
388388 // b >= a
389- let dist = val. to_machine_isize ( self ) ?;
389+ let dist = val. to_target_isize ( self ) ?;
390390 // If converting to isize produced a *negative* result, we had an overflow
391391 // because they were more than isize::MAX apart.
392392 if dist < 0 {
@@ -411,10 +411,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
411411
412412 // Perform division by size to compute return value.
413413 let ret_layout = if intrinsic_name == sym:: ptr_offset_from_unsigned {
414- assert ! ( 0 <= dist && dist <= self . machine_isize_max ( ) ) ;
414+ assert ! ( 0 <= dist && dist <= self . target_isize_max ( ) ) ;
415415 usize_layout
416416 } else {
417- assert ! ( self . machine_isize_min ( ) <= dist && dist <= self . machine_isize_max ( ) ) ;
417+ assert ! ( self . target_isize_min ( ) <= dist && dist <= self . target_isize_max ( ) ) ;
418418 isize_layout
419419 } ;
420420 let pointee_layout = self . layout_of ( substs. type_at ( 0 ) ) ?;
@@ -525,12 +525,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
525525 sym:: vtable_size => {
526526 let ptr = self . read_pointer ( & args[ 0 ] ) ?;
527527 let ( size, _align) = self . get_vtable_size_and_align ( ptr) ?;
528- self . write_scalar ( Scalar :: from_machine_usize ( size. bytes ( ) , self ) , dest) ?;
528+ self . write_scalar ( Scalar :: from_target_usize ( size. bytes ( ) , self ) , dest) ?;
529529 }
530530 sym:: vtable_align => {
531531 let ptr = self . read_pointer ( & args[ 0 ] ) ?;
532532 let ( _size, align) = self . get_vtable_size_and_align ( ptr) ?;
533- self . write_scalar ( Scalar :: from_machine_usize ( align. bytes ( ) , self ) , dest) ?;
533+ self . write_scalar ( Scalar :: from_target_usize ( align. bytes ( ) , self ) , dest) ?;
534534 }
535535
536536 _ => return Ok ( false ) ,
@@ -669,10 +669,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
669669 count : & OpTy < ' tcx , <M as Machine < ' mir , ' tcx > >:: Provenance > ,
670670 nonoverlapping : bool ,
671671 ) -> InterpResult < ' tcx > {
672- let count = self . read_machine_usize ( & count) ?;
672+ let count = self . read_target_usize ( & count) ?;
673673 let layout = self . layout_of ( src. layout . ty . builtin_deref ( true ) . unwrap ( ) . ty ) ?;
674674 let ( size, align) = ( layout. size , layout. align . abi ) ;
675- // `checked_mul` enforces a too small bound (the correct one would probably be machine_isize_max ),
675+ // `checked_mul` enforces a too small bound (the correct one would probably be target_isize_max ),
676676 // but no actual allocation can be big enough for the difference to be noticeable.
677677 let size = size. checked_mul ( count, self ) . ok_or_else ( || {
678678 err_ub_format ! (
@@ -697,9 +697,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
697697
698698 let dst = self . read_pointer ( & dst) ?;
699699 let byte = self . read_scalar ( & byte) ?. to_u8 ( ) ?;
700- let count = self . read_machine_usize ( & count) ?;
700+ let count = self . read_target_usize ( & count) ?;
701701
702- // `checked_mul` enforces a too small bound (the correct one would probably be machine_isize_max ),
702+ // `checked_mul` enforces a too small bound (the correct one would probably be target_isize_max ),
703703 // but no actual allocation can be big enough for the difference to be noticeable.
704704 let len = layout
705705 . size
0 commit comments