-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_arena
overhaul
#116224
Merged
Merged
rustc_arena
overhaul
#116224
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
79b11f0
rustc_arena: tweak some comments.
nnethercote a11f7e4
Remove some unnecessary lifetimes.
nnethercote 0001edd
Inline and remove `DroplessArena::grow_and_alloc`.
nnethercote 55de23e
Inline and remove `TypedArena::ensure_capacity`.
nnethercote 51edc21
Remove `unsafe` from `TypedArena::alloc_raw_slice`.
nnethercote 98d97b7
Use `Layout::new` consistently in `DroplessArena::alloc`.
nnethercote 25407bc
Make `DroplessArena::alloc` call `DroplessArena::alloc_raw`.
nnethercote 55a1a52
Reduce `grow_and_alloc_raw` to a single call site.
nnethercote bb5344a
Inline and remove `DroplessArena::alloc_raw_without_grow`.
nnethercote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of this loop. If there's some logic error, it may run more than twice and I'd prefer a panic in that case. The loop variant before #108693 is a bit better as it avoids the large loop body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that the loop was used before #108693, I didn't know about that. If that's how it was before, and I changed it back here, that suggests it's somehow a natural way to do it. I'm not worried about a logic error, because (a) the code used to be like that, and (b) this code is hot and so naturally gets high levels of testing.
The "large" loop body is less than 30 lines, which isn't very large.
The current code has all these little functions, several with a single call site, including:
The new code has just:
I find this much easier to understand. When I read the current code I had trouble keeping straight all these different functions, I had to write them all down and take notes to understand them.