-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
struct field reordering and optimization #37429
Merged
bors
merged 28 commits into
rust-lang:master
from
ahicks92:univariant_layout_optimization
Dec 18, 2016
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
cae94e8
Optimize anything using a layout::Struct by introducing a mapping fro…
ahicks92 8cfbffe
Fix bugs to optimizing enums:
ahicks92 1969aeb
Make constant field access account for field reordering.
ahicks92 2746903
Fix extern-pass-empty test, which needed repr(C)
ahicks92 d754778
Fix tuple and closure literals.
ahicks92 c7ec0df
Add yet more missing #[repr(C)] to tests
ahicks92 0e61c0e
Incorporate a bunch of review comments.
ahicks92 8e852e9
Struct::new takes a vec, avoiding double allocation in some cases
ahicks92 3d23dc7
Modify debuginfo to deal with the difference between source and memor…
ahicks92 adae9bc
Make tidy
ahicks92 e7c3540
Use an enum to differentiate between kinds of structs.
ahicks92 1af8e14
First attempt at detecting if structs can ever be unsized
ahicks92 cb21cc5
Don't optimize pairs
ahicks92 b3c285f
Fix checking to see if the last field of a struct can be unsized.
ahicks92 487ef58
Fix type-sizes test
ahicks92 5adf694
Make tidy
ahicks92 74f5c61
Change how type-sizes works slightly: we want to ensure that [i16; 0]…
ahicks92 cf5f80c
Fix having multiple reprs on the same type.
ahicks92 c8c3579
Fix closure arguments which are immediate because of field reordering.
ahicks92 052e59c
Make tidy
ahicks92 e9580e2
Some small fixes to how structs/enums are optimized
ahicks92 025456e
Incorporate review comments
ahicks92 cfe1a77
Fix -Z print-type-sizes and tests.
ahicks92 a65cc1e
Fix error introduced during last rebase
ahicks92 9966bbd
Fix computation of enum names based off the discrfield in the case of…
ahicks92 79c35bb
Add a case to type-sizes to explicitly verify that field reordering t…
ahicks92 f22a22b
Incorporate review comments.
ahicks92 ff59474
flock needs repr(C)
ahicks92 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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.
Q_Q why doesn't this use an offset? cc @michaelwoerister
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 guess it'd need both a type and an offset which it can get from the field path.
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 leaving this one for now. This is the old behavior, and we have tests against it that fail if it changes.
If I had to bet, it's field indices because the pretty printers access them with "humanlike" expressions or something.