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 BlackBox #123

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Commits on Jun 19, 2024

  1. Add BlackBox

    Adds a `VolatileCell`-like struct which introduces an optimization
    barrier on all accesses.
    
    The `*Cell`-like `get()` method is the only accessor for the inner value
    and uses a more generalized (i.e. for all `Copy` types) `black_box`
    to preclude optimizations.
    
    This is useful for things like bitwise mask values to ensure LLVM
    doesn't try to optimize around special cases like `0`, especially in the
    context of loops.
    
    For an example use case, see:
    
    https://rustsec.org/advisories/RUSTSEC-2024-0344.html
    tarcieri committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    bf87dee View commit details
    Browse the repository at this point in the history