rust/compiler
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
..
rustc Add a new rustc_driver dylib to rexport rustc_driver_impl 2023-02-02 07:34:41 +01:00
rustc_abi Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki 2023-02-15 12:24:54 +05:30
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast rustc_ast: Merge impls and reorder methods for attributes and meta items 2023-02-11 23:23:17 +04:00
rustc_ast_lowering Better label for illegal impl trait types 2023-02-14 23:12:27 +00:00
rustc_ast_passes Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_ast_pretty Expand const-if-const trait bounds correctly 2023-02-07 21:00:12 +00:00
rustc_attr Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_baked_icu_data update ICU4X to 1.1.0 2023-02-04 22:28:59 +01:00
rustc_borrowck Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_builtin_macros Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_codegen_cranelift if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_codegen_gcc s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_llvm Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_codegen_ssa Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_const_eval Auto merge of #108096 - matthiaskrgr:rollup-ncexzf6, r=matthiaskrgr 2023-02-16 00:12:54 +00:00
rustc_data_structures if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Remove save-analysis. 2023-02-16 15:14:45 +11:00
rustc_error_codes Add extended error message for E0523 2023-02-06 06:58:30 -05:00
rustc_error_messages Remove save-analysis. 2023-02-16 15:14:45 +11:00
rustc_errors Rollup merge of #108090 - WaffleLapkin:if_not_now_then_when…, r=oli-obk 2023-02-16 17:51:25 +01:00
rustc_expand Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_feature note issue for feature(packed_bundled_libs) 2023-02-16 14:09:55 +03:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_hir_analysis Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_hir_pretty Use Mutability::{is_mut, is_not} 2023-01-30 12:26:26 +00:00
rustc_hir_typeck Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_incremental incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
rustc_index Fix IndexVec::drain_enumerated 2023-01-19 15:25:33 +00:00
rustc_infer Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_interface Move provider fields back to rustc_query_impl 2023-02-16 14:55:05 +01:00
rustc_lexer Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
rustc_lint Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_lint_defs Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_llvm Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
rustc_log Rollup merge of #107895 - matthiaskrgr:cl, r=compiler-errors 2023-02-11 17:18:44 +01:00
rustc_macros Use derive attributes for uninteresting traversals 2023-02-14 15:09:40 +00:00
rustc_metadata Factor query arena allocation out from query caches 2023-02-16 14:54:53 +01:00
rustc_middle Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillot 2023-02-16 22:10:10 +00:00
rustc_mir_build Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_mir_dataflow Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_mir_transform Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_monomorphize Move query out of path. 2023-02-14 20:27:38 +00:00
rustc_parse Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_parse_format Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_passes Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_plugin_impl Migrate all diagnostics 2022-10-23 10:09:44 +02:00
rustc_privacy Add of_trait to DefKind::Impl. 2023-02-14 19:55:44 +00:00
rustc_query_impl Move provider fields back to rustc_query_impl 2023-02-16 14:55:05 +01:00
rustc_query_system Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillot 2023-02-16 22:10:10 +00:00
rustc_resolve Rollup merge of #108099 - matthiaskrgr:str_to_char, r=GuillaumeGomez 2023-02-16 17:51:26 +01:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_smir Only keep one version of ImplicitSelfKind. 2022-09-13 19:18:23 +02:00
rustc_span Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_symbol_mangling if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_target Rollup merge of #107968 - ian-h-chamberlain:feature/3ds-enable-thread-local, r=Nilstrieb 2023-02-15 12:24:55 +05:30
rustc_trait_selection Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_traits Add specialized variants of mk_region. 2023-02-15 09:02:44 +11:00
rustc_transmute s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_ty_utils Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr 2023-02-16 19:21:02 +00:00
rustc_type_ir simplify some refs 2023-02-15 23:48:01 +01:00