Skip to content
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

Replace Rc with Lrc for shared data #48586

Merged
merged 3 commits into from
Mar 3, 2018
Merged

Replace Rc with Lrc for shared data #48586

merged 3 commits into from
Mar 3, 2018

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 27, 2018

This replaces Rcs reachable from TyCtxt with Lrc. This has no effect unless cfg(parallel_queries) is set. It also contains a fix for the Decodable impl for Arc.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 27, 2018
@nikomatsakis
Copy link
Contributor

cc @rust-lang/compiler - I think this step seems pretty clearly desirable.

@michaelwoerister
Copy link
Member

I'll take a closer look tomorrow!

@nikomatsakis
Copy link
Contributor

r? @michaelwoerister

@nikomatsakis
Copy link
Contributor

@michaelwoerister -- hope that's ok, just feeling a bit overwhelmed with reviews right now :)

@Centril Centril added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 27, 2018
Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @Zoxc! This looks good to me. I'd still like to wait for feedback about the change in libproc_macro but otherwise this has my r+.

We should make sure to add at least one build that compiles with parallel queries enabled to our CI. I'll open an issue for that.

It would also be interesting to see the performance impact of switching to atomic reference counting. We can do a try-build once the PR is merged.

@@ -306,7 +307,7 @@ pub struct LineColumn {
#[unstable(feature = "proc_macro", issue = "38356")]
#[derive(Clone)]
pub struct SourceFile {
filemap: Rc<FileMap>,
filemap: Lrc<FileMap>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-lang/compiler @alexcrichton, is it safe to modify these definitions? Or are they part of a public interface?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah these are unstable and just private fields, so should be all good!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the quick feedback!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is IMO problematic because it will eventually be observable in user code - you should impl !Send and !Sync on SourceFile to hide the difference before we forget and stabilize it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably also other types this applies to in libproc_macro.

@@ -437,7 +438,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
}
}

fn expand_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) -> Option<Expansion> {
fn expand_invoc(&mut self, invoc: Invocation, ext: Lrc<SyntaxExtension>) -> Option<Expansion> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably just use &SyntaxExtension.

@michaelwoerister
Copy link
Member

@rust-lang/infra: Upping the priority since this patch has such a big risk of bitrotting.

@bors p=10

@kennytm
Copy link
Member

kennytm commented Feb 28, 2018

[01:22:43]    Compiling rustc_driver v0.0.0 (file:///checkout/src/librustc_driver)
[01:22:44] error[E0433]: failed to resolve. Use of undeclared type or module `Lrc`
[01:22:44]    --> librustc_driver/test.rs:108:40
[01:22:44]     |
[01:22:44] 108 |                                        Lrc::new(CodeMap::new(FilePathMapping::empty())));
[01:22:44]     |                                        ^^^ Use of undeclared type or module `Lrc`
[01:22:44] 
[01:22:45] error: aborting due to previous error

@Zoxc Zoxc force-pushed the atomic-rc branch 2 times, most recently from 4e2efcf to 5539554 Compare March 2, 2018 05:09
@michaelwoerister
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 2, 2018

📌 Commit 5539554 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2018
@bors
Copy link
Contributor

bors commented Mar 2, 2018

🔒 Merge conflict

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 2, 2018
@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 2, 2018
@michaelwoerister
Copy link
Member

michaelwoerister commented Mar 2, 2018

@Zoxc, you can just r=me after resolving such merge conflicts.

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 2, 2018

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented Mar 2, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 2, 2018
@Manishearth
Copy link
Member

@bors retry

timeout

smashes something

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2018
@bors
Copy link
Contributor

bors commented Mar 2, 2018

⌛ Testing commit fce7201 with merge c57c60edd9b07424c98a8bbcf4d8ce0a495e0c72...

@bors
Copy link
Contributor

bors commented Mar 3, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 3, 2018
@Manishearth
Copy link
Member

@bors retry

appveyor timeout again

smashes another thing

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 3, 2018
@bors
Copy link
Contributor

bors commented Mar 3, 2018

⌛ Testing commit fce7201 with merge e8af0f4...

bors added a commit that referenced this pull request Mar 3, 2018
Replace Rc with Lrc for shared data

This replaces `Rc`s reachable from `TyCtxt` with `Lrc`. This has no effect unless `cfg(parallel_queries)` is set. It also contains a fix for the `Decodable` impl for `Arc`.

r? @nikomatsakis
@bors bors mentioned this pull request Mar 3, 2018
@bors
Copy link
Contributor

bors commented Mar 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing e8af0f4 to master...

@michaelwoerister
Copy link
Member

🎉

@bstrie
Copy link
Contributor

bstrie commented Mar 8, 2018

🎉

smashes something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.