@@ -1020,12 +1020,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
1020
1020
// Also expose the provenance of the interpreter-level allocation, so it can
1021
1021
// be read by FFI. The `black_box` is defensive programming as LLVM likes
1022
1022
// 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) ;
1029
1027
}
1030
1028
}
1031
1029
interp_ok ( ( ) )
@@ -1041,15 +1039,15 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
1041
1039
pub fn apply_accesses (
1042
1040
& mut self ,
1043
1041
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 > > ,
1046
1044
) -> InterpResult < ' tcx > {
1047
1045
/// Helper function to avoid some code duplication over range overlaps.
1048
1046
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 ) > {
1053
1051
// A bunch of range bounds nonsense that effectively simplifies to
1054
1052
// "get the starting point of the overlap and the length from there".
1055
1053
// 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> {
1061
1059
} else {
1062
1060
rg. end - rg. start
1063
1061
} ;
1064
- let start: u64 = signed_start. try_into ( ) . unwrap_or ( 0 ) ;
1062
+ let start: usize = signed_start. try_into ( ) . unwrap_or ( 0 ) ;
1065
1063
let size = std:: cmp:: min ( size_uncapped, alloc_size - start) ;
1066
1064
Some ( ( start, size) )
1067
1065
}
@@ -1078,13 +1076,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
1078
1076
continue ;
1079
1077
}
1080
1078
1081
- let alloc_base: u64 = {
1079
+ let alloc_base: usize = {
1082
1080
// Keep the alloc here so the borrow checker is happy
1083
1081
let alloc = self . get_alloc_raw ( id) ?;
1084
1082
// 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 ( )
1086
1084
} ;
1087
- let alloc_size = info. size . bytes ( ) ;
1085
+ let alloc_size = info. size . bytes ( ) . try_into ( ) . unwrap ( ) ;
1088
1086
1089
1087
// Find reads which overlap with the current allocation
1090
1088
for rg in & reads {
0 commit comments