-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Stop walking the bodies of statics for reachability, and evaluate them instead #122371
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use r? to explicitly pick a reviewer |
@bors try @rust-timer queue |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
Stop walking the bodies of statics for reachability, and evaluate them instead cc `@saethlin` `@RalfJung` cc rust-lang#119214 This reuses the `DefIdVisitor` from `rustc_privacy`, because they basically try to do the same thing. It can probably be extended to constants, too, but let's tackle that separately, it's likely more involved.
Not familiar with this code, sorry. r? compiler |
I can't really comment on this PR, as I know neither the intended semantics of this "reachable" pass nor the way it is used. It would be good to have some place that documents the intended semantics -- does that exist currently? Does it need updating with this PR? |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
I'm pretty sure fmease doesn't know this part of the compiler either. I'll take a careful look over this later, but I think @tmiasko is a good reviewer for this based on past conversations. r? tmiasko |
Finished benchmarking commit (1a609b9): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 670.966s -> 671.851s (0.13%) |
Could you also add a negative test case demonstrating that calling a function from an initializer of a reachable static no longer makes the function reachable? |
7b7b6b5
to
746e4ef
Compare
Added a test, and showed how it changes in the second commit |
@bors r+ |
Don't walk the bodies of free constants for reachability. follow-up to rust-lang#122371 we don't have generic constants yet, so we don't need to handle failure to eval a free constant. Associated consts and generic consts will be a different topic, that I will look into in a follow-up r? `@tmiasko`
☀️ Test successful - checks-actions |
Finished benchmarking commit (c563f2e): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 670.952s -> 670.527s (-0.06%) |
Don't walk the bodies of free constants for reachability. follow-up to rust-lang#122371 cc rust-lang#119214 This avoids codegening items (e.g. functions) that are only used during const eval, but do not reach their final constant value (e.g. via function pointers). r? `@tmiasko`
cc @saethlin @RalfJung
cc #119214
This reuses the
DefIdVisitor
fromrustc_privacy
, because they basically try to do the same thing.This PR's changes can probably be extended to constants, too, but let's tackle that separately, it's likely more involved.