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

optimize Step impl for VirtAddr #462

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

Freax13
Copy link
Member

@Freax13 Freax13 commented Feb 28, 2024

This PR optimizes the Step methods for VirtAddr.

Some of these optimizations were already present in the PR that introduced the Step implementation but were removed over safety concerns. To address these concerns, this PR also adds some kani proof harnesses to prove the correctness of the implementations. The proof harnesses are run in CI.

This eliminates the call to unwrap which the compiler can't easily
optimize out.
This eliminates a panic branch.
The last two commits introduced some shortcuts that are less obviously
correct. Using unsafe is inherently risky, so we better be sure that
the code is correct.
The proof harnesses added in this patch can be used to proof that our
implementation is correct for all inputs.
Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!

src/addr.rs Show resolved Hide resolved
@Freax13 Freax13 merged commit b62d1d9 into rust-osdev:master Feb 29, 2024
12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants