-
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
Make TransitiveRelation thread safe. Avoid locking by using get_mut in some cases #48587
Conversation
Hmm. This is a case where I suspect we could do better than the current design. I think I was just kinda' lazy before. |
I'll take a look. |
I think this is only shared because of the |
@Zoxc no, I think that field goes away -- but I think the type is still used |
I just confirmed that it is not used from the MIR borrow check (though the type itself is used). I think what I would prefer to do in this case is to have the cache always be up-to-date. We could do this in two ways:
I guess between the two I lean towards the second, as it is more robust, and we can always handle it if that is some kind of perf hit. Would you be up for that? |
The question isn't whether or not it's used, but whether or not it's shared. That field is the reason it's shared, so if it goes away, we could just revert this patch. I'd prefer to merge this and then later merge some other scheme backed by benchmarks if it turns out to actually be shared. |
It will not be shared in the future, that much is sure, but I think that we probably will not remove the old borrow checker "in time". Is there some central issue tracking the refactorings? I'm willing to land this change as long as long as there is a list somewhere of stuff to fix and it is on there =) |
@nikomatsakis It is on this list. |
@Zoxc oh, great! I just made https://github.com/rust-lang/rust/issues/48685...maybe we can just link to that list from there? Or close one or the other. |
@bors r+ |
📌 Commit 89e55d1 has been approved by |
…sakis Make TransitiveRelation thread safe. Avoid locking by using get_mut in some cases r? @nikomatsakis
Make TransitiveRelation thread safe. Avoid locking by using get_mut in some cases r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
get rid of `RefCell` in `TransitiveRelation` This is one of the jobs in `Pending refactorings` in rust-lang#48685. The parallel-compiler's work has been suspended for quite some time, but I think I can pick it up gradually. I think this PR should be a start. Regarding the refactoring of `TransitiveRelation`, `@nikomatsakis` has proposed [two(three?) schemes](rust-lang#48587 (comment)). In order to satisfy both compilation efficiency and robustness, I think adding the `freeze` method may be the best solution, although it requires relatively more code changes.
r? @nikomatsakis