@@ -107,7 +107,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
107
107
108
108
#[ inline]
109
109
pub fn tag_static_base_pointer ( & self , ptr : Pointer ) -> Pointer < M :: PointerTag > {
110
- ptr. with_tag ( M :: tag_static_base_pointer ( ptr. alloc_id , & self . extra ) )
110
+ ptr. with_tag ( M :: tag_static_base_pointer ( ptr. alloc_id , & self ) )
111
111
}
112
112
113
113
pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> Pointer < M :: PointerTag > {
@@ -140,7 +140,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
140
140
kind : MemoryKind < M :: MemoryKinds > ,
141
141
) -> Pointer < M :: PointerTag > {
142
142
let id = self . tcx . alloc_map . lock ( ) . reserve ( ) ;
143
- let ( alloc, tag) = M :: tag_allocation ( id, Cow :: Owned ( alloc) , Some ( kind) , & self . extra ) ;
143
+ let ( alloc, tag) = M :: tag_allocation ( id, Cow :: Owned ( alloc) , Some ( kind) , & self ) ;
144
144
self . alloc_map . insert ( id, ( kind, alloc. into_owned ( ) ) ) ;
145
145
Pointer :: from ( id) . with_tag ( tag)
146
146
}
@@ -327,7 +327,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
327
327
fn get_static_alloc (
328
328
id : AllocId ,
329
329
tcx : TyCtxtAt < ' tcx > ,
330
- memory_extra : & M :: MemoryExtra ,
330
+ memory : & Memory < ' mir , ' tcx , M > ,
331
331
) -> InterpResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag , M :: AllocExtra > > > {
332
332
let alloc = tcx. alloc_map . lock ( ) . get ( id) ;
333
333
let alloc = match alloc {
@@ -374,7 +374,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
374
374
id, // always use the ID we got as input, not the "hidden" one.
375
375
alloc,
376
376
M :: STATIC_KIND . map ( MemoryKind :: Machine ) ,
377
- memory_extra
377
+ memory
378
378
) . 0 )
379
379
}
380
380
@@ -387,7 +387,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
387
387
// `get_static_alloc` that we can actually use directly without inserting anything anywhere.
388
388
// So the error type is `InterpResult<'tcx, &Allocation<M::PointerTag>>`.
389
389
let a = self . alloc_map . get_or ( id, || {
390
- let alloc = Self :: get_static_alloc ( id, self . tcx , & self . extra ) . map_err ( Err ) ?;
390
+ let alloc = Self :: get_static_alloc ( id, self . tcx , & self ) . map_err ( Err ) ?;
391
391
match alloc {
392
392
Cow :: Borrowed ( alloc) => {
393
393
// We got a ref, cheaply return that as an "error" so that the
@@ -416,11 +416,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
416
416
id : AllocId ,
417
417
) -> InterpResult < ' tcx , & mut Allocation < M :: PointerTag , M :: AllocExtra > > {
418
418
let tcx = self . tcx ;
419
- let memory_extra = & self . extra ;
419
+ let alloc = Self :: get_static_alloc ( id , tcx , & self ) ;
420
420
let a = self . alloc_map . get_mut_or ( id, || {
421
421
// Need to make a copy, even if `get_static_alloc` is able
422
422
// to give us a cheap reference.
423
- let alloc = Self :: get_static_alloc ( id , tcx , memory_extra ) ?;
423
+ let alloc = alloc ?;
424
424
if alloc. mutability == Mutability :: Immutable {
425
425
return err ! ( ModifiedConstantMemory ) ;
426
426
}
@@ -843,7 +843,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
843
843
) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
844
844
match scalar {
845
845
Scalar :: Ptr ( ptr) => Ok ( ptr) ,
846
- _ => M :: int_to_ptr ( scalar. to_usize ( self ) ?, & self . extra )
846
+ _ => M :: int_to_ptr ( scalar. to_usize ( self ) ?, self )
847
847
}
848
848
}
849
849
@@ -854,7 +854,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
854
854
) -> InterpResult < ' tcx , u128 > {
855
855
match scalar. to_bits_or_ptr ( size, self ) {
856
856
Ok ( bits) => Ok ( bits) ,
857
- Err ( ptr) => Ok ( M :: ptr_to_int ( ptr, & self . extra ) ? as u128 )
857
+ Err ( ptr) => Ok ( M :: ptr_to_int ( ptr, self ) ? as u128 )
858
858
}
859
859
}
860
860
}
0 commit comments