@@ -47,9 +47,6 @@ pub enum MemoryKind<T> {
4747// `Memory` has to depend on the `Machine` because some of its operations
4848// (e.g. `get`) call a `Machine` hook.
4949pub struct Memory < ' a , ' mir , ' tcx : ' a + ' mir , M : Machine < ' a , ' mir , ' tcx > > {
50- /// Additional data required by the Machine
51- pub data : M :: MemoryData ,
52-
5350 /// Allocations local to this instance of the miri engine. The kind
5451 /// helps ensure that the same mechanism is used for allocation and
5552 /// deallocation. When an allocation is not found here, it is a
@@ -91,11 +88,9 @@ impl<'a, 'b, 'c, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout
9188// carefully copy only the reachable parts.
9289impl < ' a , ' mir , ' tcx : ' a + ' mir , M : Machine < ' a , ' mir , ' tcx > >
9390 Clone for Memory < ' a , ' mir , ' tcx , M >
94- where M :: MemoryData : Clone
9591{
9692 fn clone ( & self ) -> Self {
9793 Memory {
98- data : self . data . clone ( ) ,
9994 alloc_map : self . alloc_map . clone ( ) ,
10095 dead_alloc_map : self . dead_alloc_map . clone ( ) ,
10196 tcx : self . tcx ,
@@ -104,9 +99,8 @@ impl<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>>
10499}
105100
106101impl < ' a , ' mir , ' tcx , M : Machine < ' a , ' mir , ' tcx > > Memory < ' a , ' mir , ' tcx , M > {
107- pub fn new ( tcx : TyCtxtAt < ' a , ' tcx , ' tcx > , data : M :: MemoryData ) -> Self {
102+ pub fn new ( tcx : TyCtxtAt < ' a , ' tcx , ' tcx > ) -> Self {
108103 Memory {
109- data,
110104 alloc_map : Default :: default ( ) ,
111105 dead_alloc_map : FxHashMap :: default ( ) ,
112106 tcx,
@@ -123,7 +117,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
123117
124118 pub fn allocate_with (
125119 & mut self ,
126- alloc : Allocation < M :: PointerTag > ,
120+ alloc : Allocation < M :: PointerTag , M :: AllocExtra > ,
127121 kind : MemoryKind < M :: MemoryKinds > ,
128122 ) -> EvalResult < ' tcx , AllocId > {
129123 let id = self . tcx . alloc_map . lock ( ) . reserve ( ) ;
@@ -334,7 +328,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
334328 fn get_static_alloc (
335329 tcx : TyCtxtAt < ' a , ' tcx , ' tcx > ,
336330 id : AllocId ,
337- ) -> EvalResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag > > > {
331+ ) -> EvalResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag , M :: AllocExtra > > > {
338332 let alloc = tcx. alloc_map . lock ( ) . get ( id) ;
339333 let def_id = match alloc {
340334 Some ( AllocType :: Memory ( mem) ) => {
@@ -376,7 +370,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
376370 } )
377371 }
378372
379- pub fn get ( & self , id : AllocId ) -> EvalResult < ' tcx , & Allocation < M :: PointerTag > > {
373+ pub fn get ( & self , id : AllocId ) -> EvalResult < ' tcx , & Allocation < M :: PointerTag , M :: AllocExtra > > {
380374 // The error type of the inner closure here is somewhat funny. We have two
381375 // ways of "erroring": An actual error, or because we got a reference from
382376 // `get_static_alloc` that we can actually use directly without inserting anything anywhere.
@@ -409,7 +403,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
409403 pub fn get_mut (
410404 & mut self ,
411405 id : AllocId ,
412- ) -> EvalResult < ' tcx , & mut Allocation < M :: PointerTag > > {
406+ ) -> EvalResult < ' tcx , & mut Allocation < M :: PointerTag , M :: AllocExtra > > {
413407 let tcx = self . tcx ;
414408 let a = self . alloc_map . get_mut_or ( id, || {
415409 // Need to make a copy, even if `get_static_alloc` is able
@@ -482,12 +476,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
482476 self . dump_allocs ( vec ! [ id] ) ;
483477 }
484478
485- fn dump_alloc_helper < Tag > (
479+ fn dump_alloc_helper < Tag , Extra > (
486480 & self ,
487481 allocs_seen : & mut FxHashSet < AllocId > ,
488482 allocs_to_print : & mut VecDeque < AllocId > ,
489483 mut msg : String ,
490- alloc : & Allocation < Tag > ,
484+ alloc : & Allocation < Tag , Extra > ,
491485 extra : String ,
492486 ) {
493487 use std:: fmt:: Write ;
@@ -687,8 +681,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
687681/// Interning (for CTFE)
688682impl < ' a , ' mir , ' tcx , M > Memory < ' a , ' mir , ' tcx , M >
689683where
690- M : Machine < ' a , ' mir , ' tcx , PointerTag =( ) > ,
691- M :: MemoryMap : AllocMap < AllocId , ( MemoryKind < M :: MemoryKinds > , Allocation < ( ) > ) > ,
684+ M : Machine < ' a , ' mir , ' tcx , PointerTag =( ) , AllocExtra = ( ) > ,
685+ M :: MemoryMap : AllocMap < AllocId , ( MemoryKind < M :: MemoryKinds > , Allocation ) > ,
692686{
693687 /// mark an allocation as static and initialized, either mutable or not
694688 pub fn intern_static (
0 commit comments