diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-22 18:03:40 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2019-01-15 10:39:49 +0100 |
| commit | 8ef7413f23eca3921aa3ca1d0ebf72abd4a9eef0 (patch) | |
| tree | 3c8431d8592ece7d73163c070e14e34087e90b8a /src/librustc_data_structures | |
| parent | 33e6df4b62237af312bf6e3f40a97f5bdc94949a (diff) | |
| download | rust-8ef7413f23eca3921aa3ca1d0ebf72abd4a9eef0.tar.gz rust-8ef7413f23eca3921aa3ca1d0ebf72abd4a9eef0.zip | |
Optimize try_mark_green and eliminate the lock on dep node colors
Diffstat (limited to 'src/librustc_data_structures')
| -rw-r--r-- | src/librustc_data_structures/sync.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index f9f94f0be7b..0253eef4dfa 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -70,6 +70,7 @@ cfg_if! { pub struct Atomic<T: Copy>(Cell<T>); impl<T: Copy> Atomic<T> { + #[inline] pub fn new(v: T) -> Self { Atomic(Cell::new(v)) } @@ -80,10 +81,12 @@ cfg_if! { self.0.into_inner() } + #[inline] pub fn load(&self, _: Ordering) -> T { self.0.get() } + #[inline] pub fn store(&self, val: T, _: Ordering) { self.0.set(val) } @@ -118,6 +121,7 @@ cfg_if! { pub type AtomicUsize = Atomic<usize>; pub type AtomicBool = Atomic<bool>; + pub type AtomicU32 = Atomic<u32>; pub type AtomicU64 = Atomic<u64>; pub use self::serial_join as join; @@ -223,7 +227,7 @@ cfg_if! { pub use parking_lot::MutexGuard as LockGuard; pub use parking_lot::MappedMutexGuard as MappedLockGuard; - pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU64}; + pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64}; pub use std::sync::Arc as Lrc; pub use std::sync::Weak as Weak; |
