You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, crossbeam_epoch::Atomic offers a tagging facility, which lets you use the lower bits of the pointer to implement arbitrary tagging. This is a pretty nice facility, but I'm having a little trouble figuring out how to use it effectively!
In my use case, I have essentially 4 different structs of different sizes. I'd like to have a single type T such that crossbeam_epoch::Atomic<T> acts something like enum { S1(Atomic<S1>), S2(Atomic<S2>), S3(Atomic<S3>), S4(Atomic<S4>) }, using the tag of crossbeam_epoch::Atomic to store the enum variant. But this would mean that when Crossbeam garbage collects T, the actual amount of memory it needs to free depends on the tag (because the structs are sized differently), and I don't know how to represent that to Crossbeam!
(The actual use case shows up in an ART data structure (a fancy trie), which has a common Node * that is either an interior node or a leaf node depending on the last bit of the pointer). I could probably move the tag into type T instead of in the Atomic pointer for a little extra space, but I'd like to match the original C++ implementation as much as possible.
The text was updated successfully, but these errors were encountered:
alanhdu
changed the title
[Feature Request] crossbeam-epoch tagging for enum-like box
[Feature Request] crossbeam-epoch tagging for enum-like struct
Mar 12, 2019
Right now,
crossbeam_epoch::Atomic
offers a tagging facility, which lets you use the lower bits of the pointer to implement arbitrary tagging. This is a pretty nice facility, but I'm having a little trouble figuring out how to use it effectively!In my use case, I have essentially 4 different structs of different sizes. I'd like to have a single type
T
such thatcrossbeam_epoch::Atomic<T>
acts something likeenum { S1(Atomic<S1>), S2(Atomic<S2>), S3(Atomic<S3>), S4(Atomic<S4>) }
, using the tag ofcrossbeam_epoch::Atomic
to store the enum variant. But this would mean that when Crossbeam garbage collectsT
, the actual amount of memory it needs to free depends on the tag (because the structs are sized differently), and I don't know how to represent that to Crossbeam!(The actual use case shows up in an ART data structure (a fancy trie), which has a common
Node *
that is either an interior node or a leaf node depending on the last bit of the pointer). I could probably move the tag into typeT
instead of in theAtomic
pointer for a little extra space, but I'd like to match the original C++ implementation as much as possible.The text was updated successfully, but these errors were encountered: