Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn RawBlock into an abstraction for vectors of variable-length types #2737

Open
adri326 opened this issue Dec 31, 2024 · 1 comment
Open

Comments

@adri326
Copy link

adri326 commented Dec 31, 2024

RawBlock is currently used in three places:

  • AtomTable, which stores elements as AtomHeaders followed by strs (these are grouped together as AtomData)
  • Stack, which stores elements as either AndFrame or OrFrame, followed by [HeapCellValue] (they are not grouped together in a single type, instead relying on the rather fragile property that AndFrame are only ever stored within a RawBlock)
  • F64Table, which I believe could be implemented without RawBlock, as it only really needs an atomic for the length.

Stack is pretty wildly unsafe, while AtomTable can be tweaked to become safe.
I believe that the logic in AtomTable for properly handling buffers that store variable-length data as a header-slice pair could be extracted into a proper abstraction on top of (or instead of) RawBlock, and then used to make Stack safe and AtomTable easier to maintain.

Care needs to be taken to still allow AtomTable to be Sync using the new API: reads and appends must work together nicely across threads.

There might be crates for this already, although I don't know if they provide the above guarantees for thread safety.

@Skgland
Copy link
Contributor

Skgland commented Dec 31, 2024

Maybe something like play-ground could work? (Highly Experimental/Work in Progress/probably unsafe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants