@@ -107,7 +107,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
107107
108108 #[ inline]
109109 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 ) )
111111 }
112112
113113 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> {
140140 kind : MemoryKind < M :: MemoryKinds > ,
141141 ) -> Pointer < M :: PointerTag > {
142142 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 ) ;
144144 self . alloc_map . insert ( id, ( kind, alloc. into_owned ( ) ) ) ;
145145 Pointer :: from ( id) . with_tag ( tag)
146146 }
@@ -327,7 +327,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
327327 fn get_static_alloc (
328328 id : AllocId ,
329329 tcx : TyCtxtAt < ' tcx > ,
330- memory_extra : & M :: MemoryExtra ,
330+ memory : & Memory < ' mir , ' tcx , M > ,
331331 ) -> InterpResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag , M :: AllocExtra > > > {
332332 let alloc = tcx. alloc_map . lock ( ) . get ( id) ;
333333 let alloc = match alloc {
@@ -374,7 +374,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
374374 id, // always use the ID we got as input, not the "hidden" one.
375375 alloc,
376376 M :: STATIC_KIND . map ( MemoryKind :: Machine ) ,
377- memory_extra
377+ memory
378378 ) . 0 )
379379 }
380380
@@ -387,7 +387,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
387387 // `get_static_alloc` that we can actually use directly without inserting anything anywhere.
388388 // So the error type is `InterpResult<'tcx, &Allocation<M::PointerTag>>`.
389389 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 ) ?;
391391 match alloc {
392392 Cow :: Borrowed ( alloc) => {
393393 // 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> {
416416 id : AllocId ,
417417 ) -> InterpResult < ' tcx , & mut Allocation < M :: PointerTag , M :: AllocExtra > > {
418418 let tcx = self . tcx ;
419- let memory_extra = & self . extra ;
419+ let alloc = Self :: get_static_alloc ( id , tcx , & self ) ;
420420 let a = self . alloc_map . get_mut_or ( id, || {
421421 // Need to make a copy, even if `get_static_alloc` is able
422422 // to give us a cheap reference.
423- let alloc = Self :: get_static_alloc ( id , tcx , memory_extra ) ?;
423+ let alloc = alloc ?;
424424 if alloc. mutability == Mutability :: Immutable {
425425 return err ! ( ModifiedConstantMemory ) ;
426426 }
@@ -843,7 +843,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
843843 ) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
844844 match scalar {
845845 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 )
847847 }
848848 }
849849
@@ -854,7 +854,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
854854 ) -> InterpResult < ' tcx , u128 > {
855855 match scalar. to_bits_or_ptr ( size, self ) {
856856 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 )
858858 }
859859 }
860860}
0 commit comments