Skip to content

Commit

Permalink
Merge #552
Browse files Browse the repository at this point in the history
552: Make Local less than 2048 bytes r=stjepang a=taiki-e

Set `MAX_OBJECTS` to 62, and make the size of `Local` to 2040 bytes.

Closes #551

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Sep 1, 2020
2 parents bfb7705 + b5ca3b2 commit ce53365
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crossbeam-epoch/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use crate::sync::queue::Queue;

/// Maximum number of objects a bag can contain.
#[cfg(not(feature = "sanitize"))]
const MAX_OBJECTS: usize = 64;
const MAX_OBJECTS: usize = 62;
#[cfg(feature = "sanitize")]
const MAX_OBJECTS: usize = 4;

Expand Down Expand Up @@ -174,8 +174,6 @@ impl Default for Bag {
Deferred::new(no_op_func),
Deferred::new(no_op_func),
Deferred::new(no_op_func),
Deferred::new(no_op_func),
Deferred::new(no_op_func),
],
};
#[cfg(feature = "sanitize")]
Expand Down Expand Up @@ -374,6 +372,13 @@ pub struct Local {
pin_count: Cell<Wrapping<usize>>,
}

// Make sure `Local` is less than or equal to 2048 bytes.
// https://github.com/crossbeam-rs/crossbeam/issues/551
#[test]
fn local_size() {
assert_eq!(2040, core::mem::size_of::<Local>());
}

impl Local {
/// Number of pinnings after which a participant will execute some deferred functions from the
/// global queue.
Expand Down

0 comments on commit ce53365

Please sign in to comment.