@@ -10,6 +10,14 @@ use crate::*;
10
10
use std:: marker:: PhantomData ;
11
11
use std:: ops:: { Deref , DerefMut } ;
12
12
13
+ /// Buffer size for [`ProcessEdgesWork`] work packets. This constant is exposed to binding
14
+ /// developers so that they can use this value for places in their binding that interface with the
15
+ /// work packet system, specifically the transitive closure via `ProcessEdgesWork` work packets
16
+ /// such as roots gathering code or weak reference processing. In order to have better load
17
+ /// balancing, it is recommended that binding developers use this constant to split work up into
18
+ /// different work packets.
19
+ pub const EDGES_WORK_BUFFER_SIZE : usize = 4096 ;
20
+
13
21
pub struct ScheduleCollection ;
14
22
15
23
impl < VM : VMBinding > GCWork < VM > for ScheduleCollection {
@@ -556,7 +564,7 @@ pub trait ProcessEdgesWork:
556
564
/// Higher capacity means the packet will take longer to finish, and may lead to
557
565
/// bad load balancing. On the other hand, lower capacity would lead to higher cost
558
566
/// on scheduling many small work packets. It is important to find a proper capacity.
559
- const CAPACITY : usize = 4096 ;
567
+ const CAPACITY : usize = EDGES_WORK_BUFFER_SIZE ;
560
568
/// Do we update object reference? This has to be true for a moving GC.
561
569
const OVERWRITE_REFERENCE : bool = true ;
562
570
/// If true, we do object scanning in this work packet with the same worker without scheduling overhead.
0 commit comments