@@ -432,9 +432,8 @@ pub struct ThreadManager<'tcx> {
432432 ///
433433 /// Note that this vector also contains terminated threads.
434434 threads : IndexVec < ThreadId , Thread < ' tcx > > ,
435- /// A mapping from a thread-local static to an allocation id of a thread
436- /// specific allocation.
437- thread_local_alloc_ids : FxHashMap < ( DefId , ThreadId ) , Pointer < Provenance > > ,
435+ /// A mapping from a thread-local static to the thread specific allocation.
436+ thread_local_allocs : FxHashMap < ( DefId , ThreadId ) , StrictPointer > ,
438437 /// A flag that indicates that we should change the active thread.
439438 yield_active_thread : bool ,
440439}
@@ -443,15 +442,15 @@ impl VisitProvenance for ThreadManager<'_> {
443442 fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
444443 let ThreadManager {
445444 threads,
446- thread_local_alloc_ids ,
445+ thread_local_allocs ,
447446 active_thread : _,
448447 yield_active_thread : _,
449448 } = self ;
450449
451450 for thread in threads {
452451 thread. visit_provenance ( visit) ;
453452 }
454- for ptr in thread_local_alloc_ids . values ( ) {
453+ for ptr in thread_local_allocs . values ( ) {
455454 ptr. visit_provenance ( visit) ;
456455 }
457456 }
@@ -465,7 +464,7 @@ impl<'tcx> Default for ThreadManager<'tcx> {
465464 Self {
466465 active_thread : ThreadId :: MAIN_THREAD ,
467466 threads,
468- thread_local_alloc_ids : Default :: default ( ) ,
467+ thread_local_allocs : Default :: default ( ) ,
469468 yield_active_thread : false ,
470469 }
471470 }
@@ -487,16 +486,16 @@ impl<'tcx> ThreadManager<'tcx> {
487486
488487 /// Check if we have an allocation for the given thread local static for the
489488 /// active thread.
490- fn get_thread_local_alloc_id ( & self , def_id : DefId ) -> Option < Pointer < Provenance > > {
491- self . thread_local_alloc_ids . get ( & ( def_id, self . active_thread ) ) . cloned ( )
489+ fn get_thread_local_alloc_id ( & self , def_id : DefId ) -> Option < StrictPointer > {
490+ self . thread_local_allocs . get ( & ( def_id, self . active_thread ) ) . cloned ( )
492491 }
493492
494493 /// Set the pointer for the allocation of the given thread local
495494 /// static for the active thread.
496495 ///
497496 /// Panics if a thread local is initialized twice for the same thread.
498- fn set_thread_local_alloc ( & mut self , def_id : DefId , ptr : Pointer < Provenance > ) {
499- self . thread_local_alloc_ids . try_insert ( ( def_id, self . active_thread ) , ptr) . unwrap ( ) ;
497+ fn set_thread_local_alloc ( & mut self , def_id : DefId , ptr : StrictPointer ) {
498+ self . thread_local_allocs . try_insert ( ( def_id, self . active_thread ) , ptr) . unwrap ( ) ;
500499 }
501500
502501 /// Borrow the stack of the active thread.
@@ -848,7 +847,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
848847 fn get_or_create_thread_local_alloc (
849848 & mut self ,
850849 def_id : DefId ,
851- ) -> InterpResult < ' tcx , Pointer < Provenance > > {
850+ ) -> InterpResult < ' tcx , StrictPointer > {
852851 let this = self . eval_context_mut ( ) ;
853852 let tcx = this. tcx ;
854853 if let Some ( old_alloc) = this. machine . threads . get_thread_local_alloc_id ( def_id) {
@@ -878,7 +877,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
878877 fn start_regular_thread (
879878 & mut self ,
880879 thread : Option < MPlaceTy < ' tcx > > ,
881- start_routine : Pointer < Option < Provenance > > ,
880+ start_routine : Pointer ,
882881 start_abi : Abi ,
883882 func_arg : ImmTy < ' tcx > ,
884883 ret_layout : TyAndLayout < ' tcx > ,
@@ -947,18 +946,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
947946 let gone_thread = this. active_thread ( ) ;
948947 {
949948 let mut free_tls_statics = Vec :: new ( ) ;
950- this. machine . threads . thread_local_alloc_ids . retain (
951- |& ( _def_id, thread) , & mut alloc_id| {
952- if thread != gone_thread {
953- // A different thread, keep this static around.
954- return true ;
955- }
956- // Delete this static from the map and from memory.
957- // We cannot free directly here as we cannot use `?` in this context.
958- free_tls_statics. push ( alloc_id) ;
959- false
960- } ,
961- ) ;
949+ this. machine . threads . thread_local_allocs . retain ( |& ( _def_id, thread) , & mut alloc_id| {
950+ if thread != gone_thread {
951+ // A different thread, keep this static around.
952+ return true ;
953+ }
954+ // Delete this static from the map and from memory.
955+ // We cannot free directly here as we cannot use `?` in this context.
956+ free_tls_statics. push ( alloc_id) ;
957+ false
958+ } ) ;
962959 // Now free the TLS statics.
963960 for ptr in free_tls_statics {
964961 match tls_alloc_action {
0 commit comments