about summary refs log tree commit diff
path: root/compiler/rustc_query_system
AgeCommit message (Collapse)AuthorLines
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/+35
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/+35
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-22Auto merge of #108300 - oli-obk:elsa, r=eholkbors-1/+1
Use a lock-free datastructure for source_span follow up to the perf regression in https://github.com/rust-lang/rust/pull/105462 The main regression is likely the CStore, but let's evaluate the perf impact of this on its own
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
2023-02-21Auto merge of #104754 - nnethercote:more-ThinVec-in-ast, r=the8472bors-1/+1
Use `ThinVec` more in the AST r? `@ghost`
2023-02-21Upgrade `thin-vec` from 0.2.9 to 0.2.12.Nicholas Nethercote-1/+1
Because 0.2.10 added supports for `ThinVec::splice`, and 0.2.12 is the latest release.
2023-02-20Make untracked.source_span lockable so that resolution can still write to it ↵Oli Scherer-1/+1
when using TyCtxt
2023-02-20Make untracked.cstore lockable so that resolution can still write to it when ↵Oli Scherer-1/+1
using TyCtxt
2023-02-18Auto merge of #107542 - ↵bors-1/+19
compiler-errors:param-envs-with-inference-vars-are-cursed, r=jackh726 Don't call `with_reveal_all_normalized` in const-eval when `param_env` has inference vars in it **what:** This slightly shifts the order of operations from an existing hack: https://github.com/rust-lang/rust/blob/5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb/compiler/rustc_middle/src/ty/consts/kind.rs#L225-L230 in order to avoid calling a tcx query (`TyCtxt::reveal_opaque_types_in_bounds`, via `ParamEnv::with_reveal_all_normalized`) when a param-env has inference variables in it. **why:** This allows us to enable fingerprinting of query keys/values outside of incr-comp in deubg mode, to make sure we catch other places where we're passing infer vars and other bad things into query keys. Currently that (bbf33836b9adfe4328aefa108c421e670a3923b7) crashes because we introduce inference vars into a param-env in the blanket-impl finder in rustdoc :sweat: https://github.com/rust-lang/rust/blob/5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb/src/librustdoc/clean/blanket_impl.rs#L43 See the CI failure here: https://github.com/rust-lang/rust/actions/runs/4058194838/jobs/6984834619
2023-02-17Don't allow evaluating queries that were fed in a previous compiler runOli Scherer-19/+6
2023-02-17Auto merge of #108058 - Zoxc:query-ctxtx-byval, r=cjgillotbors-11/+11
Pass `DepContext` and `QueryContext` by value when practical This removes some indirections for a minor performance improvement. <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.8294s</td><td align="right">1.8255s</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2667s</td><td align="right">0.2669s</td><td align="right"> 0.07%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.0080s</td><td align="right">1.0063s</td><td align="right"> -0.17%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6335s</td><td align="right">1.6295s</td><td align="right"> -0.24%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.3633s</td><td align="right">6.3344s</td><td align="right"> -0.45%</td></tr><tr><td>Total</td><td align="right">11.1009s</td><td align="right">11.0627s</td><td align="right"> -0.34%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9980s</td><td align="right"> -0.20%</td></tr></table>
2023-02-16Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillotbors-198/+30
Factor query arena allocation out from query caches This moves the logic for arena allocation out from the query caches into conditional code in the query system. The specialized arena caches are removed. A new `QuerySystem` type is added in `rustc_middle` which contains the arenas, providers and query caches. Performance seems to be slightly regressed: <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.8053s</td><td align="right">1.8109s</td><td align="right"> 0.31%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2600s</td><td align="right">0.2597s</td><td align="right"> -0.10%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9973s</td><td align="right">1.0006s</td><td align="right"> 0.34%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6048s</td><td align="right">1.6051s</td><td align="right"> 0.02%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.2992s</td><td align="right">6.3159s</td><td align="right"> 0.26%</td></tr><tr><td>Total</td><td align="right">10.9664s</td><td align="right">10.9922s</td><td align="right"> 0.23%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">1.0017s</td><td align="right"> 0.17%</td></tr></table> Incremental performance is a bit worse: <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:initial</td><td align="right">2.2103s</td><td align="right">2.2247s</td><td align="right"> 0.65%</td></tr><tr><td>🟣 <b>hyper</b>:check:initial</td><td align="right">0.3335s</td><td align="right">0.3349s</td><td align="right"> 0.41%</td></tr><tr><td>🟣 <b>regex</b>:check:initial</td><td align="right">1.2597s</td><td align="right">1.2650s</td><td align="right"> 0.42%</td></tr><tr><td>🟣 <b>syn</b>:check:initial</td><td align="right">2.0521s</td><td align="right">2.0613s</td><td align="right"> 0.45%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:initial</td><td align="right">7.8275s</td><td align="right">7.8583s</td><td align="right"> 0.39%</td></tr><tr><td>Total</td><td align="right">13.6832s</td><td align="right">13.7442s</td><td align="right"> 0.45%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">1.0046s</td><td align="right"> 0.46%</td></tr></table> It does seem like LLVM optimizers struggle a bit with the current state of the query system. Based on top of https://github.com/rust-lang/rust/pull/107782 and https://github.com/rust-lang/rust/pull/107802. r? `@cjgillot`
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-2/+1
2023-02-16Remove parallel compiler fixJohn Kåre Alsaker-4/+1
2023-02-16Move provider fields back to rustc_query_implJohn Kåre Alsaker-8/+6
2023-02-16Factor query arena allocation out from query cachesJohn Kåre Alsaker-196/+33
2023-02-15don't clone types that are copyMatthias Krüger-3/+3
2023-02-14Pass `DepContext` and `QueryContext` by value when practicalJohn Kåre Alsaker-11/+11
2023-02-11Create a single value cache for the () query keyJohn Kåre Alsaker-2/+48
2023-02-08Auto merge of #107644 - Zoxc:query-cache-tweak, r=cjgillotbors-37/+4
Remove QueryStorage::store_nocache This method was added in https://github.com/rust-lang/rust/pull/70674 but it doesn't seem to serve any purpose.
2023-02-07Remove QueryStorage::store_nocacheJohn Kåre Alsaker-37/+4
2023-02-06Make an optimal cold path for query_cache_hitJohn Kåre Alsaker-13/+5
2023-02-06Don't inline query_cache_hit to reduce code size of the query hot path.John Kåre Alsaker-1/+3
2023-02-04Support parallel compiler.Camille GILLOT-3/+3
2023-02-04Remove `OnHit` callback from query caches.Camille GILLOT-84/+45
This is not useful now that query results are `Copy`.
2023-01-31Fingerprint even when incr comp is disabled in debug modeMichael Goulet-1/+19
2023-01-28Use OnDrop.Camille GILLOT-39/+32
2023-01-28Attempt to reduce perf impact.Camille GILLOT-10/+17
2023-01-28Print a backtrace when query forcing fails.Camille GILLOT-11/+45
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-9/+9
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-31/+22
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-02Auto merge of #106307 - Nilstrieb:dynamic->static, r=cjgillotbors-95/+73
Abolish `QueryVTable` in favour of more assoc items on `QueryConfig` This may introduce additional mono _but_ may help const fold things better and especially may help not constructing a `QueryVTable` anymore which is cheap but not free.
2023-01-02Abolish `QueryVTable` in favour of more assoc items on `QueryConfig`Nilstrieb-95/+73
This may introduce additional mono _but_ may help const fold things better and especially may help not constructing a `QueryVTable` anymore which is cheap but not free.
2022-12-25Ignore span references from diagnostics.Camille GILLOT-2/+4
The diagnostics are replayed at the correct place anyway.
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-2/+2
rustc: Remove needless lifetimes
2022-12-23Auto merge of #105550 - gimbles:master, r=Nilstriebbors-92/+116
Use `DepKind` instead of `&'static str` in `QueryStackFrame` `@rustbot` author Fixes #105168
2022-12-23Use DepKind instead of &strgimbles-92/+116
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-4/+3
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.