-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Querify WF-checking so it can be cached #48939
Querify WF-checking so it can be cached #48939
Conversation
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.
CheckTypeWellFormedVisitor.code
was only ever set to ObligationCauseCode::MiscObligation
so I removed it to simplify splitting the struct in the next commit.
src/librustc_typeck/check/wfcheck.rs
Outdated
@@ -26,7 +26,7 @@ use errors::{DiagnosticBuilder, DiagnosticId}; | |||
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; | |||
use rustc::hir; | |||
|
|||
pub struct CheckTypeWellFormedVisitor<'a, 'tcx:'a> { | |||
pub struct CheckTypeWellFormed<'a, 'tcx:'a> { |
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.
It seemed best to me to split the code that visits the HIR from the code which actually does the wf calculations. At this point, this struct probably isn't that useful and its methods could just be free functions. What do you think?
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.
Yeah, I think it would make sense to transform them into free-standing functions. That makes it easier to see that there's no state in self
that one needs to worry about.
Should we have three separate queries or just one that dispatches on the type of |
Let's leave it a three separate queries. That's a bit cleaner, I think. If we did not use |
@bors try |
Querify WF-checking so it can be cached r? @michaelwoerister
Thanks, @wesleywiser! The PR looks good as is. Turning the methods into free-standing functions would make it even nicer, I think. It started a try-build, so we can see the performance gains from this. There should be noticeable wins for clean rebuilds. |
☀️ Test successful - status-travis |
@Mark-Simulacrum, could you do a perf run for this as well, please? |
Thanks @michaelwoerister! I just pushed another commit which converts the methods into free functions. |
Thanks, @wesleywiser! Seems like one of the lines is a bit too long:
|
6a7e593
to
e5bbf2d
Compare
Whoops. I saw that before I pushed but then I forgot to amend my commit 🤦♂️ |
Thanks! @bors r+ |
📌 Commit e5bbf2d has been approved by |
@michaelwoerister Did you still want a perf run? |
843c304 is queued for perf in case we want it. |
OK, that queued run should have the same performance as the approved version. I'd still be interested in it, yes. |
The perf.rlo link works now. The numbers look excellent |
This rocks! Curious that style-servo got slower, but it's only in the semi-artificial case. Presumably something is no longer being reused? |
@nikomatsakis I believe that's issue #48184 (as @michaelwoerister mentioned here). |
☔ The latest upstream changes (presumably #49051) made this pull request unmergeable. Please resolve the merge conflicts. |
e5bbf2d
to
b418b7b
Compare
Rebased |
@bors r+ |
📌 Commit b418b7b has been approved by |
⌛ Testing commit b418b7b with merge 160c836a58911574755c40a3db91958622dd920c... |
💔 Test failed - status-travis |
Looks like a timeout on the asmjs builder. |
@bors retry |
@bors rollup -- hopefully this will get it merged more quickly |
… r=michaelwoerister Querify WF-checking so it can be cached r? @michaelwoerister
… r=michaelwoerister Querify WF-checking so it can be cached r? @michaelwoerister
🎉 |
r? @michaelwoerister