instruction stringlengths 195 298 | thought stringlengths 277 39.8k | response stringlengths 201 18k |
|---|---|---|
TARGET ENTITY: no_atomic.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [no_atomic.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | // This file is @generated by no_atomic.sh.
// It is not intended for manual editing.
const NO_ATOMIC: &[&str] = &[
"armv4t-none-eabi",
"armv5te-none-eabi",
"bpfeb-unknown-none",
"bpfel-unknown-none",
"mipsel-sony-psx",
"msp430-none-elf",
"thumbv4t-none-eabi",
"thumbv5te-none-eabi",
];
|
TARGET ENTITY: build-common.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [build-common.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | // The target triplets have the form of 'arch-vendor-system'.
//
// When building for Linux (e.g. the 'system' part is
// 'linux-something'), replace the vendor with 'unknown'
// so that mapping to rust standard targets happens correctly.
fn convert_custom_linux_target(target: String) -> String {
let mut parts: Vec... |
TARGET ENTITY: build.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [build.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | // The rustc-cfg listed below are considered public API, but it is *unstable*
// and outside of the normal semver guarantees:
//
// - `crossbeam_no_atomic`
// Assume the target does *not* support any atomic operations.
// This is usually detected automatically by the build script, but you may
// need to ... |
TARGET ENTITY: parker.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [parker.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via ... | use std::{thread::sleep, time::Duration};
use crossbeam_utils::{
sync::{Parker, UnparkReason},
thread,
};
#[test]
fn park_timeout_unpark_before() {
let p = Parker::new();
for _ in 0..10 {
p.unparker().unpark();
assert_eq!(
p.park_timeout(Duration::from_millis(u32::MAX as u6... |
TARGET ENTITY: wait_group.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [wait_group.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | use std::{sync::mpsc, thread, time::Duration};
use crossbeam_utils::sync::WaitGroup;
const THREADS: usize = 10;
#[test]
fn wait() {
let wg = WaitGroup::new();
let (tx, rx) = mpsc::channel();
for _ in 0..THREADS {
let wg = wg.clone();
let tx = tx.clone();
thread::spawn(move || {
... |
TARGET ENTITY: atomic_cell.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [atomic_cell.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety... | use std::{
mem,
sync::atomic::{AtomicUsize, Ordering::SeqCst},
};
use crossbeam_utils::atomic::AtomicCell;
// Always use fallback for now on environments that do not support inline assembly.
fn always_use_fallback() -> bool {
atomic_maybe_uninit::cfg_has_atomic_cas! {
cfg!(any(
miri,
... |
TARGET ENTITY: cache_padded.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [cache_padded.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | use std::{cell::Cell, mem};
use crossbeam_utils::CachePadded;
#[test]
fn default() {
let x: CachePadded<u64> = Default::default();
assert_eq!(*x, 0);
}
#[test]
fn store_u64() {
let x: CachePadded<u64> = CachePadded::new(17);
assert_eq!(*x, 17);
}
#[test]
fn store_pair() {
let x: CachePadded<(u64... |
TARGET ENTITY: thread.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [thread.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via ... | use std::{
any::Any,
sync::atomic::{AtomicUsize, Ordering},
thread::sleep,
time::Duration,
};
use crossbeam_utils::thread;
const THREADS: usize = 10;
const SMALL_STACK_SIZE: usize = 20;
#[test]
fn join() {
let counter = AtomicUsize::new(0);
thread::scope(|scope| {
let handle = scope.s... |
TARGET ENTITY: sharded_lock.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [sharded_lock.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | use std::{
sync::{
Arc, TryLockError,
atomic::{AtomicUsize, Ordering},
mpsc::channel,
},
thread,
};
use crossbeam_utils::sync::ShardedLock;
#[derive(Eq, PartialEq, Debug)]
struct NonCopy(i32);
#[test]
fn smoke() {
let l = ShardedLock::new(());
drop(l.read().unwrap());
... |
TARGET ENTITY: alloc_helper.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [alloc_helper.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | use core::{alloc::Layout, ptr::NonNull};
// Based on unstable alloc::alloc::Global.
//
// Note: unlike alloc::alloc::Global that returns NonNull<[u8]>,
// this returns NonNull<u8>.
pub(crate) struct Global;
#[allow(clippy::unused_self)]
impl Global {
#[inline]
#[cfg_attr(miri, track_caller)] // even without pa... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Miscellaneous tools for concurrent programming.
//!
//! ## Atomics
//!
//! * [`AtomicCell`], a thread-safe mutable memory location.
//! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
//!
//! ## Thread synchronization
//!
//! * [`Parker`], a thread parking primitive.
//! * [`Sh... |
TARGET ENTITY: backoff.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [backoff.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | use core::{cell::Cell, fmt};
use crate::primitive::hint;
const SPIN_LIMIT: u32 = 6;
const YIELD_LIMIT: u32 = 10;
/// Performs exponential backoff in spin loops.
///
/// Backing off in spin loops reduces contention and improves overall performance.
///
/// This primitive can execute *YIELD* and *PAUSE* instructions, ... |
TARGET ENTITY: cache_padded.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [cache_padded.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | use core::{
fmt,
ops::{Deref, DerefMut},
};
/// Pads and aligns a value to the length of a cache line.
///
/// In concurrent programming, sometimes it is desirable to make sure commonly accessed pieces of
/// data are not placed into the same cache line. Updating an atomic value invalidates the whole
/// cache... |
TARGET ENTITY: seq_lock_wide.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [seq_lock_wide.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safe... | use core::{
mem,
sync::atomic::{self, AtomicUsize, Ordering},
};
use crate::Backoff;
/// A simple stamped lock.
///
/// The state is represented as two `AtomicUsize`: `state_hi` for high bits and `state_lo` for low
/// bits.
pub(crate) struct SeqLock {
/// The high bits of the current state of the lock.
... |
TARGET ENTITY: seq_lock.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [seq_lock.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use core::{
mem,
sync::atomic::{self, AtomicUsize, Ordering},
};
use crate::Backoff;
/// A simple stamped lock.
pub(crate) struct SeqLock {
/// The current state of the lock.
///
/// All bits except the least significant one hold the current stamp. When locked, the state
/// equals 1 and doesn... |
TARGET ENTITY: consume.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [consume.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | #[cfg(not(crossbeam_no_atomic))]
use core::sync::atomic::Ordering;
/// Trait which allows reading from primitive atomic types with "consume" ordering.
pub trait AtomicConsume {
/// Type returned by `load_consume`.
type Val;
/// Loads a value from the atomic using a "consume" memory ordering.
///
/... |
TARGET ENTITY: mod.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [mod.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Atomic types.
//!
//! * [`AtomicCell`], a thread-safe mutable memory location.
//! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
#[cfg(target_has_atomic = "ptr")]
#[cfg(not(crossbeam_loom))]
// Use "wide" sequence lock if the pointer width <= 32 for preventing its counter ag... |
TARGET ENTITY: parker.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [parker.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via ... | use core::{fmt, marker::PhantomData, time::Duration};
use std::time::Instant;
use crate::primitive::sync::{
Arc, Condvar, Mutex,
atomic::{AtomicUsize, Ordering::SeqCst},
};
/// A thread parking primitive.
///
/// Conceptually, each `Parker` has an associated token which is initially not present:
///
/// * The... |
TARGET ENTITY: wait_group.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [wait_group.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | use core::{fmt, mem::ManuallyDrop};
use crate::primitive::sync::{
Arc, Condvar, Mutex,
atomic::{AtomicUsize, Ordering},
};
/// Enables threads to synchronize the beginning or end of some computation.
///
/// # Wait groups vs barriers
///
/// `WaitGroup` is very similar to [`Barrier`], but there are a few diff... |
TARGET ENTITY: mod.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [mod.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Thread synchronization primitives.
//!
//! * [`Parker`], a thread parking primitive.
//! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads.
//! * [`WaitGroup`], for synchronizing the beginning or end of some computation.
#[cfg(not(crossbeam_loom))]
mod once_lock;
mod parker;
#[cfg(not(cros... |
TARGET ENTITY: once_lock.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [once_lock.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | // Based on unstable std::sync::OnceLock.
//
// Source: https://github.com/rust-lang/rust/blob/8e9c93df464b7ada3fc7a1c8ccddd9dcb24ee0a0/library/std/src/sync/once_lock.rs
use core::{cell::UnsafeCell, mem::MaybeUninit};
use std::sync::Once;
pub(crate) struct OnceLock<T> {
once: Once,
value: UnsafeCell<MaybeUnin... |
TARGET ENTITY: atomic_cell.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [atomic_cell.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety... | #![feature(test)]
extern crate test;
use std::sync::Barrier;
use crossbeam_utils::{atomic::AtomicCell, thread};
#[bench]
fn load_u8(b: &mut test::Bencher) {
let a = AtomicCell::new(0u8);
let mut sum = 0;
b.iter(|| sum += a.load());
test::black_box(sum);
}
#[bench]
fn store_u8(b: &mut test::Bencher)... |
TARGET ENTITY: seg_queue.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [seg_queue.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | use std::sync::atomic::{AtomicUsize, Ordering};
use crossbeam_queue::SegQueue;
use crossbeam_utils::thread::scope;
#[test]
fn smoke() {
let q = SegQueue::new();
q.push(7);
assert_eq!(q.pop(), Some(7));
q.push(8);
assert_eq!(q.pop(), Some(8));
assert!(q.pop().is_none());
}
#[test]
fn len_empt... |
TARGET ENTITY: array_queue.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [array_queue.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety... | use std::sync::atomic::{AtomicUsize, Ordering};
use crossbeam_queue::ArrayQueue;
use crossbeam_utils::thread::scope;
#[test]
fn smoke() {
let q = ArrayQueue::new(1);
q.push(7).unwrap();
assert_eq!(q.pop(), Some(7));
q.push(8).unwrap();
assert_eq!(q.pop(), Some(8));
assert!(q.pop().is_none())... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Concurrent queues.
//!
//! This crate provides concurrent queues that can be shared among threads:
//!
//! * [`ArrayQueue`], a bounded MPMC queue that allocates a fixed-capacity buffer on construction.
//! * [`SegQueue`], an unbounded MPMC queue that allocates small buffers, segments, on demand.
#![no_std]
#![doc(... |
TARGET ENTITY: subcrates.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [subcrates.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | //! Makes sure subcrates are properly re-exported.
use crossbeam::select;
#[test]
fn channel() {
let (s, r) = crossbeam::channel::bounded(1);
select! {
send(s, 0) -> res => res.unwrap(),
recv(r) -> res => assert!(res.is_ok()),
}
}
#[test]
fn deque() {
let w = crossbeam::deque::Worker... |
TARGET ENTITY: build.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [build.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | // The rustc-cfg emitted by the build script are *not* public API.
use std::env;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-check-cfg=cfg(crossbeam_sanitize_thread)");
// `cfg(sanitize = "..")` is not stabilized.
let sanitize = env::var("CARGO_CFG_SANITIZE").unwrap... |
TARGET ENTITY: loom.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [loom.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | // Put in module instead of using #![cfg(..)] to work around rustc/cargo bug around -Z crate-attr.
#[cfg(crossbeam_loom)]
mod tests {
use std::{mem::ManuallyDrop, ptr};
use crossbeam_epoch as epoch;
use epoch::{Atomic, Owned, *};
use loom::{
sync::{
Arc,
atomic::Ordering... |
TARGET ENTITY: default.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [default.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | //! The default garbage collector.
//!
//! For each thread, a participant is lazily initialized on its first use, when the current thread
//! is registered in the default collector. If initialized, the thread's participant will get
//! destructed on thread exit, which in turn unregisters the thread.
#[cfg(not(crossbe... |
TARGET ENTITY: epoch.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [epoch.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! The global epoch
//!
//! The last bit in this number is unused and is always zero. Every so often the global epoch is
//! incremented, i.e. we say it "advances". A pinned participant may advance the global epoch only
//! if all currently pinned participants have been pinned in the current epoch.
//!
//! If an objec... |
TARGET ENTITY: collector.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [collector.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | /// Epoch-based garbage collector.
///
/// # Examples
///
/// ```
/// use crossbeam_epoch::Collector;
///
/// let collector = Collector::new();
///
/// let handle = collector.register();
/// drop(collector); // `handle` still works after dropping `collector`
///
/// handle.pin().flush();
/// ```
use core::fmt;
use cra... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Epoch-based memory reclamation.
//!
//! An interesting problem concurrent collections deal with comes from the remove operation.
//! Suppose that a thread removes an element from a lock-free map, while another thread is reading
//! that same element at the same time. The first thread must wait until the second thre... |
TARGET ENTITY: deferred.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [deferred.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use alloc::boxed::Box;
use core::{
fmt,
marker::PhantomData,
mem::{self, MaybeUninit},
ptr,
};
/// Number of words a piece of `Data` can hold.
///
/// Three words should be enough for the majority of cases. For example, you can fit inside it the
/// function pointer together with a fat pointer represen... |
TARGET ENTITY: queue.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [queue.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Michael-Scott lock-free queue.
//!
//! Usable with any number of producers and consumers.
//!
//! Michael and Scott. Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue
//! Algorithms. PODC 1996. <http://dl.acm.org/citation.cfm?id=248106>
//!
//! Simon Doherty, Lindsay Groves, Victor Luchangco... |
TARGET ENTITY: list.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [list.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Lock-free intrusive linked list.
//!
//! Ideas from Michael. High Performance Dynamic Lock-Free Hash Tables and List-Based Sets. SPAA
//! 2002. <http://dl.acm.org/citation.cfm?id=564870.564881>
use core::{
marker::PhantomData,
ptr::NonNull,
sync::atomic::Ordering::{Acquire, Relaxed, Release},
};
us... |
TARGET ENTITY: sanitize.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [sanitize.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use std::{
sync::{
Arc,
atomic::{
AtomicUsize,
Ordering::{AcqRel, Acquire, Relaxed},
},
},
thread,
time::{Duration, Instant},
};
use crossbeam_epoch::{self as epoch, Atomic, Collector, LocalHandle, Owned, Shared};
fn worker(a: Arc<Atomic<AtomicUsize>>, h... |
TARGET ENTITY: pin.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [pin.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | #![feature(test)]
extern crate test;
use crossbeam_epoch as epoch;
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_pin(b: &mut Bencher) {
b.iter(epoch::pin);
}
#[bench]
fn multi_pin(b: &mut Bencher) {
const THREADS: usize = 16;
const STEPS: usize = 100_000;
b.iter(|| {
... |
TARGET ENTITY: defer.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [defer.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | #![feature(test)]
extern crate test;
use crossbeam_epoch::{self as epoch, Owned};
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_alloc_defer_free(b: &mut Bencher) {
b.iter(|| {
let guard = &epoch::pin();
let p = Owned::new(1).into_shared(guard);
unsafe {
... |
TARGET ENTITY: flush.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [flush.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | #![feature(test)]
extern crate test;
use std::sync::Barrier;
use crossbeam_epoch as epoch;
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_flush(b: &mut Bencher) {
const THREADS: usize = 16;
let start = Barrier::new(THREADS + 1);
let end = Barrier::new(THREADS + 1);
scope... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Tools for concurrent programming.
//!
//! ## Atomics
//!
//! * [`AtomicCell`], a thread-safe mutable memory location.
//! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
//!
//! ## Data structures
//!
//! * [`deque`], work-stealing deques for building task schedulers.
//! * [`A... |
TARGET ENTITY: injector.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [injector.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use std::sync::{
Arc, Mutex,
atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst},
};
use crossbeam_deque::{
Injector,
Steal::{self, Empty, Success},
Worker,
};
use crossbeam_utils::thread::scope;
fn busy_retry<T>(mut f: impl FnMut() -> Steal<T>) -> Steal<T> {
loop {
let s = f();
... |
TARGET ENTITY: fifo.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [fifo.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | use std::sync::{
Arc, Mutex,
atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst},
};
use crossbeam_deque::{
Steal::{Empty, Success},
Worker,
};
use crossbeam_utils::thread::scope;
#[test]
fn smoke() {
let w = Worker::new_fifo();
let s = w.stealer();
assert_eq!(w.pop(), None);
assert_eq... |
TARGET ENTITY: lifo.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lifo.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | use std::sync::{
Arc, Mutex,
atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst},
};
use crossbeam_deque::{
Steal::{Empty, Success},
Worker,
};
use crossbeam_utils::thread::scope;
#[test]
fn smoke() {
let w = Worker::new_lifo();
let s = w.stealer();
assert_eq!(w.pop(), None);
assert_eq... |
TARGET ENTITY: steal.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [steal.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | use crossbeam_deque::{
Injector,
Steal::{self, Success},
Worker,
};
fn busy_retry<T>(mut f: impl FnMut() -> Steal<T>) -> Steal<T> {
loop {
let s = f();
if !s.is_retry() {
return s;
}
}
}
#[test]
fn steal_fifo() {
let w = Worker::new_fifo();
for i in 1..=... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Concurrent work-stealing deques.
//!
//! These data structures are most commonly used in work-stealing schedulers. The typical setup
//! involves a number of threads, each having its own FIFO or LIFO queue (*worker*). There is also
//! one global FIFO queue (*injector*) and a list of references to *worker* queues t... |
TARGET ENTITY: array.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [array.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Tests for the array channel flavor.
use std::{
any::Any,
rc::Rc,
sync::atomic::{AtomicUsize, Ordering},
thread,
time::Duration,
};
use crossbeam_channel::{
Receiver, RecvError, RecvTimeoutError, SendError, SendTimeoutError, TryRecvError, TrySendError,
bounded, select,
};
use crossbeam_... |
TARGET ENTITY: after.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [after.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Tests for the after channel flavor.
#![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
use std::{
sync::atomic::{AtomicUsize, Ordering},
thread,
time::{Duration, Instant},
};
use crossbeam_channel::{Select, TryRecvError, after, select};
use crossbeam_utils::thread::scope;
fn ms(m... |
TARGET ENTITY: iter.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [iter.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Tests for iteration over receivers.
use crossbeam_channel::unbounded;
use crossbeam_utils::thread::scope;
#[test]
fn nested_recv_iter() {
let (s, r) = unbounded::<i32>();
let (total_s, total_r) = unbounded::<i32>();
scope(|scope| {
scope.spawn(move |_| {
let mut acc = 0;
... |
TARGET ENTITY: same_channel.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [same_channel.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | #![allow(clippy::redundant_clone)]
use std::time::Duration;
use crossbeam_channel::{after, bounded, never, tick, unbounded};
fn ms(ms: u64) -> Duration {
Duration::from_millis(ms)
}
#[test]
fn after_same_channel() {
let r = after(ms(50));
let r2 = r.clone();
assert!(r.same_channel(&r2));
let r... |
TARGET ENTITY: list.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [list.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Tests for the list channel flavor.
use std::{
any::Any,
sync::atomic::{AtomicUsize, Ordering},
thread,
time::Duration,
};
use crossbeam_channel::{
Receiver, RecvError, RecvTimeoutError, SendError, SendTimeoutError, TryRecvError, TrySendError,
select, unbounded,
};
use crossbeam_utils::thre... |
TARGET ENTITY: zero.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [zero.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Tests for the zero channel flavor.
use std::{
any::Any,
sync::atomic::{AtomicUsize, Ordering},
thread,
time::Duration,
};
use crossbeam_channel::{
Receiver, RecvError, RecvTimeoutError, SendError, SendTimeoutError, TryRecvError, TrySendError,
bounded, select,
};
use crossbeam_utils::thread... |
TARGET ENTITY: thread_locals.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [thread_locals.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safe... | //! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics.
#![cfg(not(miri))] // Miri detects that this test is buggy: the destructor of `FOO` uses `std::thread::current()`!
use std::{thread, time::Duration};
use crossbeam_channel::{select, unbounded};
use crossbeam_utils::thread... |
TARGET ENTITY: tick.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [tick.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Tests for the tick channel flavor.
#![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
use std::{
sync::atomic::{AtomicUsize, Ordering},
thread,
time::{Duration, Instant},
};
use crossbeam_channel::{Select, TryRecvError, after, select, tick};
use crossbeam_utils::thread::scope;
fn... |
TARGET ENTITY: never.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [never.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Tests for the never channel flavor.
use std::{
thread,
time::{Duration, Instant},
};
use crossbeam_channel::{never, select, tick, unbounded};
fn ms(ms: u64) -> Duration {
Duration::from_millis(ms)
}
#[test]
fn smoke() {
select! {
recv(never::<i32>()) -> _ => panic!(),
default => ... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Multi-producer multi-consumer channels for message passing.
//!
//! This crate is an alternative to [`std::sync::mpsc`] with more features and better performance.
//!
//! # Hello, world!
//!
//! ```
//! use crossbeam_channel::unbounded;
//!
//! // Create a channel of unbounded capacity.
//! let (s, r) = unbounded()... |
TARGET ENTITY: err.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [err.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | use core::fmt;
use std::error;
/// An error returned from the [`send`] method.
///
/// The message could not be sent because the channel is disconnected.
///
/// The error contains the message so it can be recovered.
///
/// [`send`]: super::Sender::send
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct SendError<T>(pu... |
TARGET ENTITY: context.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [context.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | //! Thread-local context used in select.
use alloc::sync::Arc;
use core::{
cell::Cell,
ptr,
sync::atomic::{AtomicPtr, AtomicUsize, Ordering},
};
use std::{
thread::{self, Thread, ThreadId},
time::Instant,
};
use crossbeam_utils::Backoff;
use crate::select::Selected;
/// Thread-local context used... |
TARGET ENTITY: waker.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [waker.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Waking mechanism for threads blocked on channel operations.
use alloc::vec::Vec;
use core::{
ptr,
sync::atomic::{AtomicBool, Ordering},
};
use std::thread::{self, ThreadId};
use crate::{
context::Context,
select::{Operation, Selected},
utils::Mutex,
};
/// Represents a thread blocked on a spe... |
TARGET ENTITY: utils.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [utils.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Miscellaneous utilities.
use core::{cell::Cell, num::Wrapping, time::Duration};
use std::{thread, time::Instant};
/// Randomly shuffles a slice.
pub(crate) fn shuffle<T>(v: &mut [T]) {
let len = v.len();
if len <= 1 {
return;
}
std::thread_local! {
static RNG: Cell<Wrapping<u32>> ... |
TARGET ENTITY: counter.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [counter.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | //! Reference counter for channels.
use alloc::boxed::Box;
use core::{
ops,
ptr::NonNull,
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
};
use std::process;
/// Reference counter internals.
struct Counter<C> {
/// The number of senders associated with the channel.
senders: AtomicUsize,
/... |
TARGET ENTITY: at.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [at.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via stri... | //! Channel that delivers a message at a certain moment in time.
//!
//! Messages cannot be sent into this kind of channel; they are materialized on demand.
use core::sync::atomic::{AtomicBool, Ordering};
use std::{thread, time::Instant};
use crate::{
context::Context,
err::{RecvTimeoutError, TryRecvError},
... |
TARGET ENTITY: mod.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [mod.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Channel flavors.
//!
//! There are six flavors:
//!
//! 1. `at` - Channel that delivers a message after a certain amount of time.
//! 2. `array` - Bounded channel based on a preallocated array.
//! 3. `list` - Unbounded channel implemented as a linked list.
//! 4. `never` - Channel that never delivers messages.
//!... |
TARGET ENTITY: zero.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [zero.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Zero-capacity channel.
//!
//! This kind of channel is also known as *rendezvous* channel.
use alloc::boxed::Box;
use core::{
cell::UnsafeCell,
fmt,
marker::PhantomData,
ptr,
sync::atomic::{AtomicBool, Ordering},
};
use std::time::Instant;
use crossbeam_utils::Backoff;
use crate::{
contex... |
TARGET ENTITY: tick.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [tick.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | //! Channel that delivers messages periodically.
//!
//! Messages cannot be sent into this kind of channel; they are materialized on demand.
use core::time::Duration;
use std::{thread, time::Instant};
use crossbeam_utils::atomic::AtomicCell;
use crate::{
context::Context,
err::{RecvTimeoutError, TryRecvError... |
TARGET ENTITY: never.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [never.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | //! Channel that never delivers messages.
//!
//! Messages cannot be sent into this kind of channel.
use core::marker::PhantomData;
use std::time::Instant;
use crate::{
context::Context,
err::{RecvTimeoutError, TryRecvError},
select::{Operation, SelectHandle, Token},
utils,
};
/// This flavor doesn't... |
TARGET ENTITY: lockfree.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lockfree.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use lockfree::channel;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
use std::thread;
fn seq() {
let (mut tx, mut rx) = channel::spsc::create();
for i in 0..MESSAGES {
tx.send(message::new(i)).unwrap();
}
for _ in 0..MESSAGES {
while rx.recv().is_err() {... |
TARGET ENTITY: mpmc.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [mpmc.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | use std::thread;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn seq(cap: usize) {
let q = mpmc::Queue::with_capacity(cap);
for i in 0..MESSAGES {
loop {
if q.push(message::new(i)).is_ok() {
break;
} else {
thread::... |
TARGET ENTITY: crossbeam-channel.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [crossbeam-channel.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread ... | use crossbeam_channel::{Receiver, Select, Sender, bounded, unbounded};
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn new<T>(cap: Option<usize>) -> (Sender<T>, Receiver<T>) {
match cap {
None => unbounded(),
Some(cap) => bounded(cap),
}
}
fn seq(cap: Option<usiz... |
TARGET ENTITY: message.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [message.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | use std::fmt;
const LEN: usize = 1;
#[derive(Clone, Copy)]
pub(crate) struct Message(#[allow(dead_code)] [usize; LEN]);
impl fmt::Debug for Message {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Message")
}
}
#[inline]
pub(crate) fn new(num: usize) -> Message {
Message([num;... |
TARGET ENTITY: mpsc.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [mpsc.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | use std::sync::mpsc;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
pub fn shuffle<T>(v: &mut [T]) {
use std::{cell::Cell, num::Wrapping};
let len = v.len();
if len <= 1 {
return;
}
thread_local! {
static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wr... |
TARGET ENTITY: segqueue.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [segqueue.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | use std::thread;
use crossbeam::queue::SegQueue;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn seq() {
let q = SegQueue::new();
for i in 0..MESSAGES {
q.push(message::new(i));
}
for _ in 0..MESSAGES {
q.pop().unwrap();
}
}
fn spsc() {
let q =... |
TARGET ENTITY: atomicringqueue.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [atomicringqueue.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread sa... | use std::thread;
use atomicring::AtomicRingQueue;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn seq(cap: usize) {
let q = AtomicRingQueue::with_capacity(cap);
for i in 0..MESSAGES {
loop {
if q.try_push(message::new(i)).is_ok() {
break;
... |
TARGET ENTITY: flume.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [flume.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
pub fn shuffle<T>(v: &mut [T]) {
use std::{cell::Cell, num::Wrapping};
let len = v.len();
if len <= 1 {
return;
}
thread_local! {
static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wrapping(1)) };
}
... |
TARGET ENTITY: futures-channel.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [futures-channel.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread sa... | use futures::{
SinkExt, StreamExt,
channel::mpsc,
executor::{ThreadPool, block_on},
future, stream,
};
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn seq_unbounded() {
block_on(async {
let (tx, rx) = mpsc::unbounded();
for i in 0..MESSAGES {
... |
TARGET ENTITY: atomicring.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [atomicring.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | use std::thread;
use atomicring::AtomicRingBuffer;
mod message;
const MESSAGES: usize = 5_000_000;
const THREADS: usize = 4;
fn seq(cap: usize) {
let q = AtomicRingBuffer::with_capacity(cap);
for i in 0..MESSAGES {
loop {
if q.try_push(message::new(i)).is_ok() {
break;
... |
TARGET ENTITY: crossbeam-deque.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [crossbeam-deque.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread sa... | use std::thread;
use crossbeam_deque::{Steal, Worker};
mod message;
const MESSAGES: usize = 5_000_000;
fn seq() {
let tx = Worker::new_lifo();
let rx = tx.stealer();
for i in 0..MESSAGES {
tx.push(message::new(i));
}
for _ in 0..MESSAGES {
match rx.steal() {
Steal::... |
TARGET ENTITY: bus.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [bus.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | use bus::Bus;
mod message;
const MESSAGES: usize = 5_000_000;
fn seq(cap: usize) {
let mut tx = Bus::new(cap);
let mut rx = tx.add_rx();
for i in 0..MESSAGES {
tx.broadcast(message::new(i));
}
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}
fn spsc(cap: usize) {
let mut ... |
TARGET ENTITY: matching.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [matching.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | //! Using `select!` to send and receive on the same channel at the same time.
//!
//! This example is based on the following program in Go.
//!
//! Source:
//! - https://web.archive.org/web/20171209034309/https://www.nada.kth.se/~snilsson/concurrency
//! - http://www.nada.kth.se/~snilsson/concurrency/src/matching.g... |
TARGET ENTITY: stopwatch.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [stopwatch.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | //! Prints the elapsed time every 1 second and quits on Ctrl+C.
#[cfg(windows)] // signal_hook::iterator does not work on windows
fn main() {
println!("This example does not work on Windows");
}
#[cfg(not(windows))]
fn main() {
use std::{
io, thread,
time::{Duration, Instant},
};
use ... |
TARGET ENTITY: fibonacci.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [fibonacci.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | //! An asynchronous fibonacci sequence generator.
use std::thread;
use crossbeam_channel::{Sender, bounded};
// Sends the Fibonacci sequence into the channel until it becomes disconnected.
fn fibonacci(sender: Sender<u64>) {
let (mut x, mut y) = (0, 1);
while sender.send(x).is_ok() {
let tmp = x;
... |
TARGET ENTITY: comparator.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [comparator.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | //! Traits for key comparison in maps.
use core::cmp::Ordering;
use crate::equivalent::{Comparable, Equivalent};
/// Key equality trait.
///
/// This trait allows for very flexible comparison of objects. You may
/// borrow/dereference `L` and `R` using `Borrow` or another trait. The trait
/// takes a `self` paramete... |
TARGET ENTITY: equivalent.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [equivalent.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | // These traits are based on `equivalent` crate, but `K` and `Q` are flipped to avoid type inference issues:
// https://github.com/indexmap-rs/equivalent/issues/5
//! Traits for key comparison in maps.
use core::{borrow::Borrow, cmp::Ordering};
/// Key equivalence trait.
///
/// This trait allows hash table lookup t... |
TARGET ENTITY: lib.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [lib.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! Concurrent maps and sets based on [skip lists].
//!
//! This crate provides the types [`SkipMap`] and [`SkipSet`].
//! These data structures provide an interface similar to [`BTreeMap`] and [`BTreeSet`],
//! respectively, except they support safe concurrent access across
//! multiple threads.
//!
//! # Concurrent a... |
TARGET ENTITY: set.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [set.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via str... | //! A set based on a lock-free skip list. See [`SkipSet`].
use core::{
fmt,
ops::{Bound, Deref, RangeBounds},
};
use crate::{
comparator::{BasicComparator, Comparator},
map,
};
/// A set based on a lock-free skip list.
///
/// This is an alternative to [`BTreeSet`] which supports
/// concurrent acces... |
TARGET ENTITY: simple.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [simple.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via ... | // use std::time::Instant;
fn main() {
// let map = crossbeam_skiplist::SkipMap::new();
// // let mut map = std::collections::BTreeMap::new();
// // let mut map = std::collections::HashMap::new();
//
// let now = Instant::now();
//
// let mut num = 0u64;
// for _ in 0..1_000_000 {
/... |
TARGET ENTITY: skiplist.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [skiplist.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | #![feature(test)]
#![allow(clippy::unit_arg)]
extern crate test;
use crossbeam_epoch as epoch;
use crossbeam_skiplist::SkipList;
use test::{Bencher, black_box};
#[bench]
fn insert(b: &mut Bencher) {
let guard = &epoch::pin();
b.iter(|| {
let map = SkipList::new(epoch::default_collector().clone());
... |
TARGET ENTITY: btree.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [btree.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via s... | #![feature(test)]
extern crate test;
use std::collections::BTreeMap as Map;
use test::{Bencher, black_box};
#[bench]
fn insert(b: &mut Bencher) {
b.iter(|| {
let mut map = Map::new();
let mut num = 0u64;
for _ in 0..1_000 {
num = num.wrapping_mul(17).wrapping_add(255);
... |
TARGET ENTITY: skipmap.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [skipmap.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | #![feature(test)]
extern crate test;
use crossbeam_skiplist::SkipMap as Map;
use test::{Bencher, black_box};
#[bench]
fn insert(b: &mut Bencher) {
b.iter(|| {
let map = Map::new();
let mut num = 0u64;
for _ in 0..1_000 {
num = num.wrapping_mul(17).wrapping_add(255);
... |
TARGET ENTITY: hash.rs
LANGUAGE BASE: Rust
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [hash.rs]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | #![feature(test)]
extern crate test;
use std::collections::HashMap as Map;
use test::{Bencher, black_box};
#[bench]
fn insert(b: &mut Bencher) {
b.iter(|| {
let mut map = Map::new();
let mut num = 0u64;
for _ in 0..1_000 {
num = num.wrapping_mul(17).wrapping_add(255);
... |
TARGET ENTITY: preset.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [preset.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via... | #include "arg.h"
#include "preset.h"
#include "peg-parser.h"
#include "log.h"
#include "download.h"
#include <fstream>
#include <sstream>
#include <filesystem>
#include <regex>
static std::string rm_leading_dashes(const std::string & str) {
size_t pos = 0;
while (pos < str.size() && str[pos] == '-') {
... |
TARGET ENTITY: log.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [log.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via st... | #include "common.h"
#include "log.h"
#include <chrono>
#include <condition_variable>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <mutex>
#include <sstream>
#include <thread>
#include <vector>
#include <algorithm>
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# ifndef N... |
TARGET ENTITY: ngram-mod.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [ngram-mod.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety ... | #include "ngram-mod.h"
#include <algorithm>
//
// common_ngram_mod
//
common_ngram_mod::common_ngram_mod(uint16_t n, size_t size) : n(n), used(0) {
entries.resize(size);
reset();
}
size_t common_ngram_mod::idx(const entry_t * tokens) const {
size_t res = 0;
for (size_t i = 0; i < n; ++i) {
... |
TARGET ENTITY: reasoning-budget.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [reasoning-budget.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread ... | #include "reasoning-budget.h"
#include "common.h"
#include "unicode.h"
#include "log.h"
#include <cmath>
#include <cstdint>
#include <string>
#include <vector>
struct token_matcher {
std::vector<llama_token> tokens;
size_t pos = 0;
bool advance(llama_token token) {
if (tokens.empty()) {
... |
TARGET ENTITY: imatrix-loader.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [imatrix-loader.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread sa... | #include "imatrix-loader.h"
#include "common.h"
#include "log.h"
#include "gguf.h"
#include <cmath>
#include <cstring>
#include <fstream>
static bool common_imatrix_load_legacy(const std::string & fname, common_imatrix & imatrix) {
std::ifstream in(fname, std::ios::binary);
if (!in) {
LOG_ERR("%s: fai... |
TARGET ENTITY: hf-cache.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [hf-cache.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety v... | #include "hf-cache.h"
#include "build-info.h"
#include "common.h"
#include "log.h"
#include "http.h"
#define JSON_ASSERT GGML_ASSERT
#include <nlohmann/json.hpp>
#include <filesystem>
#include <fstream>
#include <atomic>
#include <string>
#include <string_view>
#include <stdexcept>
namespace nl = nlohmann;
#if def... |
TARGET ENTITY: debug.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [debug.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety via ... | #include "debug.h"
#include "common.h"
#include "log.h"
#include <cmath>
#include <regex>
#include <string>
#include <vector>
struct common_debug_cb_user_data::impl {
std::vector<uint8_t> data;
std::vector<std::regex> tensor_filters;
bool abort_on_nan{false};
};
common_debug_cb_use... |
TARGET ENTITY: unicode.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [unicode.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety vi... | #include "unicode.h"
#include <algorithm>
#include <cassert>
#include <stdexcept>
#include <string>
#include <vector>
// implementation adopted from src/unicode.cpp
size_t common_utf8_sequence_length(unsigned char first_byte) {
const size_t lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 };
uint8... |
TARGET ENTITY: chat-auto-parser-helpers.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [chat-auto-parser-helpers.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating... | #include "chat-auto-parser-helpers.h"
#include "chat-auto-parser.h"
#include "chat-peg-parser.h"
#include "chat.h"
#include "log.h"
#include "nlohmann/json.hpp"
#include "peg-parser.h"
#include <cctype>
#include <numeric>
using json = nlohmann::ordered_json;
std::string trim_whitespace(const std::string & str) {
... |
TARGET ENTITY: llguidance.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [llguidance.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safety... | #include "sampling.h"
#include "log.h"
#ifdef LLAMA_USE_LLGUIDANCE
# include "llguidance.h"
# include <cmath>
struct llama_sampler_llg {
const llama_vocab * vocab;
std::string grammar_kind;
std::string grammar_data;
LlgTokenizer * tokenizer;
LlgMatcher * grammar;... |
TARGET ENTITY: ngram-cache.cpp
LANGUAGE BASE: C++/CUDA
COMPUTATION METRICS: Enforce zero-leak hardware boundaries.
EXECUTION MANDATE: Synthesize exact low-level assembly-optimized structural runtime primitives. | CRITICAL COMPILER REASONING FOR MODULE [ngram-cache.cpp]:
- Scanning data layouts to prevent L1/L2 cache-line bouncing and enforce rigid cache line memory padding alignment.
- Eliminating implicit virtual method table lookups, stripping object abstractions, and locking structural memory paths.
- Validating thread safet... | #include "ngram-cache.h"
#include "common.h"
#include "log.h"
#include <cinttypes>
#include <cstdint>
#include <cstdio>
#include <fstream>
#include <thread>
#include <algorithm>
void common_ngram_cache_update(common_ngram_cache & ngram_cache, int ngram_min, int ngram_max,
std::vector<lla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.