weak_memory::EvalContextExt as _,
};
-pub type AllocExtra = VClockAlloc;
+pub type AllocState = VClockAlloc;
/// Valid atomic read-write orderings, alias of atomic::Ordering (not non-exhaustive).
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
/// Error returned by finding a data race
/// should be elaborated upon.
-#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct DataRace;
/// Externally stored memory cell clocks
}
impl VisitTags for VClockAlloc {
- fn visit_tags(&self, _visit: &mut dyn FnMut(SbTag)) {
+ fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
// No tags here.
}
}
&self,
alloc_id: AllocId,
range: AllocRange,
- global: &GlobalState,
- thread_mgr: &ThreadManager<'_, '_>,
+ machine: &MiriMachine<'_, '_>,
) -> InterpResult<'tcx> {
+ let global = machine.data_race.as_ref().unwrap();
if global.race_detecting() {
- let (index, clocks) = global.current_thread_state(thread_mgr);
+ let (index, clocks) = global.current_thread_state(&machine.threads);
let mut alloc_ranges = self.alloc_ranges.borrow_mut();
for (offset, range) in alloc_ranges.iter_mut(range.start, range.size) {
if let Err(DataRace) = range.read_race_detect(&clocks, index) {
// Report data-race.
return Self::report_data_race(
global,
- thread_mgr,
+ &machine.threads,
range,
"Read",
false,
alloc_id: AllocId,
range: AllocRange,
write_type: WriteType,
- global: &mut GlobalState,
- thread_mgr: &ThreadManager<'_, '_>,
+ machine: &mut MiriMachine<'_, '_>,
) -> InterpResult<'tcx> {
+ let global = machine.data_race.as_mut().unwrap();
if global.race_detecting() {
- let (index, clocks) = global.current_thread_state(thread_mgr);
+ let (index, clocks) = global.current_thread_state(&machine.threads);
for (offset, range) in self.alloc_ranges.get_mut().iter_mut(range.start, range.size) {
if let Err(DataRace) = range.write_race_detect(&clocks, index, write_type) {
// Report data-race
return Self::report_data_race(
global,
- thread_mgr,
+ &machine.threads,
range,
write_type.get_descriptor(),
false,
&mut self,
alloc_id: AllocId,
range: AllocRange,
- global: &mut GlobalState,
- thread_mgr: &ThreadManager<'_, '_>,
+ machine: &mut MiriMachine<'_, '_>,
) -> InterpResult<'tcx> {
- self.unique_access(alloc_id, range, WriteType::Write, global, thread_mgr)
+ self.unique_access(alloc_id, range, WriteType::Write, machine)
}
/// Detect data-races for an unsynchronized deallocate operation, will not perform
&mut self,
alloc_id: AllocId,
range: AllocRange,
- global: &mut GlobalState,
- thread_mgr: &ThreadManager<'_, '_>,
+ machine: &mut MiriMachine<'_, '_>,
) -> InterpResult<'tcx> {
- self.unique_access(alloc_id, range, WriteType::Deallocate, global, thread_mgr)
+ self.unique_access(alloc_id, range, WriteType::Deallocate, machine)
}
}
}
impl VisitTags for GlobalState {
- fn visit_tags(&self, _visit: &mut dyn FnMut(SbTag)) {
+ fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
// We don't have any tags.
}
}