@@ -13,31 +13,34 @@ use enum_map::EnumMap;
1313// This struct is part of the Mutator struct.
1414// We are trying to make it fixed-sized so that VM bindings can easily define a Mutator type to have the exact same layout as our Mutator struct.
1515#[ repr( C ) ]
16- pub struct MutatorConfig < VM : VMBinding , P : Plan < VM > + ' static > {
16+ pub struct MutatorConfig < P : Plan > {
1717 // Mapping between allocation semantics and allocator selector
1818 pub allocator_mapping : & ' static EnumMap < AllocationType , AllocatorSelector > ,
1919 // Mapping between allocator selector and spaces. Each pair represents a mapping.
2020 // Put this behind a box, so it is a pointer-sized field.
2121 #[ allow( clippy:: box_vec) ]
22- pub space_mapping : Box < Vec < ( AllocatorSelector , & ' static dyn Space < VM > ) > > ,
22+ pub space_mapping : Box < Vec < ( AllocatorSelector , & ' static dyn Space < P :: VM > ) > > ,
2323 // Plan-specific code for mutator prepare/release
24- pub prepare_func : & ' static dyn Fn ( & mut Mutator < VM , P > , OpaquePointer ) ,
25- pub release_func : & ' static dyn Fn ( & mut Mutator < VM , P > , OpaquePointer ) ,
24+ pub prepare_func : & ' static dyn Fn ( & mut Mutator < P > , OpaquePointer ) ,
25+ pub release_func : & ' static dyn Fn ( & mut Mutator < P > , OpaquePointer ) ,
2626}
2727
28+ unsafe impl < P : Plan > Send for MutatorConfig < P > { }
29+ unsafe impl < P : Plan > Sync for MutatorConfig < P > { }
30+
2831// We are trying to make this struct fixed-sized so that VM bindings can easily define a type to have the exact same layout as this struct.
2932// Currently Mutator is fixed sized, and we should try keep this invariant:
3033// - Allocators are fixed-length arrays of allocators.
3134// - MutatorConfig has 3 pointers/refs (including one fat pointer), and is fixed sized.
3235#[ repr( C ) ]
33- pub struct Mutator < VM : VMBinding , P : Plan < VM > + ' static > {
34- pub allocators : Allocators < VM > ,
36+ pub struct Mutator < P : Plan > {
37+ pub allocators : Allocators < P :: VM > ,
3538 pub mutator_tls : OpaquePointer ,
3639 pub plan : & ' static P ,
37- pub config : MutatorConfig < VM , P > ,
40+ pub config : MutatorConfig < P > ,
3841}
3942
40- impl < VM : VMBinding , P : Plan < VM > > MutatorContext < VM > for Mutator < VM , P > {
43+ impl < P : Plan < Mutator = Self > > MutatorContext < P :: VM > for Mutator < P > {
4144 fn prepare ( & mut self , tls : OpaquePointer ) {
4245 ( * self . config . prepare_func ) ( self , tls)
4346 }
0 commit comments