@@ -436,45 +436,6 @@ impl MemoryCellClocks {
436
436
/// Evaluation context extensions.
437
437
impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for MiriEvalContext < ' mir , ' tcx > { }
438
438
pub trait EvalContextExt < ' mir , ' tcx : ' mir > : MiriEvalContextExt < ' mir , ' tcx > {
439
- /// Temporarily allow data-races to occur. This should only be used in
440
- /// one of these cases:
441
- /// - One of the appropriate `validate_atomic` functions will be called to
442
- /// to treat a memory access as atomic.
443
- /// - The memory being accessed should be treated as internal state, that
444
- /// cannot be accessed by the interpreted program.
445
- /// - Execution of the interpreted program execution has halted.
446
- #[ inline]
447
- fn allow_data_races_ref < R > ( & self , op : impl FnOnce ( & MiriEvalContext < ' mir , ' tcx > ) -> R ) -> R {
448
- let this = self . eval_context_ref ( ) ;
449
- if let Some ( data_race) = & this. machine . data_race {
450
- data_race. ongoing_action_data_race_free . set ( true ) ;
451
- }
452
- let result = op ( this) ;
453
- if let Some ( data_race) = & this. machine . data_race {
454
- data_race. ongoing_action_data_race_free . set ( false ) ;
455
- }
456
- result
457
- }
458
-
459
- /// Same as `allow_data_races_ref`, this temporarily disables any data-race detection and
460
- /// so should only be used for atomic operations or internal state that the program cannot
461
- /// access.
462
- #[ inline]
463
- fn allow_data_races_mut < R > (
464
- & mut self ,
465
- op : impl FnOnce ( & mut MiriEvalContext < ' mir , ' tcx > ) -> R ,
466
- ) -> R {
467
- let this = self . eval_context_mut ( ) ;
468
- if let Some ( data_race) = & this. machine . data_race {
469
- data_race. ongoing_action_data_race_free . set ( true ) ;
470
- }
471
- let result = op ( this) ;
472
- if let Some ( data_race) = & this. machine . data_race {
473
- data_race. ongoing_action_data_race_free . set ( false ) ;
474
- }
475
- result
476
- }
477
-
478
439
/// Atomic variant of read_scalar_at_offset.
479
440
fn read_scalar_at_offset_atomic (
480
441
& self ,
@@ -1044,6 +1005,45 @@ impl VClockAlloc {
1044
1005
1045
1006
impl < ' mir , ' tcx : ' mir > EvalContextPrivExt < ' mir , ' tcx > for MiriEvalContext < ' mir , ' tcx > { }
1046
1007
trait EvalContextPrivExt < ' mir , ' tcx : ' mir > : MiriEvalContextExt < ' mir , ' tcx > {
1008
+ /// Temporarily allow data-races to occur. This should only be used in
1009
+ /// one of these cases:
1010
+ /// - One of the appropriate `validate_atomic` functions will be called to
1011
+ /// to treat a memory access as atomic.
1012
+ /// - The memory being accessed should be treated as internal state, that
1013
+ /// cannot be accessed by the interpreted program.
1014
+ /// - Execution of the interpreted program execution has halted.
1015
+ #[ inline]
1016
+ fn allow_data_races_ref < R > ( & self , op : impl FnOnce ( & MiriEvalContext < ' mir , ' tcx > ) -> R ) -> R {
1017
+ let this = self . eval_context_ref ( ) ;
1018
+ if let Some ( data_race) = & this. machine . data_race {
1019
+ data_race. ongoing_action_data_race_free . set ( true ) ;
1020
+ }
1021
+ let result = op ( this) ;
1022
+ if let Some ( data_race) = & this. machine . data_race {
1023
+ data_race. ongoing_action_data_race_free . set ( false ) ;
1024
+ }
1025
+ result
1026
+ }
1027
+
1028
+ /// Same as `allow_data_races_ref`, this temporarily disables any data-race detection and
1029
+ /// so should only be used for atomic operations or internal state that the program cannot
1030
+ /// access.
1031
+ #[ inline]
1032
+ fn allow_data_races_mut < R > (
1033
+ & mut self ,
1034
+ op : impl FnOnce ( & mut MiriEvalContext < ' mir , ' tcx > ) -> R ,
1035
+ ) -> R {
1036
+ let this = self . eval_context_mut ( ) ;
1037
+ if let Some ( data_race) = & this. machine . data_race {
1038
+ data_race. ongoing_action_data_race_free . set ( true ) ;
1039
+ }
1040
+ let result = op ( this) ;
1041
+ if let Some ( data_race) = & this. machine . data_race {
1042
+ data_race. ongoing_action_data_race_free . set ( false ) ;
1043
+ }
1044
+ result
1045
+ }
1046
+
1047
1047
/// Generic atomic operation implementation
1048
1048
fn validate_atomic_op < A : Debug + Copy > (
1049
1049
& self ,
0 commit comments