@@ -534,7 +534,7 @@ pub struct MiriMachine<'tcx> {
534
534
535
535
/// The allocator used for the machine's `AllocBytes` in native-libs mode.
536
536
#[ 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 > > > ,
538
538
539
539
/// The allocation IDs to report when they are being allocated
540
540
/// (helps for debugging memory leaks and use after free bugs).
@@ -642,8 +642,7 @@ impl<'tcx> MiriMachine<'tcx> {
642
642
let path = Path :: new ( out) . join ( filename) ;
643
643
measureme:: Profiler :: new ( path) . expect ( "Couldn't create `measureme` profiler" )
644
644
} ) ;
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 ) ) ;
647
646
let borrow_tracker = config. borrow_tracker . map ( |bt| bt. instantiate_global_state ( config) ) ;
648
647
let data_race = if config. genmc_mode {
649
648
// `genmc_ctx` persists across executions, so we don't create a new one here.
@@ -721,7 +720,9 @@ impl<'tcx> MiriMachine<'tcx> {
721
720
extern_statics : FxHashMap :: default ( ) ,
722
721
rng : RefCell :: new ( rng) ,
723
722
#[ 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 } ,
725
726
tracked_alloc_ids : config. tracked_alloc_ids . clone ( ) ,
726
727
track_alloc_accesses : config. track_alloc_accesses ,
727
728
check_alignment : config. check_alignment ,
@@ -1817,10 +1818,9 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
1817
1818
use crate :: alloc:: MiriAllocParams ;
1818
1819
1819
1820
#[ 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 ,
1824
1824
}
1825
1825
#[ cfg( not( target_os = "linux" ) ) ]
1826
1826
MiriAllocParams :: Global
0 commit comments