rust/compiler
bors 61efe9d298 Auto merge of #111713 - Zoxc:lock-switch, r=nnethercote
Use conditional synchronization for Lock

This changes `Lock` to use synchronization only if `mode::is_dyn_thread_safe` could be true. This reduces overhead for the parallel compiler running with 1 thread.

The emitters are changed to use `DynSend` instead of `Send` so they can still use `Lock`.

A Rayon thread pool is not used with 1 thread anymore, as session globals contains `Lock`s which are no longer `Sync`.

Performance improvement with 1 thread and `cfg(parallel_compiler)`:
<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.7665s</td><td align="right">1.7336s</td><td align="right">💚  -1.86%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2780s</td><td align="right">0.2736s</td><td align="right">💚  -1.61%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9994s</td><td align="right">0.9824s</td><td align="right">💚  -1.70%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5875s</td><td align="right">1.5656s</td><td align="right">💚  -1.38%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.0682s</td><td align="right">5.9532s</td><td align="right">💚  -1.90%</td></tr><tr><td>Total</td><td align="right">10.6997s</td><td align="right">10.5083s</td><td align="right">💚  -1.79%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9831s</td><td align="right">💚  -1.69%</td></tr></table>

cc `@SparrowLii`
2023-08-30 08:03:43 +00:00
..
rustc
rustc_abi there seems to be no reason to treat ZST specially in these cases 2023-08-29 08:58:58 +02:00
rustc_arena
rustc_ast
rustc_ast_lowering RPITITs capture all their lifetimes 2023-08-28 01:05:34 +00:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_baked_icu_data
rustc_borrowck
rustc_builtin_macros Load include_bytes! directly into an Lrc 2023-08-27 20:16:19 -04:00
rustc_codegen_cranelift Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk 2023-08-29 20:49:02 +02:00
rustc_codegen_gcc Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk 2023-08-29 20:49:02 +02:00
rustc_codegen_llvm Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk 2023-08-29 20:49:02 +02:00
rustc_codegen_ssa Auto merge of #114114 - keith:ks/always-add-lc_build_version-for-metadata-object-files, r=wesleywiser 2023-08-29 21:17:13 +00:00
rustc_const_eval Rollup merge of #115272 - RalfJung:miri-error-print, r=saethlin 2023-08-30 07:18:11 +02:00
rustc_data_structures Use conditional synchronization for Lock 2023-08-30 06:10:02 +02:00
rustc_driver
rustc_driver_impl Rollup merge of #113565 - workingjubilee:better-signal-handler-message, r=pnkfelix 2023-08-30 07:18:10 +02:00
rustc_error_codes tell people what to do when removing an error code 2023-08-27 19:12:42 +02:00
rustc_error_messages
rustc_errors Use conditional synchronization for Lock 2023-08-30 06:10:02 +02:00
rustc_expand
rustc_feature Test variances of opaque captures 2023-08-28 01:05:34 +00:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir
rustc_hir_analysis Auto merge of #114908 - cjgillot:no-let-under, r=compiler-errors 2023-08-30 04:29:17 +00:00
rustc_hir_pretty
rustc_hir_typeck Remove allow_private entirely. 2023-08-29 16:36:13 -07:00
rustc_incremental
rustc_index
rustc_infer
rustc_interface Auto merge of #111713 - Zoxc:lock-switch, r=nnethercote 2023-08-30 08:03:43 +00:00
rustc_lexer
rustc_lint some more is_zst that should be is_1zst 2023-08-29 14:11:27 +02:00
rustc_lint_defs
rustc_llvm
rustc_log
rustc_macros
rustc_metadata Auto merge of #113542 - saethlin:adaptive-tables, r=b-naber 2023-08-30 02:40:37 +00:00
rustc_middle Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errors 2023-08-30 07:18:11 +02:00
rustc_mir_build
rustc_mir_dataflow
rustc_mir_transform Rollup merge of #115272 - RalfJung:miri-error-print, r=saethlin 2023-08-30 07:18:11 +02:00
rustc_monomorphize Auto merge of #114774 - Enselic:less-move-size-noise, r=oli-obk 2023-08-28 13:36:19 +00:00
rustc_parse Rollup merge of #115347 - y21:generic-bound-impl-trait-ty, r=compiler-errors 2023-08-30 07:18:12 +02:00
rustc_parse_format
rustc_passes
rustc_plugin_impl
rustc_privacy
rustc_query_impl Pass ErrorGuaranteed to cycle error 2023-08-27 22:03:00 +00:00
rustc_query_system Don't use wait_for_query without the Rayon thread pool 2023-08-30 06:10:02 +02:00
rustc_resolve RPITITs capture all their lifetimes 2023-08-28 01:05:34 +00:00
rustc_serialize
rustc_session Use conditional synchronization for Lock 2023-08-30 06:10:02 +02:00
rustc_smir Rollup merge of #115300 - spastorino:smir-tweaks, r=oli-obk 2023-08-29 20:49:05 +02:00
rustc_span Auto merge of #114489 - compiler-errors:rpitit-capture-all, r=oli-obk 2023-08-28 18:05:16 +00:00
rustc_symbol_mangling
rustc_target Auto merge of #114114 - keith:ks/always-add-lc_build_version-for-metadata-object-files, r=wesleywiser 2023-08-29 21:17:13 +00:00
rustc_trait_selection handle edge-case of a recursion limit of 0 2023-08-29 19:02:24 +00:00
rustc_traits
rustc_transmute
rustc_ty_utils some more is_zst that should be is_1zst 2023-08-29 14:11:27 +02:00
rustc_type_ir