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

remove or encapsulate the remaining non-query data in tcx #44501

Merged
merged 10 commits into from
Oct 18, 2017

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Sep 11, 2017

I wound up removing the existing cache around inhabitedness since it didn't seem to be adding much value. I reworked const rvalue promotion, but not that much (i.e., I did not split the computation into bits, as @eddyb had tossed out as a suggestion). But it's now demand driven, at least.

cc @michaelwoerister -- see the forbid_reads change in last commit

r? @eddyb -- since the trickiest of this PR is the work on const rvalue promotion

cc #44137

@eddyb
Copy link
Member

eddyb commented Sep 11, 2017

r=me modulo the forbid_reads hack. Also, cc @arielb1

@michaelwoerister
Copy link
Member

forbid_reads is considered a hack?

@eddyb
Copy link
Member

eddyb commented Sep 11, 2017

@michaelwoerister I meant RegionEraser and how it uses forbid_reads - to me it looks hackier than using a query, and it's only for performance reasons? But I'll defer that to you and/or @arielb1.

@bors
Copy link
Contributor

bors commented Sep 11, 2017

☔ The latest upstream changes (presumably #44442) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum
Copy link
Member

Before we merge, let's get some perf numbers - run a try build when ready.

@nikomatsakis
Copy link
Contributor Author

@eddyb I think that example could indeed be a query -- I was considering actually extending the maps macro to support such queries (i.e., queries that are not permitting to read during their code, and hence don't require a task) or just making it be a query. I could go either way.

@nikomatsakis nikomatsakis force-pushed the issue-44137-non-query-data-in-tcx branch from c58e725 to fb2e369 Compare September 12, 2017 08:39
@@ -0,0 +1,81 @@
use rustc_data_structures::fx::FxHashMap;
Copy link
Member

Choose a reason for hiding this comment

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

Missing license.

[00:02:50] tidy error: /checkout/src/librustc/ty/erase_regions.rs: incorrect license

@arielb1 arielb1 added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 12, 2017
@arielb1
Copy link
Contributor

arielb1 commented Sep 12, 2017

LGTM

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Sep 12, 2017

📌 Commit 49a2c08 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Sep 13, 2017

☔ The latest upstream changes (presumably #44420) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Sep 15, 2017

📌 Commit b952f47 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Sep 17, 2017

⌛ Testing commit b952f477c63226e1059c1c4868db962ed10d93d9 with merge 3e4fe6c4557ff9caadba4f43ba263716483cce26...

@bors
Copy link
Contributor

bors commented Sep 17, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Sep 18, 2017

Could not compile stage1-std in x86_64-gnu-incremental with a BorrowMutError somewhere.

[00:18:53] error: internal compiler error: unexpected panic
[00:18:53] 
[00:18:53] note: the compiler unexpectedly panicked. this is a bug.
[00:18:53] 
[00:18:53] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:18:53] 
[00:18:53] note: rustc 1.22.0-dev running on x86_64-unknown-linux-gnu
[00:18:53] 
[00:18:53] thread 'rustc' panicked at 'already borrowed: BorrowMutError', /checkout/src/libcore/result.rs:906:4
[00:18:53] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:18:53] 
[00:18:53] error: Could not compile `std`.

@alexcrichton
Copy link
Member

@bors: r-

reappeared in the travis queue

@bors
Copy link
Contributor

bors commented Sep 18, 2017

☔ The latest upstream changes (presumably #44678) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis nikomatsakis force-pushed the issue-44137-non-query-data-in-tcx branch from b952f47 to 10069e5 Compare September 19, 2017 19:41
@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Sep 19, 2017

📌 Commit 10069e5 has been approved by eddyb

@arielb1 arielb1 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 19, 2017
@nikomatsakis nikomatsakis force-pushed the issue-44137-non-query-data-in-tcx branch from 94449a5 to dd3a4f4 Compare October 16, 2017 21:33
@nikomatsakis
Copy link
Contributor Author

cc @Manishearth @llogiq @mcarton @oli-obk -- apparently I've broken clippy. Looks like primarily this is a matter of now needing to supply the rvalue_promotable_map to the ExprUseVisitor, but also the removal of the rvalue_promotable_to_static map (replaced by the rvalue_promotable query, example edit).

(Are there some directions for the steps to prepare a PR to clippy to fix this stuff?)

@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 Oct 17, 2017
@oli-obk
Copy link
Contributor

oli-obk commented Oct 17, 2017

(Are there some directions for the steps to prepare a PR to clippy to fix this stuff?)

Directions can be found at https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#external-dependencies

Generally, you can just fix clippy by compiling it via ./x.py build src/tools/clippy and open a PR once it builds. We'll take care to reenable clippy once your changes hit master and are merged into clippy master.

Remember to set submodules = false in config.toml, otherwise the next call to x.py will erase your submodule changes

If you consider the PR to clippy to be too involved (e.g. because we used an API so wrongly it'll take a lot of effort to fix our usage), we'll fix it ourselvels.

@nikomatsakis
Copy link
Contributor Author

@arielb1

What can erase_regions depend on?

Actually, looking again, I'm not sure. I thought that I had seen -- or maybe just imagined -- some path in anonymize_late_bound_regions that accesses one of the adt-defs or something, but looking again I don't see any such path. Perhaps there was some other bug in forbid_reads the way I wrote it? I wish I could reproduce the problem.

Regardless, as @eddyb pointed out earlier, a regular query is simpler, so that may have been a bit of premature perf. optimization on my part. I think my ideal preference would be to keep it as a query, but add an option to declare a "non-read" query that skips dependency tracking (using something like forbid_reads to check for correctness).

@eddyb
Copy link
Member

eddyb commented Oct 17, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Oct 17, 2017

📌 Commit 7715f97 has been approved by eddyb

@kennytm kennytm 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 Oct 17, 2017
@nikomatsakis nikomatsakis force-pushed the issue-44137-non-query-data-in-tcx branch from a673c3b to 7715f97 Compare October 17, 2017 15:56
@bors
Copy link
Contributor

bors commented Oct 17, 2017

⌛ Testing commit 7715f97 with merge 76e77ec828027f688faaa615fabad5d641223a76...

@bors
Copy link
Contributor

bors commented Oct 18, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Oct 18, 2017

@bors retry

macOS... spuriously canceled after 6 hours 😂

@bors
Copy link
Contributor

bors commented Oct 18, 2017

⌛ Testing commit 7715f97 with merge 7a4f394...

bors added a commit that referenced this pull request Oct 18, 2017
…, r=eddyb

remove or encapsulate the remaining non-query data in tcx

I wound up removing the existing cache around inhabitedness since it didn't seem to be adding much value. I reworked const rvalue promotion, but not that much (i.e., I did not split the computation into bits, as @eddyb had tossed out as a suggestion). But it's now demand driven, at least.

cc @michaelwoerister -- see the `forbid_reads` change in last commit

r? @eddyb -- since the trickiest of this PR is the work on const rvalue promotion

cc #44137
@bors
Copy link
Contributor

bors commented Oct 18, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 7a4f394 to master...

@bors bors merged commit 7715f97 into rust-lang:master Oct 18, 2017
@bors bors mentioned this pull request Oct 18, 2017
dwrensha added a commit to dwrensha/seer that referenced this pull request Oct 19, 2017
@oli-obk
Copy link
Contributor

oli-obk commented Oct 20, 2017

Would it make sense to simplify the map returned by rvalue_promotable_map to a set?

bors added a commit that referenced this pull request Nov 9, 2017
Use a `Set<T>` instead of a `Map<T, bool>`

r? @nikomatsakis

introduced in #44501
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.