@@ -52,9 +52,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
52
52
if zero_init {
53
53
// We just allocated this, the access is definitely in-bounds.
54
54
this. memory
55
- . get_mut ( ptr. alloc_id )
56
- . unwrap ( )
57
- . write_repeat ( & * this. tcx , ptr, 0 , Size :: from_bytes ( size) )
55
+ . write_bytes ( ptr. into ( ) , itertools:: repeat_n ( 0u8 , size as usize ) )
58
56
. unwrap ( ) ;
59
57
}
60
58
Scalar :: Ptr ( ptr)
@@ -229,9 +227,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
229
227
) ;
230
228
// We just allocated this, the access is definitely in-bounds.
231
229
this. memory
232
- . get_mut ( ptr. alloc_id )
233
- . unwrap ( )
234
- . write_repeat ( tcx, ptr, 0 , Size :: from_bytes ( size) )
230
+ . write_bytes ( ptr. into ( ) , itertools:: repeat_n ( 0u8 , size as usize ) )
235
231
. unwrap ( ) ;
236
232
this. write_scalar ( Scalar :: Ptr ( ptr) , dest) ?;
237
233
}
@@ -841,25 +837,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
841
837
}
842
838
"GetSystemInfo" => {
843
839
let system_info = this. deref_operand ( args[ 0 ] ) ?;
844
- let system_info_ptr = this
845
- . check_mplace_access ( system_info, None ) ?
846
- . expect ( "cannot be a ZST" ) ;
847
- // We rely on `deref_operand` doing bounds checks for us.
848
840
// Initialize with `0`.
849
841
this. memory
850
- . get_mut ( system_info_ptr. alloc_id ) ?
851
- . write_repeat ( tcx, system_info_ptr, 0 , system_info. layout . size ) ?;
842
+ . write_bytes ( system_info. ptr , itertools:: repeat_n ( 0 , system_info. layout . size . bytes ( ) as usize ) ) ?;
852
843
// Set number of processors.
853
844
let dword_size = Size :: from_bytes ( 4 ) ;
854
- let offset = 2 * dword_size + 3 * tcx. pointer_size ( ) ;
855
- this. memory
856
- . get_mut ( system_info_ptr. alloc_id ) ?
857
- . write_scalar (
858
- tcx,
859
- system_info_ptr. offset ( offset, tcx) ?,
860
- Scalar :: from_int ( NUM_CPUS , dword_size) . into ( ) ,
861
- dword_size,
862
- ) ?;
845
+ let num_cpus = this. mplace_field ( system_info, 5 ) ?;
846
+ this. write_scalar (
847
+ Scalar :: from_int ( NUM_CPUS , dword_size) ,
848
+ num_cpus. into ( ) ,
849
+ ) ?;
863
850
}
864
851
865
852
"TlsAlloc" => {
0 commit comments