Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
max-heller committed Jul 8, 2023
1 parent 3cec209 commit 23ad36d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/concurrency/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,23 +1070,26 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
thread.state = ThreadState::Terminated;

let current_span = this.machine.current_span();
let thread_local_allocations = this.machine.threads.thread_terminated(
this.machine.data_race.as_mut(),
current_span,
);
let thread_local_allocations =
this.machine.threads.thread_terminated(this.machine.data_race.as_mut(), current_span);
match this.get_active_thread_id() {
// For main thread, add thread-local statics to static roots and skip deallocating
// backing memory
ThreadId(0) => for ptr in thread_local_allocations {
if let Some(alloc) = ptr.provenance.get_alloc_id() {
trace!("Main thread thread-local static stored as static root: {:?}", alloc);
this.machine.static_roots.push(alloc);
}
}
ThreadId(0) =>
for ptr in thread_local_allocations {
if let Some(alloc) = ptr.provenance.get_alloc_id() {
trace!(
"Main thread thread-local static stored as static root: {:?}",
alloc
);
this.machine.static_roots.push(alloc);
}
},
// Deallocate backing memory of thread-local statics
ThreadId(_) => for ptr in thread_local_allocations {
this.deallocate_ptr(ptr.into(), None, MiriMemoryKind::Tls.into())?;
}
ThreadId(_) =>
for ptr in thread_local_allocations {
this.deallocate_ptr(ptr.into(), None, MiriMemoryKind::Tls.into())?;
},
}
Ok(())
}
Expand Down

0 comments on commit 23ad36d

Please sign in to comment.