Skip to content

Make MIN_ALIGN a const to allow better optimization #18272

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

Closed
wants to merge 1 commit into from

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Oct 24, 2014

With MIN_ALIGN as a static, other crates don't have access to its value
at compile time, because it is an extern global. That means that the
checks against it can't be optimized out, which is rather unfortunate.
So let's make it a constant instead.

With MIN_ALIGN as a static, other crates don't have access to its value
at compile time, because it is an extern global. That means that the
checks against it can't be optimized out, which is rather unfortunate.
So let's make it a constant instead.
@rust-highfive
Copy link
Contributor

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@thestinger
Copy link
Contributor

It would be nice if the global system simply hadn't regressed. A const gets duplicated everywhere and will only be merged when LTO is enabled.

@thestinger
Copy link
Contributor

rust-lang/rfcs#398

@thestinger
Copy link
Contributor

Landing this commit as part of #18293 since they're both touching the same code.

@thestinger thestinger closed this Oct 25, 2014
@dotdash dotdash deleted the const_align branch February 4, 2015 12:43
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.

4 participants