@@ -242,13 +242,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
242
242
}
243
243
} ;
244
244
245
+ let alloc = self . memory . get_raw ( ptr. alloc_id ) ?;
246
+
245
247
match mplace. layout . abi {
246
248
Abi :: Scalar ( ..) => {
247
- let scalar = self . memory . get_raw ( ptr. alloc_id ) ?. read_scalar (
248
- self ,
249
- ptr,
250
- mplace. layout . size ,
251
- ) ?;
249
+ let scalar = alloc. read_scalar ( self , ptr, mplace. layout . size ) ?;
252
250
Ok ( Some ( ImmTy { imm : scalar. into ( ) , layout : mplace. layout } ) )
253
251
}
254
252
Abi :: ScalarPair ( ref a, ref b) => {
@@ -261,8 +259,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
261
259
let b_offset = a_size. align_to ( b. align ( self ) . abi ) ;
262
260
assert ! ( b_offset. bytes( ) > 0 ) ; // we later use the offset to tell apart the fields
263
261
let b_ptr = ptr. offset ( b_offset, self ) ?;
264
- let a_val = self . memory . get_raw ( ptr . alloc_id ) ? . read_scalar ( self , a_ptr, a_size) ?;
265
- let b_val = self . memory . get_raw ( ptr . alloc_id ) ? . read_scalar ( self , b_ptr, b_size) ?;
262
+ let a_val = alloc . read_scalar ( self , a_ptr, a_size) ?;
263
+ let b_val = alloc . read_scalar ( self , b_ptr, b_size) ?;
266
264
Ok ( Some ( ImmTy { imm : Immediate :: ScalarPair ( a_val, b_val) , layout : mplace. layout } ) )
267
265
}
268
266
_ => Ok ( None ) ,
0 commit comments