about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync
AgeCommit message (Collapse)AuthorLines
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-385/+230
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-4/+4
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-4/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-24/+24
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-30Apply x clippy --fix and x fmtr0cky-1/+1
2024-03-20Workaround for rustdoc bug in new betaMark Rousskov-0/+1
Filed #122758 to track a proper fix, but this seems to solve the problem in the meantime and is probably OK in terms of impact on (internal) doc quality.
2024-03-04Rollup merge of #120976 - matthiaskrgr:constify_TL_statics, r=lcnrMatthias Krüger-1/+1
constify a couple thread_local statics
2024-02-15Use generic `NonZero` internally.Markus Reiter-3/+3
2024-02-12constify a couple thread_local staticsMatthias Krüger-1/+1
2023-11-23Enforce NonZeroUsize on thread countMark Rousskov-4/+7
This allows avoiding some if != 0 checks when allocating worker-local datasets.
2023-11-14Fix some typoscui fliter-2/+2
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-09Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkovbors-13/+26
Make `FatalErrorMarker` lower priority than other panics This makes `FatalErrorMarker` lower priority than other panics in a parallel sections. If any other panics occur, they will be unwound instead of `FatalErrorMarker`. This ensures `rustc` will exit with the correct error code on ICEs. This fixes https://github.com/rust-lang/rust/issues/116659.
2023-11-03Make `FatalErrorMarker` lower priority than other panicsJohn Kåre Alsaker-13/+26
2023-11-03Use `filter_map` in `try_par_for_each_in`Josh Stone-7/+6
This simplifies the expression, especially for the rayon part, and also lets us drop the `E: Copy` constraint.
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-0/+29
2023-09-25Rename `cold_path` to `outline`John Kåre Alsaker-6/+2
2023-09-11Rollup merge of #115548 - Zoxc:parallel-extract, r=wesleywiserMatthias Krüger-0/+188
Extract parallel operations in `rustc_data_structures::sync` into a new `parallel` submodule This extracts parallel operations in `rustc_data_structures::sync` into a new `parallel` submodule. This cuts down on the size of the large `cfg_if!` in `sync` and makes it easier to compare between serial and parallel variants.
2023-09-11Auto merge of #115388 - Zoxc:sharded-lock, r=SparrowLiibors-188/+187
Add optimized lock methods for `Sharded` and refactor `Lock` This adds methods to `Sharded` which pick a shard and also locks it. These branch on parallelism just once instead of twice, improving performance. Benchmark for `cfg(parallel_compiler)` and 1 thread: <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.6461s</td><td align="right">1.6345s</td><td align="right"> -0.70%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2414s</td><td align="right">0.2394s</td><td align="right"> -0.83%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9205s</td><td align="right">0.9143s</td><td align="right"> -0.67%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.4981s</td><td align="right">1.4869s</td><td align="right"> -0.75%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.7629s</td><td align="right">5.7256s</td><td align="right"> -0.65%</td></tr><tr><td>Total</td><td align="right">10.0690s</td><td align="right">10.0008s</td><td align="right"> -0.68%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9928s</td><td align="right"> -0.72%</td></tr></table> cc `@SparrowLii`
2023-09-09Use `FreezeLock` for `CStore`John Kåre Alsaker-16/+45
2023-09-08Add Freeze::cloneJohn Kåre Alsaker-0/+10
2023-09-08Remove the `LockMode` enum and `dispatch`John Kåre Alsaker-102/+74
2023-09-08Refactor `Lock` implementationJohn Kåre Alsaker-240/+208
2023-09-08Add optimized lock methods for `Sharded`John Kåre Alsaker-14/+73
2023-09-07Use `Freeze` for `SourceFile.lines`John Kåre Alsaker-0/+12
2023-09-07Use `Freeze` for `SourceFile.external_src`John Kåre Alsaker-3/+44
2023-09-06Use a reference to the lock in the guardsJohn Kåre Alsaker-15/+14
2023-09-06Extract parallel operations in `rustc_data_structures::sync` into a new ↵John Kåre Alsaker-0/+188
`parallel` submodule
2023-09-02Rename `Freeze` to `FreezeLock`John Kåre Alsaker-7/+7
2023-09-02Add some commentsJohn Kåre Alsaker-1/+4
2023-09-02Use `RwLock` for `Freeze`John Kåre Alsaker-8/+10
2023-09-02Add `Freeze` type and use it to store `Definitions`John Kåre Alsaker-0/+104
2023-08-30Use conditional synchronization for LockJohn Kåre Alsaker-3/+279
2023-08-22Fix races conditions with `SyntaxContext` decodingJohn Kåre Alsaker-0/+6
2023-08-01Rollup merge of #114283 - oli-obk:parkin_lot_rwlock, r=SparrowLiiMatthias Krüger-21/+7
Use parking lot's rwlock even without parallel-rustc Considering that this doesn't affect perf, I think we should use the simplest solution.
2023-08-01Always use parking_lot's RwLock, even without parallel compilerOli Scherer-21/+7
2023-07-31remove repetitive wordscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-18Remove unused `impl<T> WorkerLocal<Vec<T>>`.Nicholas Nethercote-7/+0
2023-04-27Auto merge of #107782 - Zoxc:worker-local, r=cjgillotbors-0/+180
Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structures This PR moves the definition of the `WorkerLocal` type from `rustc-rayon` into `rustc_data_structures`. This is enabled by the introduction of the `Registry` type which allows you to group up threads to be used by `WorkerLocal` which is basically just an array with an per thread index. The `Registry` type mirrors the one in Rayon and each Rayon worker thread is also registered with the new `Registry`. Safety for `WorkerLocal` is ensured by having it keep a reference to the registry and checking on each access that we're still on the group of threads associated with the registry used to construct it. Accessing a `WorkerLocal` is micro-optimized due to it being hot since it's used for most arena allocations. Performance is slightly improved for the 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.9992s</td><td align="right">1.9949s</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2977s</td><td align="right">0.2970s</td><td align="right"> -0.22%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.1335s</td><td align="right">1.1315s</td><td align="right"> -0.18%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.8235s</td><td align="right">1.8171s</td><td align="right"> -0.35%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.9047s</td><td align="right">6.8930s</td><td align="right"> -0.17%</td></tr><tr><td>Total</td><td align="right">12.1586s</td><td align="right">12.1336s</td><td align="right"> -0.21%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9977s</td><td align="right"> -0.23%</td></tr></table> cc `@SparrowLii`
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-16Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structuresJohn Kåre Alsaker-0/+180
2023-04-09Fix some clippy::complexityNilstrieb-1/+1
2023-04-04Another AppendOnlyVecOli Scherer-10/+21
2023-04-04Replace another lock with an append-only vecOli Scherer-0/+16
2023-04-04Remove a lock in favor of an AppendOnlyVecOli Scherer-2/+7
2023-04-04Add a usize-indexed append-only-vecOli Scherer-2/+34
2023-02-21Use a lock-free datastructure for `source_span`Oli Scherer-0/+41