@@ -78,7 +78,7 @@ impl GlobalStateInner {
7878 GlobalStateInner {
7979 int_to_ptr_map : Vec :: default ( ) ,
8080 base_addr : FxHashMap :: default ( ) ,
81- reuse : ReusePool :: new ( ) ,
81+ reuse : ReusePool :: new ( config . address_reuse_rate ) ,
8282 exposed : FxHashSet :: default ( ) ,
8383 next_base_addr : stack_addr,
8484 provenance_mode : config. provenance_mode ,
@@ -142,7 +142,11 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
142142 }
143143 }
144144
145- fn addr_from_alloc_id ( & self , alloc_id : AllocId , _kind : MemoryKind ) -> InterpResult < ' tcx , u64 > {
145+ fn addr_from_alloc_id (
146+ & self ,
147+ alloc_id : AllocId ,
148+ memory_kind : MemoryKind ,
149+ ) -> InterpResult < ' tcx , u64 > {
146150 let ecx = self . eval_context_ref ( ) ;
147151 let mut global_state = ecx. machine . alloc_addresses . borrow_mut ( ) ;
148152 let global_state = & mut * global_state;
@@ -161,7 +165,7 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
161165
162166 // This allocation does not have a base address yet, pick or reuse one.
163167 let base_addr = if let Some ( ( reuse_addr, clock) ) =
164- global_state. reuse . take_addr ( & mut * rng, size, align)
168+ global_state. reuse . take_addr ( & mut * rng, size, align, memory_kind )
165169 {
166170 if let Some ( data_race) = & ecx. machine . data_race {
167171 data_race. validate_lock_acquire ( & clock, ecx. get_active_thread ( ) ) ;
@@ -334,7 +338,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
334338}
335339
336340impl < ' mir , ' tcx > MiriMachine < ' mir , ' tcx > {
337- pub fn free_alloc_id ( & mut self , dead_id : AllocId , size : Size , align : Align ) {
341+ pub fn free_alloc_id ( & mut self , dead_id : AllocId , size : Size , align : Align , kind : MemoryKind ) {
338342 let global_state = self . alloc_addresses . get_mut ( ) ;
339343 let rng = self . rng . get_mut ( ) ;
340344
@@ -359,7 +363,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
359363 // `alloc_id_from_addr` any more.
360364 global_state. exposed . remove ( & dead_id) ;
361365 // Also remember this address for future reuse.
362- global_state. reuse . add_addr ( rng, addr, size, align, || {
366+ global_state. reuse . add_addr ( rng, addr, size, align, kind , || {
363367 let mut clock = concurrency:: VClock :: default ( ) ;
364368 if let Some ( data_race) = & self . data_race {
365369 data_race. validate_lock_release (
0 commit comments