@@ -1020,12 +1020,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10201020 // Also expose the provenance of the interpreter-level allocation, so it can
10211021 // be read by FFI. The `black_box` is defensive programming as LLVM likes
10221022 // to (incorrectly) optimize away ptr2int casts whose result is unused.
1023- if paranoid {
1024- std:: hint:: black_box ( alloc. get_bytes_unchecked_raw ( ) . expose_provenance ( ) ) ;
1025- // Prepare for possible write from native code if mutable.
1026- if info. mutbl . is_mut ( ) {
1027- self . get_alloc_raw_mut ( id) ?. 0 . prepare_for_native_write ( ) ;
1028- }
1023+ std:: hint:: black_box ( alloc. get_bytes_unchecked_raw ( ) . expose_provenance ( ) ) ;
1024+ // Prepare for possible write from native code if mutable.
1025+ if info. mutbl . is_mut ( ) {
1026+ self . get_alloc_raw_mut ( id) ?. 0 . prepare_for_native_write ( paranoid) ;
10291027 }
10301028 }
10311029 interp_ok ( ( ) )
@@ -1041,15 +1039,15 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10411039 pub fn apply_accesses (
10421040 & mut self ,
10431041 mut ids : Vec < AllocId > ,
1044- reads : Vec < std:: ops:: Range < u64 > > ,
1045- writes : Vec < std:: ops:: Range < u64 > > ,
1042+ reads : Vec < std:: ops:: Range < usize > > ,
1043+ writes : Vec < std:: ops:: Range < usize > > ,
10461044 ) -> InterpResult < ' tcx > {
10471045 /// Helper function to avoid some code duplication over range overlaps.
10481046 fn get_start_size (
1049- rg : std:: ops:: Range < u64 > ,
1050- alloc_base : u64 ,
1051- alloc_size : u64 ,
1052- ) -> Option < ( u64 , u64 ) > {
1047+ rg : std:: ops:: Range < usize > ,
1048+ alloc_base : usize ,
1049+ alloc_size : usize ,
1050+ ) -> Option < ( usize , usize ) > {
10531051 // A bunch of range bounds nonsense that effectively simplifies to
10541052 // "get the starting point of the overlap and the length from there".
10551053 // Needs to also account for the allocation being in the middle of the
@@ -1061,7 +1059,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10611059 } else {
10621060 rg. end - rg. start
10631061 } ;
1064- let start: u64 = signed_start. try_into ( ) . unwrap_or ( 0 ) ;
1062+ let start: usize = signed_start. try_into ( ) . unwrap_or ( 0 ) ;
10651063 let size = std:: cmp:: min ( size_uncapped, alloc_size - start) ;
10661064 Some ( ( start, size) )
10671065 }
@@ -1078,13 +1076,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10781076 continue ;
10791077 }
10801078
1081- let alloc_base: u64 = {
1079+ let alloc_base: usize = {
10821080 // Keep the alloc here so the borrow checker is happy
10831081 let alloc = self . get_alloc_raw ( id) ?;
10841082 // No need for black_box trickery since we actually use the address
1085- alloc. get_bytes_unchecked_raw ( ) . expose_provenance ( ) . try_into ( ) . unwrap ( )
1083+ alloc. get_bytes_unchecked_raw ( ) . expose_provenance ( )
10861084 } ;
1087- let alloc_size = info. size . bytes ( ) ;
1085+ let alloc_size = info. size . bytes ( ) . try_into ( ) . unwrap ( ) ;
10881086
10891087 // Find reads which overlap with the current allocation
10901088 for rg in & reads {
0 commit comments