@@ -838,18 +838,18 @@ impl VClockAlloc {
838838 & self ,
839839 alloc_id : AllocId ,
840840 range : AllocRange ,
841- global : & GlobalState ,
842- thread_mgr : & ThreadManager < ' _ , ' _ > ,
841+ machine : & MiriMachine < ' _ , ' _ > ,
843842 ) -> InterpResult < ' tcx > {
843+ let global = machine. data_race . as_ref ( ) . unwrap ( ) ;
844844 if global. race_detecting ( ) {
845- let ( index, clocks) = global. current_thread_state ( thread_mgr ) ;
845+ let ( index, clocks) = global. current_thread_state ( & machine . threads ) ;
846846 let mut alloc_ranges = self . alloc_ranges . borrow_mut ( ) ;
847847 for ( offset, range) in alloc_ranges. iter_mut ( range. start , range. size ) {
848848 if let Err ( DataRace ) = range. read_race_detect ( & clocks, index) {
849849 // Report data-race.
850850 return Self :: report_data_race (
851851 global,
852- thread_mgr ,
852+ & machine . threads ,
853853 range,
854854 "Read" ,
855855 false ,
@@ -869,17 +869,17 @@ impl VClockAlloc {
869869 alloc_id : AllocId ,
870870 range : AllocRange ,
871871 write_type : WriteType ,
872- global : & mut GlobalState ,
873- thread_mgr : & ThreadManager < ' _ , ' _ > ,
872+ machine : & mut MiriMachine < ' _ , ' _ > ,
874873 ) -> InterpResult < ' tcx > {
874+ let global = machine. data_race . as_mut ( ) . unwrap ( ) ;
875875 if global. race_detecting ( ) {
876- let ( index, clocks) = global. current_thread_state ( thread_mgr ) ;
876+ let ( index, clocks) = global. current_thread_state ( & machine . threads ) ;
877877 for ( offset, range) in self . alloc_ranges . get_mut ( ) . iter_mut ( range. start , range. size ) {
878878 if let Err ( DataRace ) = range. write_race_detect ( & clocks, index, write_type) {
879879 // Report data-race
880880 return Self :: report_data_race (
881881 global,
882- thread_mgr ,
882+ & machine . threads ,
883883 range,
884884 write_type. get_descriptor ( ) ,
885885 false ,
@@ -901,10 +901,9 @@ impl VClockAlloc {
901901 & mut self ,
902902 alloc_id : AllocId ,
903903 range : AllocRange ,
904- global : & mut GlobalState ,
905- thread_mgr : & ThreadManager < ' _ , ' _ > ,
904+ machine : & mut MiriMachine < ' _ , ' _ > ,
906905 ) -> InterpResult < ' tcx > {
907- self . unique_access ( alloc_id, range, WriteType :: Write , global , thread_mgr )
906+ self . unique_access ( alloc_id, range, WriteType :: Write , machine )
908907 }
909908
910909 /// Detect data-races for an unsynchronized deallocate operation, will not perform
@@ -915,10 +914,9 @@ impl VClockAlloc {
915914 & mut self ,
916915 alloc_id : AllocId ,
917916 range : AllocRange ,
918- global : & mut GlobalState ,
919- thread_mgr : & ThreadManager < ' _ , ' _ > ,
917+ machine : & mut MiriMachine < ' _ , ' _ > ,
920918 ) -> InterpResult < ' tcx > {
921- self . unique_access ( alloc_id, range, WriteType :: Deallocate , global , thread_mgr )
919+ self . unique_access ( alloc_id, range, WriteType :: Deallocate , machine )
922920 }
923921}
924922
0 commit comments