summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
AgeCommit message (Collapse)AuthorLines
2023-04-12Auto merge of #109935 - michaelwoerister:fix-feed-in-eval-always, r=cjgillotbors-11/+33
incr.comp.: Make sure dependencies are recorded when feeding queries during eval-always queries. This PR makes sure we don't drop dependency edges when feeding queries during an eval-always query. Background: During eval-always queries, no dependencies are recorded because the system knows to unconditionally re-evaluate them regardless of any actual dependencies. This works fine for these queries themselves but leads to a problem when feeding other queries: When queries are fed, we set up their dependency edges by copying the current set of dependencies of the feeding query. But because this set is empty for eval-always queries, we record no edges at all -- which has the effect that the fed query instances always look "green" to the system, although they should always be "red". The fix is to explicitly add a dependency on the artificial "always red" dep-node when feeding during eval-always queries. Fixes https://github.com/rust-lang/rust/issues/108481 Maybe also fixes issue https://github.com/rust-lang/rust/issues/88488. cc `@jyn514` r? `@cjgillot` or `@oli-obk`
2023-04-09Fix some clippy::complexityNilstrieb-1/+3
2023-04-06Address commentsJohn Kåre Alsaker-3/+4
2023-04-06Don't rely on `Debug` impl for `Erased`John Kåre Alsaker-12/+25
2023-04-06Erase query cache valuesJohn Kåre Alsaker-19/+26
2023-04-04incr.comp.: Make sure dependencies are recorded when feeding queries during ↵Michael Woerister-11/+33
eval-always queries.
2023-04-04Remove a fishy Clone implOli Scherer-1/+6
2023-03-30Remove an out-of-date comment on `QueryCache::lookup`.Nicholas Nethercote-3/+0
2023-03-28Rollup merge of #108480 - Zoxc:rayon-tlv, r=cuvipernils-1/+1
Use Rayon's TLV directly This accesses Rayon's `TLV` thread local directly avoiding wrapper functions. This makes rustc work with https://github.com/rust-lang/rustc-rayon/pull/10. r? `@cuviper`
2023-03-27no shadow plzMichael Goulet-2/+1
2023-03-27Rollup merge of #109587 - cjgillot:no-hashmap-fingerprint, r=NilstriebMatthias Krüger-10/+4
Use an IndexVec to debug fingerprints. Uncontroversial part of https://github.com/rust-lang/rust/pull/109050
2023-03-25Auto merge of #109100 - Zoxc:merge-query-try, r=cjgillotbors-134/+134
Refactor `try_execute_query` This merges `JobOwner::try_start` into `try_execute_query`, removing `TryGetJob` in the processes. 3 new functions are extracted from `try_execute_query`: `execute_job`, `cycle_error` and `wait_for_query`. This makes the control flow a bit clearer and improves performance. Based on https://github.com/rust-lang/rust/pull/109046. <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7134s</td><td align="right">1.7061s</td><td align="right"> -0.43%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2519s</td><td align="right">0.2510s</td><td align="right"> -0.35%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9517s</td><td align="right">0.9481s</td><td align="right"> -0.38%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5389s</td><td align="right">1.5338s</td><td align="right"> -0.33%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.9488s</td><td align="right">5.9258s</td><td align="right"> -0.39%</td></tr><tr><td>Total</td><td align="right">10.4048s</td><td align="right">10.3647s</td><td align="right"> -0.38%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9962s</td><td align="right"> -0.38%</td></tr></table> r? `@cjgillot`
2023-03-25Use an IndexVec to debug fingerprints.Camille GILLOT-10/+4
2023-03-25Pass `tcx` directlyJohn Kåre Alsaker-31/+26
2023-03-25Split the `if` to release the lock earlierJohn Kåre Alsaker-9/+14
2023-03-25Remove `DebugArg`John Kåre Alsaker-43/+5
2023-03-25Optimize `incremental_verify_ich`John Kåre Alsaker-49/+68
2023-03-25Update indexmap and rayon cratesJohn Kåre Alsaker-1/+1
2023-03-21Refactor `try_execute_query`John Kåre Alsaker-134/+134
2023-03-20Auto merge of #109046 - Zoxc:split-execute-job, r=cjgillot,michaelwoeristerbors-30/+42
Split `execute_job` into `execute_job_incr` and `execute_job_non_incr` `execute_job` was a bit large, so this splits it in 2. Performance was neutral locally, but this may affect bootstrap times.
2023-03-20Auto merge of #108524 - Zoxc:node-backtrace, r=cjgillotbors-51/+64
Optimize dep node backtrace and ignore fatal errors This attempts to optimize https://github.com/rust-lang/rust/pull/91742 while also passing through fatal errors. r? `@cjgillot`
2023-03-19Add some assertionsJohn Kåre Alsaker-0/+3
2023-03-19Split `execute_job` into `execute_job_incr` and `execute_job_non_incr`John Kåre Alsaker-30/+39
2023-03-12Auto merge of #108845 - Zoxc:par-fix-2, r=cjgillotbors-6/+21
Check that a query has not completed and is not executing before starting it This fixes a race in the query system where we only checked if the query was currently executing, but not if it was already completed, causing queries to re-execute. r? `@cjgillot`
2023-03-12Auto merge of #108820 - cjgillot:ensure-on-disk, r=oli-obkbors-8/+26
Ensure value is on the on-disk cache before returning from `ensure()`. The current logic for `ensure()` a query just checks that the node is green in the dependency graph. However, a lot of places use `ensure()` to prevent the query from being called later. This is the case before stealing a query result. If the query is actually green but the value is not available in the on-disk cache, `ensure` would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value. This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning. Sadly, I can't manage to craft a proper test... Should fix all instances of "attempted to read from stolen value".
2023-03-12Use `Debug` for formatting the dep nodesJohn Kåre Alsaker-2/+1
2023-03-12Remove `graph` parameter from `try_force_from_dep_node`John Kåre Alsaker-7/+8
2023-03-12Optimize dep node backtrace and ignore fatal errorsJohn Kåre Alsaker-50/+63
2023-03-12Auto merge of #108682 - est31:simplify_dirs, r=davidtwcobors-1/+1
Simplify message paths This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes. The commit was the result of automated changes: ``` for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done ``` r? `@davidtwco`
2023-03-11Make the check for cache opt-in.Camille GILLOT-3/+9
2023-03-11Ensure value is on the on-disk cache before returning.Camille GILLOT-6/+18
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-09Remove `dep_node_index_of_opt` and `dep_node_index_of`John Kåre Alsaker-12/+2
2023-03-09Address commentsJohn Kåre Alsaker-16/+14
2023-03-09Move dep graph methods to DepGraphData to avoid branches and `unwrap`sJohn Kåre Alsaker-164/+224
2023-03-08Check that a query has not completed and is not executing before starting itJohn Kåre Alsaker-6/+21
2023-03-07Auto merge of #108167 - Zoxc:query-config-instance-slim, r=cjgillotbors-82/+96
Make `rustc_query_system` take `QueryConfig` by instance. This allows for easy switching between virtual tables and specialized instances for queries. It also has the benefit of less turbofish. `QueryStorage` has also been merged with `QueryCache`. Split out from https://github.com/rust-lang/rust/pull/107937. r? `@cjgillot`
2023-02-28Fix a race in the query systemJohn Kåre Alsaker-4/+5
2023-02-26Avoid implementing Debug for QueryConfigJohn Kåre Alsaker-4/+13
2023-02-26Make `rustc_query_system` take `QueryConfig` by instance.John Kåre Alsaker-82/+87
2023-02-25Don't inline try_execute_queryJohn Kåre Alsaker-0/+1
2023-02-25Add inlining attributes for query system functionsJohn Kåre Alsaker-0/+9
2023-02-25Move `ensure_sufficient_stack` to `try_execute_query` callersJohn Kåre Alsaker-15/+8
2023-02-25Reduce calls to `current_query_job`John Kåre Alsaker-4/+4
2023-02-24Auto merge of #91742 - cjgillot:force-backtrace, r=estebankbors-11/+45
Print a backtrace when query forcing fails. The aim of this PR is to help debugging incremental compilation bugs where query forcing panics. For instance: https://github.com/rust-lang/rust/issues/90682 https://github.com/rust-lang/rust/issues/90697 https://github.com/rust-lang/rust/issues/90715 https://github.com/rust-lang/rust/issues/90739 https://github.com/rust-lang/rust/issues/91401 These bugs happen when the dep-graph attempts to force a dep-node whose fingerprint does not correspond to an actual DefPathHash. PR https://github.com/rust-lang/rust/pull/91741 attempts to hide this bug. I still don't know how to reproduce these bugs, so I sadly could not test this debugging device.
2023-02-24Rollup merge of #108169 - Zoxc:query-key-copy, r=cjgillotDylan DPC-17/+18
Make query keys `Copy` This regressed compiler performance locally, so I'm curious what perf will say about it. <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7566s</td><td align="right">1.7657s</td><td align="right"> 0.52%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2572s</td><td align="right">0.2578s</td><td align="right"> 0.20%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9863s</td><td align="right">0.9900s</td><td align="right"> 0.37%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6018s</td><td align="right">1.6073s</td><td align="right"> 0.34%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.2493s</td><td align="right">6.2920s</td><td align="right"> 0.68%</td></tr><tr><td>Total</td><td align="right">10.8512s</td><td align="right">10.9127s</td><td align="right"> 0.57%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">1.0042s</td><td align="right"> 0.42%</td></tr></table>
2023-02-22Auto merge of #103042 - davidtwco:translation-distributed-ftl, r=oli-obkbors-0/+5
errors: generate typed identifiers in each crate Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. There are advantages and disadvantages to this change.. #### Advantages - Changing a diagnostic now only recompiles the crate for that diagnostic and those crates that depend on it, rather than `rustc_error_messages` and all crates thereafter. - This approach can be used to support first-party crates that want to supply translatable diagnostics (e.g. `rust-lang/thorin` in https://github.com/rust-lang/rust/pull/102612#discussion_r985372582, cc `@JhonnyBillM)` - We can extend this a little so that tools built using rustc internals (like clippy or rustdoc) can add their own diagnostic resources (much more easily than those resources needing to be available to `rustc_error_messages`) #### Disadvantages - Crates can only refer to the diagnostic messages defined in the current crate (or those from dependencies), rather than all diagnostic messages. - `rustc_driver` (or some other crate we create for this purpose) has to directly depend on *everything* that has error messages. - It already transitively depended on all these crates. #### Pending work - [x] I don't know how to make `rustc_codegen_gcc`'s translated diagnostics work with this approach - because `rustc_driver` can't depend on that crate and so can't get its resources to provide to the diagnostic emission. I don't really know how the alternative codegen backends are actually wired up to the compiler at all. - [x] Update `triagebot.toml` to track the moved FTL files. r? `@compiler-errors` cc #100717
2023-02-22errors: generate typed identifiers in each crateDavid Wood-0/+5
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Make query keys `Copy`John Kåre Alsaker-17/+18
2023-02-21Use a lock-free datastructure for `source_span`Oli Scherer-1/+1