@@ -134,7 +134,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
134134 // entered for addresses that are not the base address, so even zero-sized
135135 // allocations will get recognized at their base address -- but all other
136136 // allocations will *not* be recognized at their "end" address.
137- let size = ecx. get_alloc_info ( alloc_id) . 0 ;
137+ let size = ecx. get_alloc_info ( alloc_id) . size ;
138138 if offset < size. bytes ( ) { Some ( alloc_id) } else { None }
139139 }
140140 } ?;
@@ -157,25 +157,25 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
157157 ) -> InterpResult < ' tcx , u64 > {
158158 let ecx = self . eval_context_ref ( ) ;
159159 let mut rng = ecx. machine . rng . borrow_mut ( ) ;
160- let ( size , align , kind ) = ecx. get_alloc_info ( alloc_id) ;
160+ let info = ecx. get_alloc_info ( alloc_id) ;
161161 // This is either called immediately after allocation (and then cached), or when
162162 // adjusting `tcx` pointers (which never get freed). So assert that we are looking
163163 // at a live allocation. This also ensures that we never re-assign an address to an
164164 // allocation that previously had an address, but then was freed and the address
165165 // information was removed.
166- assert ! ( !matches!( kind, AllocKind :: Dead ) ) ;
166+ assert ! ( !matches!( info . kind, AllocKind :: Dead ) ) ;
167167
168168 // This allocation does not have a base address yet, pick or reuse one.
169169 if ecx. machine . native_lib . is_some ( ) {
170170 // In native lib mode, we use the "real" address of the bytes for this allocation.
171171 // This ensures the interpreted program and native code have the same view of memory.
172- let base_ptr = match kind {
172+ let base_ptr = match info . kind {
173173 AllocKind :: LiveData => {
174174 if ecx. tcx . try_get_global_alloc ( alloc_id) . is_some ( ) {
175175 // For new global allocations, we always pre-allocate the memory to be able use the machine address directly.
176- let prepared_bytes = MiriAllocBytes :: zeroed ( size, align)
176+ let prepared_bytes = MiriAllocBytes :: zeroed ( info . size , info . align )
177177 . unwrap_or_else ( || {
178- panic ! ( "Miri ran out of memory: cannot create allocation of {size:?} bytes" )
178+ panic ! ( "Miri ran out of memory: cannot create allocation of {size:?} bytes" , size = info . size )
179179 } ) ;
180180 let ptr = prepared_bytes. as_ptr ( ) ;
181181 // Store prepared allocation space to be picked up for use later.
@@ -204,7 +204,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
204204 }
205205 // We are not in native lib mode, so we control the addresses ourselves.
206206 if let Some ( ( reuse_addr, clock) ) =
207- global_state. reuse . take_addr ( & mut * rng, size, align, memory_kind, ecx. active_thread ( ) )
207+ global_state. reuse . take_addr ( & mut * rng, info . size , info . align , memory_kind, ecx. active_thread ( ) )
208208 {
209209 if let Some ( clock) = clock {
210210 ecx. acquire_clock ( & clock) ;
@@ -220,14 +220,14 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
220220 . next_base_addr
221221 . checked_add ( slack)
222222 . ok_or_else ( || err_exhaust ! ( AddressSpaceFull ) ) ?;
223- let base_addr = align_addr ( base_addr, align. bytes ( ) ) ;
223+ let base_addr = align_addr ( base_addr, info . align . bytes ( ) ) ;
224224
225225 // Remember next base address. If this allocation is zero-sized, leave a gap of at
226226 // least 1 to avoid two allocations having the same base address. (The logic in
227227 // `alloc_id_from_addr` assumes unique addresses, and different function/vtable pointers
228228 // need to be distinguishable!)
229229 global_state. next_base_addr = base_addr
230- . checked_add ( max ( size. bytes ( ) , 1 ) )
230+ . checked_add ( max ( info . size . bytes ( ) , 1 ) )
231231 . ok_or_else ( || err_exhaust ! ( AddressSpaceFull ) ) ?;
232232 // Even if `Size` didn't overflow, we might still have filled up the address space.
233233 if global_state. next_base_addr > ecx. target_usize_max ( ) {
0 commit comments