@@ -52,9 +52,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5252 if zero_init {
5353 // We just allocated this, the access is definitely in-bounds.
5454 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 ) )
5856 . unwrap ( ) ;
5957 }
6058 Scalar :: Ptr ( ptr)
@@ -229,9 +227,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
229227 ) ;
230228 // We just allocated this, the access is definitely in-bounds.
231229 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 ) )
235231 . unwrap ( ) ;
236232 this. write_scalar ( Scalar :: Ptr ( ptr) , dest) ?;
237233 }
@@ -841,25 +837,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
841837 }
842838 "GetSystemInfo" => {
843839 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.
848840 // Initialize with `0`.
849841 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 ) ) ?;
852843 // Set number of processors.
853844 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, 6 ) ?;
846+ this. write_scalar (
847+ Scalar :: from_int ( NUM_CPUS , dword_size) ,
848+ num_cpus. into ( ) ,
849+ ) ?;
863850 }
864851
865852 "TlsAlloc" => {
0 commit comments