mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
Erase tag from futex pointers.
This commit is contained in:
@@ -16,7 +16,7 @@ pub fn futex<'tcx>(
|
||||
|
||||
this.memory.check_ptr_access(addr, Size::from_bytes(4), Align::from_bytes(4).unwrap())?;
|
||||
|
||||
let addr = addr.assert_ptr();
|
||||
let addr = addr.assert_ptr().erase_tag();
|
||||
|
||||
let thread = this.get_active_thread();
|
||||
|
||||
|
||||
+3
-3
@@ -115,7 +115,7 @@ pub(super) struct SynchronizationState {
|
||||
mutexes: IndexVec<MutexId, Mutex>,
|
||||
rwlocks: IndexVec<RwLockId, RwLock>,
|
||||
condvars: IndexVec<CondvarId, Condvar>,
|
||||
futexes: HashMap<Pointer<stacked_borrows::Tag>, Futex>,
|
||||
futexes: HashMap<Pointer, Futex>,
|
||||
}
|
||||
|
||||
// Private extension trait for local helper methods
|
||||
@@ -418,14 +418,14 @@ fn condvar_remove_waiter(&mut self, id: CondvarId, thread: ThreadId) {
|
||||
this.machine.threads.sync.condvars[id].waiters.retain(|waiter| waiter.thread != thread);
|
||||
}
|
||||
|
||||
fn futex_wait(&mut self, addr: Pointer<stacked_borrows::Tag>, thread: ThreadId) {
|
||||
fn futex_wait(&mut self, addr: Pointer, thread: ThreadId) {
|
||||
let this = self.eval_context_mut();
|
||||
let waiters = &mut this.machine.threads.sync.futexes.entry(addr).or_default().waiters;
|
||||
assert!(waiters.iter().all(|waiter| waiter.thread != thread), "thread is already waiting");
|
||||
waiters.push_back(FutexWaiter { thread });
|
||||
}
|
||||
|
||||
fn futex_wake(&mut self, addr: Pointer<stacked_borrows::Tag>) -> Option<ThreadId> {
|
||||
fn futex_wake(&mut self, addr: Pointer) -> Option<ThreadId> {
|
||||
let this = self.eval_context_mut();
|
||||
let waiters = &mut this.machine.threads.sync.futexes.get_mut(&addr)?.waiters;
|
||||
waiters.pop_front().map(|waiter| waiter.thread)
|
||||
|
||||
Reference in New Issue
Block a user