@@ -534,7 +534,7 @@ pub struct MiriMachine<'tcx> {
534534
535535 /// The allocator used for the machine's `AllocBytes` in native-libs mode.
536536 #[ cfg( target_os = "linux" ) ]
537- pub ( crate ) allocator : Rc < RefCell < crate :: alloc:: isolated_alloc:: IsolatedAlloc > > ,
537+ pub ( crate ) allocator : Option < Rc < RefCell < crate :: alloc:: isolated_alloc:: IsolatedAlloc > > > ,
538538
539539 /// The allocation IDs to report when they are being allocated
540540 /// (helps for debugging memory leaks and use after free bugs).
@@ -642,8 +642,7 @@ impl<'tcx> MiriMachine<'tcx> {
642642 let path = Path :: new ( out) . join ( filename) ;
643643 measureme:: Profiler :: new ( path) . expect ( "Couldn't create `measureme` profiler" )
644644 } ) ;
645- let seed = config. seed . unwrap_or ( 0 ) ;
646- let rng = StdRng :: seed_from_u64 ( seed) ;
645+ let rng = StdRng :: seed_from_u64 ( config. seed . unwrap_or ( 0 ) ) ;
647646 let borrow_tracker = config. borrow_tracker . map ( |bt| bt. instantiate_global_state ( config) ) ;
648647 let data_race = if config. genmc_mode {
649648 // `genmc_ctx` persists across executions, so we don't create a new one here.
@@ -721,7 +720,9 @@ impl<'tcx> MiriMachine<'tcx> {
721720 extern_statics : FxHashMap :: default ( ) ,
722721 rng : RefCell :: new ( rng) ,
723722 #[ cfg( target_os = "linux" ) ]
724- allocator : Rc :: new ( RefCell :: new ( crate :: alloc:: isolated_alloc:: IsolatedAlloc :: new ( ) ) ) ,
723+ allocator : if config. native_lib . is_some ( ) {
724+ Some ( Rc :: new ( RefCell :: new ( crate :: alloc:: isolated_alloc:: IsolatedAlloc :: new ( ) ) ) )
725+ } else { None } ,
725726 tracked_alloc_ids : config. tracked_alloc_ids . clone ( ) ,
726727 track_alloc_accesses : config. track_alloc_accesses ,
727728 check_alignment : config. check_alignment ,
@@ -1817,10 +1818,9 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
18171818 use crate :: alloc:: MiriAllocParams ;
18181819
18191820 #[ cfg( target_os = "linux" ) ]
1820- if self . native_lib . is_some ( ) {
1821- MiriAllocParams :: Isolated ( self . allocator . clone ( ) )
1822- } else {
1823- MiriAllocParams :: Global
1821+ match & self . allocator {
1822+ Some ( alloc) => MiriAllocParams :: Isolated ( alloc. clone ( ) ) ,
1823+ None => MiriAllocParams :: Global ,
18241824 }
18251825 #[ cfg( not( target_os = "linux" ) ) ]
18261826 MiriAllocParams :: Global
0 commit comments