Lines Matching full:shard
37 pub(crate) struct Shard<T, C: cfg::Config> { struct
38 /// The shard's parent thread ID.
42 /// These are only ever accessed from this shard's thread, so they are
46 /// The shared state for each page in this shard.
59 struct Ptr<T, C: cfg::Config>(AtomicPtr<alloc::Track<Shard<T, C>>>); argument
64 // === impl Shard ===
66 impl<T, C> Shard<T, C> impl
102 impl<T, C> Shard<Option<T>, C> impl
106 /// Remove an item on the shard's local thread.
118 /// Remove an item, while on a different thread from the shard's local thread.
159 impl<T, C> Shard<T, C> implementation
256 impl<T: fmt::Debug, C: cfg::Config> fmt::Debug for Shard<T, C> { implementation
258 let mut d = f.debug_struct("Shard"); in fmt()
285 pub(crate) fn get(&self, idx: usize) -> Option<&Shard<T, C>> { in get()
286 test_println!("-> get shard={}", idx); in get()
291 pub(crate) fn current(&self) -> (Tid<C>, &Shard<T, C>) { in current()
304 let shard = self.shards[idx].load(Relaxed).unwrap_or_else(|| { in current() localVariable
305 let ptr = Box::into_raw(Box::new(alloc::Track::new(Shard::new(idx)))); in current()
306 test_println!("-> allocated new shard for index {} at {:p}", idx, ptr); in current()
322 (tid, shard) in current()
337 for shard in &self.shards[0..=max] { in drop()
339 let ptr = shard.0.load(Acquire); in drop()
343 let shard = unsafe { in drop() localVariable
345 // deallocated, and we have exclusive access to the shard array, in drop()
349 drop(shard) in drop()
358 for shard in &self.shards[0..=max] { in fmt()
359 let ptr = shard.0.load(Acquire); in fmt()
360 if let Some(shard) = ptr::NonNull::new(ptr) { in fmt()
361 set.entry(&format_args!("{:p}", ptr), unsafe { shard.as_ref() }); in fmt()
379 fn load(&self, order: Ordering) -> Option<&Shard<T, C>> { in load()
388 // reference to the shard pointer, which (morally, if not actually) in load()
389 // owns the shard. The shard is only deallocated when the shard in load()
402 fn set(&self, new: *mut alloc::Track<Shard<T, C>>) { in set()
405 .expect("a shard can only be inserted by the thread that owns it, this is a bug!"); in set()
416 type Item = &'a Shard<T, C>;
421 // allocated shard. Some threads may have accessed the slab in next()
423 // they may have never allocated a shard. in next()
426 if let Some(shard) = next?.load(Acquire) { in next()
428 return Some(shard); in next()