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
This PR refactors the mechanism for visiting (reading and/or updating)
side metadata in bulk, specifically the function
`SideMetadataSpec::iterate_meta_bits`.
The function now uses a single `FnMut` callback instead of two `Fn`
callbacks. It uses the enum type `BitByteRange` to distinguish whole
byte ranges from bit ranges in a byte. This allows the user to capture
variables mutably in the callback. This also removes the `Cell` used in
`find_prev_non_zero_value_fast`.
The function is made non-recursive to improve the performance. Some test
cases are added to test for corner cases.
The function is moved to a dedicated `ranges` module and renamed to
`break_bit_range`, for several reasons:
- It was a method of `SideMetadataSpec`, but it does not access any
member of `SideMetadataSpec`.
- It needs a non-trivial amount of testing to get corner cases correct,
especially after refactoring into a non-recursive function.
- Related types and functions can be added to the `ranges` module in the
future.
- Breaking a range of bytes into a range of aligned words and unaligned
bytes in the beginning and the end. It will be used by finding VO bits
from internal pointers and finding all VO bits in a region (for heap
traversal).
- Breaking a range of bytes at chunk boundaries. It will be used by
`bulk_update_metadata`.
0 commit comments