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

incr.comp.: Turn translation item collection and CGU partitioning into a query. #44486

Closed
michaelwoerister opened this issue Sep 11, 2017 · 0 comments
Labels
A-incr-comp Area: Incremental compilation C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

Right now translation item collection and CGU partitioning are run as part of rustc_trans::base::trans_crate(). For better integration with red/green tracking this functionality should be moved into a pair of queries:

  • The first query does all of translation item collection and partitioning and returns (set of all trans-items, set of all partitions). It can have a query key of () as it only takes other queries as input.
  • The second query has query-key cgu_name: &str and returns the single CodegenUnit with that name. It just reads from the result of the first query. It's purpose is to provide a "firewall" so codegen units can be re-used if they don't change.

Doing this refactoring will involve moving TransItem and CodegenUnit to librustc, so they can be used in query results. One will also have to provide a HashStable implementation for the results of the two queries. The implementation for CodegenUnit should do something like CodegenUnit::compute_symbol_name_hash(). For translation items one could maybe just hash the symbol name.

cc @nikomatsakis @alexcrichton

@michaelwoerister michaelwoerister added the A-incr-comp Area: Incremental compilation label Sep 11, 2017
@TimNN TimNN added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 17, 2017
bors added a commit that referenced this issue Sep 17, 2017
Refactor translation unit partitioning/collection as a query

This commit is targeted at #44486 with the ultimate goal of making the `collect_and_partition_translation_items` function a query. This mostly just involved query-ifying a few other systems along with plumbing the tcx instead of `SharedCrateContext` in a few locations.

Currently this only tackles the first bullet of #44486 and doesn't add a dedicated query for a particular codegen unit. I wasn't quite sure how to do that yet but figured this was good to put up.

Closes #44486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants