From b5ca3b2728ee6482e2375665a0c2c1f79ce71d7f Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 1 Sep 2020 17:33:26 +0900 Subject: [PATCH] Make Local less than 2048 bytes --- crossbeam-epoch/src/internal.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crossbeam-epoch/src/internal.rs b/crossbeam-epoch/src/internal.rs index 926b3dee5..6c1e98f4c 100644 --- a/crossbeam-epoch/src/internal.rs +++ b/crossbeam-epoch/src/internal.rs @@ -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; @@ -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")] @@ -374,6 +372,13 @@ pub struct Local { pin_count: Cell>, } +// 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::()); +} + impl Local { /// Number of pinnings after which a participant will execute some deferred functions from the /// global queue.