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

Add HostAlignedByteCount to enforce alignment at compile time #9620

Merged
merged 2 commits into from
Nov 22, 2024

Commits on Nov 21, 2024

  1. Add HostAlignedByteCount to enforce alignment at compile time

    As part of the work to allow mmaps to be backed by other implementations, I
    realized that we didn't have any way to track whether a particular usize is
    host-page-aligned at compile time.
    
    Add a `HostAlignedByteCount` which tracks that a particular usize is aligned to
    the host page size. This also does not expose safe unchecked arithmetic
    operations, to ensure that overflows always error out.
    
    With `HostAlignedByteCount`, a lot of runtime checks can go away thanks to the
    type-level assertion.
    
    In the interest of keeping the diff relatively small, I haven't converted
    everything over yet. More can be converted over as time permits.
    sunshowers committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    c28f985 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    93e23db View commit details
    Browse the repository at this point in the history