Commit Graph

611 Commits

Author SHA1 Message Date
bors 947b696ce0 Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillot
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 22:10:10 +00:00
Maybe Waffle 8751fa1a9a if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
John Kåre Alsaker caf29b2727 Remove parallel compiler fix 2023-02-16 14:55:05 +01:00
John Kåre Alsaker 067bf2ac13 Move provider fields back to rustc_query_impl 2023-02-16 14:55:05 +01:00
John Kåre Alsaker a51a20531d Factor query arena allocation out from query caches 2023-02-16 14:54:53 +01:00
Matthias Krüger e087f61075 don't clone types that are copy 2023-02-15 23:34:25 +01:00
John Kåre Alsaker b3a4fe7d4e Pass DepContext and QueryContext by value when practical 2023-02-14 17:21:18 +01:00
John Kåre Alsaker 80d265240b Create a single value cache for the () query key 2023-02-11 23:38:01 +01:00
bors 9433ba6394 Auto merge of #107644 - Zoxc:query-cache-tweak, r=cjgillot
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-08 16:59:18 +00:00
John Kåre Alsaker d459840633 Remove QueryStorage::store_nocache 2023-02-07 17:36:01 +01:00
John Kåre Alsaker 9539737008 Make an optimal cold path for query_cache_hit 2023-02-06 15:22:12 +01:00
John Kåre Alsaker e60ccfc6a9 Don't inline query_cache_hit to reduce code size of the query hot path. 2023-02-06 13:52:17 +01:00
Camille GILLOT 635ff8e2a8 Support parallel compiler. 2023-02-04 15:56:50 +00:00
Camille GILLOT 128f2224af Remove OnHit callback from query caches.
This is not useful now that query results are `Copy`.
2023-02-04 15:21:21 +00:00
Michael Goulet bbf33836b9 Fingerprint even when incr comp is disabled in debug mode 2023-01-31 20:43:29 +00:00
Camille GILLOT 870dd1678e Use OnDrop. 2023-01-28 12:38:22 +00:00
Camille GILLOT e33e2d6e9e Attempt to reduce perf impact. 2023-01-28 11:47:15 +00:00
Camille GILLOT 87644d85a2 Print a backtrace when query forcing fails. 2023-01-28 11:42:46 +00:00
Maybe Waffle 6a28fb42a8 Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
nils fd7a159710 Fix uninlined_format_args for some compiler crates
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-05 19:01:12 +01:00
bors d6f99e535a Auto merge of #106307 - Nilstrieb:dynamic->static, r=cjgillot
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-02 20:12:16 +00:00
Nilstrieb 9fe4efe115 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-02 20:22:19 +01:00
Camille GILLOT 4719cb3036 Ignore span references from diagnostics.
The diagnostics are replayed at the correct place anyway.
2022-12-25 18:48:42 +00:00
Matthias Krüger d23cb738d2 Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
rustc: Remove needless lifetimes
2022-12-24 00:31:41 +01:00
bors c2ff8ad035 Auto merge of #105550 - gimbles:master, r=Nilstrieb
Use `DepKind` instead of `&'static str` in `QueryStackFrame`

`@rustbot` author

Fixes #105168
2022-12-23 16:57:21 +00:00
gimbles f8b30084ac Use DepKind instead of &str 2022-12-23 18:39:49 +05:30
Jeremy Stucki 3dde32ca97 rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
Nilstrieb 8bfd6450c7 A few small cleanups for newtype_index
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.
2022-12-18 21:47:28 +01:00
Nilstrieb 91c3c2040c Make #[max] an attribute in newtype_index 2022-12-18 21:22:14 +01:00
bors fbf8b937b4 Auto merge of #105233 - mejrs:always_eager, r=estebank
Always evaluate vecs of subdiagnostics eagerly

See https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/310186705 for context
2022-12-14 16:16:50 +00:00
KaDiWa 9bc69925cb compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Oli Scherer 75ff5c7dd3 Fold Definitions into the untracked data 2022-12-09 14:59:39 +00:00
Oli Scherer 1c1d3570ee Move the untracked cstore and source_span into a struct 2022-12-09 14:53:24 +00:00
Oli Scherer f693b7848e feed resolver_for_lowering instead of storing it in a field 2022-12-05 10:58:55 +00:00
mejrs a7838d8bd7 Always evaluate vecs of subdiagnostics eagerly 2022-12-04 01:13:21 +01:00
Oli Scherer ab75d777de Fill in def_span when creating def ids.
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the  `def_span` query
2022-12-01 10:33:28 +00:00
Camille GILLOT 9f2c6b0b09 Sanity check computed value for feeable queries. 2022-11-29 18:42:23 +00:00
Camille GILLOT ee7a9a8641 Expand hash check. 2022-11-29 18:41:55 +00:00
Camille GILLOT 5471381349 Allow to set a query's result as a side effect. 2022-11-29 18:40:59 +00:00
Camille GILLOT ca42dd6716 Sanity check fingerprints in the dep-graph. 2022-11-29 18:39:03 +00:00
Maybe Waffle 1d42936b18 Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
Matthias Krüger 4843946a10 Rollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obk
make `error_reported` check for delayed bugs

Fixes #104768

`error_reported()` was only checking if there were errors emitted, not for `delay_bug`s which can also be a source of `ErrorGuaranteed`. I assume the same is true of `lint_err_count` but i dont know
2022-11-24 21:34:54 +01:00
Boxy 72d8879c29 make error_reported check for delayed bugs 2022-11-24 11:12:46 +00:00
bors 341d8b8a2c Auto merge of #103808 - cjgillot:vec-cache, r=TaKO8Ki
Use an IndexVec to cache queries with index-like key

Revival of an old idea. Let's see if it has more effect.

r? `@ghost`
2022-11-24 06:32:23 +00:00
Camille GILLOT d47424b833 Hash spans when interning. 2022-11-11 13:02:37 +00:00
Nilstrieb 6d26ea86da Rename Ctxt and CTX to Tcx and Qcx
This makes it consistent and clear which context is used.
2022-11-06 13:25:06 +01:00
Nilstrieb 16558bd267 Rename tcx to qcx when it's a QueryContext 2022-11-06 13:25:06 +01:00
Nilstrieb 91971f293c Improve tracing logging 2022-11-06 13:25:06 +01:00
Nilstrieb 3da576804a Rename incremental_verify_ich_cold to incremental_verify_ich_failed 2022-11-06 13:10:35 +01:00
Nilstrieb 36be251a35 Merge QueryDescription into QueryConfig
`QueryDescription` has gone through a lot of refactoring and doesn't
make sense anymore.
2022-11-05 16:24:13 +01:00