Skip to content

Commit

Permalink
Fix & rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JCTyblaidd committed Nov 2, 2020
1 parent ed32b26 commit cae4302
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let mut current_state = alloc.global.current_thread_state_mut();
if atomic == AtomicReadOp::Relaxed {
// Perform relaxed atomic load
for range in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
range.load_relaxed(&mut *current_state);
}
}else{
// Perform acquire(or seq-cst) atomic load
for range in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
range.acquire(&mut *current_state);
}
}

// Log changes to atomic memory
if log::log_enabled!(log::Level::Trace) {
for range in alloc.alloc_ranges.get_mut().iter(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter(offset, size) {
log::trace!(
" updated atomic memory({:?}, offset={}, size={}) to {:#?}",
place.ptr.assert_ptr().alloc_id, offset.bytes(), size.bytes(),
Expand Down Expand Up @@ -227,19 +227,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

if atomic == AtomicWriteOp::Relaxed {
// Perform relaxed atomic store
for range in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
range.store_relaxed(&mut *current_state, current_thread);
}
}else{
// Perform release(or seq-cst) atomic store
for range in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
range.release(&mut *current_state, current_thread);
}
}

// Log changes to atomic memory
if log::log_enabled!(log::Level::Trace) {
for range in alloc.alloc_ranges.get_mut().iter(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter(offset, size) {
log::trace!(
" updated atomic memory({:?}, offset={}, size={}) to {:#?}",
place.ptr.assert_ptr().alloc_id, offset.bytes(), size.bytes(),
Expand Down Expand Up @@ -279,7 +279,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

let acquire = matches!(atomic, Acquire | AcqRel | SeqCst);
let release = matches!(atomic, Release | AcqRel | SeqCst);
for range in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter_mut(offset, size) {
//FIXME: this is probably still slightly wrong due to the quirks
// in the c++11 memory model
if acquire {
Expand All @@ -298,7 +298,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

// Log changes to atomic memory
if log::log_enabled!(log::Level::Trace) {
for range in alloc.alloc_ranges.get_mut().iter(offset, size) {
for (_,range) in alloc.alloc_ranges.get_mut().iter(offset, size) {
log::trace!(
" updated atomic memory({:?}, offset={}, size={}) to {:#?}",
place.ptr.assert_ptr().alloc_id, offset.bytes(), size.bytes(),
Expand Down Expand Up @@ -733,7 +733,7 @@ impl VClockAlloc {
// The alloc-ranges are not split, however changes are not going to be made
// to the ranges being tested, so this is ok
let mut alloc_ranges = self.alloc_ranges.borrow_mut();
for range in alloc_ranges.iter_mut(pointer.offset, len) {
for (_,range) in alloc_ranges.iter_mut(pointer.offset, len) {
if range.read_race_detect(&*current_state, current_thread) {
// Report data-race
return Self::report_data_race(
Expand All @@ -754,7 +754,7 @@ impl VClockAlloc {
if self.global.multi_threaded.get() {
let current_thread = self.global.current_thread();
let current_state = self.global.current_thread_state();
for range in self.alloc_ranges.get_mut().iter_mut(pointer.offset, len) {
for (_,range) in self.alloc_ranges.get_mut().iter_mut(pointer.offset, len) {
if range.write_race_detect(&*current_state, current_thread) {
// Report data-race
return Self::report_data_race(
Expand All @@ -775,7 +775,7 @@ impl VClockAlloc {
if self.global.multi_threaded.get() {
let current_thread = self.global.current_thread();
let current_state = self.global.current_thread_state();
for range in self.alloc_ranges.get_mut().iter_mut(pointer.offset, len) {
for (_,range) in self.alloc_ranges.get_mut().iter_mut(pointer.offset, len) {
if range.write_race_detect(&*current_state, current_thread) {
// Report data-race
return Self::report_data_race(
Expand Down

0 comments on commit cae4302

Please sign in to comment.