about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
AgeCommit message (Collapse)AuthorLines
2023-05-31Auto merge of #111076 - ↵bors-3/+8
notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot diagnostics: exclude indirect private deps from trait impl suggest Fixes #88696
2023-05-28Add some commentsJohn Kåre Alsaker-0/+4
2023-05-28Don't access self.mask with a single shardJohn Kåre Alsaker-1/+1
2023-05-28Use only one shard with a single threadJohn Kåre Alsaker-10/+34
2023-05-25rustc_data_structures: sync and atomic consistencyMichael Howell-6/+6
Co-authored-by: @lukas-code
2023-05-25rustc_metadata: specialize private_dep flag with `fetch_and`Michael Howell-13/+4
2023-05-25rustc_metadata: use configurable AtomicBool for privateness flagMichael Howell-0/+14
This switches to using a `Cell` for single-threaded rustc.
2023-05-25Rollup merge of #111875 - WaffleLapkin:defer_on_drop, r=NilstriebMatthias Krüger-10/+16
Don't leak the function that is called on drop It probably wasn't causing problems anyway, but still, a `// this leaks, please don't pass anything that owns memory` is not sustainable. I could implement a version which does not require `Option`, but it would require `unsafe`, at which point it's probably not worth it.
2023-05-24Rollup merge of #111912 - WaffleLapkin:is_some_and_in_the_compiler, ↵Manish Goregaokar-1/+1
r=petrochenkov Use `Option::is_some_and` and `Result::is_ok_and` in the compiler `.is_some_and(..)`/`.is_ok_and(..)` replace `.map_or(false, ..)` and `.map(..).unwrap_or(false)`, making the code more readable. This PR is a sibling of https://github.com/rust-lang/rust/pull/111873#issuecomment-1561316515
2023-05-24Auto merge of #111673 - cjgillot:dominator-preprocess, r=cjgillot,tmiaskobors-10/+85
Preprocess and cache dominator tree Preprocessing dominators has a very strong effect for https://github.com/rust-lang/rust/pull/111344. That pass checks that assignments dominate their uses repeatedly. Using the unprocessed dominator tree caused a quadratic runtime (number of bbs x depth of the dominator tree). This PR also caches the dominator tree and the pre-processed dominators in the MIR cfg cache. Rebase of https://github.com/rust-lang/rust/pull/107157 cc `@tmiasko`
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-23Don't leak the function that is called on dropMaybe Waffle-10/+16
2023-05-20Auto merge of #111596 - cjgillot:dominator-bucket, r=Mark-Simulacrumbors-8/+35
Process current bucket instead of parent's bucket when starting loop for dominators. The linked paper by Georgiadis suggests in §2.2.3 to process `bucket[w]` when beginning the loop, instead of `bucket[parent[w]]` when finishing it. In the test case, we correctly computed `idom[2] = 0` and `sdom[3] = 1`, but the algorithm returned `idom[3] = 1`, instead of the correct value 0, because of the path 0-7-2-3. This provoked LLVM ICE in https://github.com/rust-lang/rust/pull/111061#issuecomment-1546912112. LLVM checks that SSA assignments dominate uses using its own implementation of Lengauer-Tarjan, and saw case where rustc was breaking the dominance property. r? `@Mark-Simulacrum`
2023-05-18Revert spurious changes.Camille GILLOT-9/+9
2023-05-18Rollup merge of #111707 - nnethercote:rm-WorkerLocal-Vec, r=compiler-errorsDylan DPC-7/+0
Remove unused `impl<T> WorkerLocal<Vec<T>>`. cc ``@SparrowLii`` ``@Zoxc``
2023-05-18Remove unused `impl<T> WorkerLocal<Vec<T>>`.Nicholas Nethercote-7/+0
2023-05-17Merge DominatorTree and Dominators.Camille GILLOT-36/+30
2023-05-17Typo.Camille GILLOT-1/+1
2023-05-17Remove outdated comment.Camille GILLOT-2/+0
2023-05-17Preprocess dominator tree to answer queries in O(1)Tomasz Miąsko-22/+105
2023-05-17Rollup merge of #110145 - WaffleLapkin:share_slice_of_bytes, r=NilstriebDylan DPC-13/+48
Share slice of bytes r? `@Nilstrieb` cc `@noamtashma`
2023-05-16Fixup commentsMaybe Waffle-4/+4
2023-05-16Remove `MetadataRef` type aliasMaybe Waffle-3/+0
2023-05-16Switch `OwnedSlice` to use `Lrc` & remove `Lrc` from `MetadataBlob`Maybe Waffle-4/+43
2023-05-16Merge `MetadataRef` type aliasesMaybe Waffle-4/+3
2023-05-15Process current bucket instead of parent's bucket when starting loop for ↵Camille GILLOT-8/+35
dominators.
2023-05-14Start node has no immediate dominatorTomasz Miąsko-14/+22
Change the immediate_dominator return type to Option, and use None to indicate that node has no immediate dominator. Also fix the issue where the start node would be returned as its own immediate dominator.
2023-05-13Auto merge of #107586 - SparrowLii:parallel-query, r=cjgillotbors-37/+464
Introduce `DynSend` and `DynSync` auto trait for parallel compiler part of parallel-rustc #101566 This PR introduces `DynSend / DynSync` trait and `FromDyn / IntoDyn` structure in rustc_data_structure::marker. `FromDyn` can dynamically check data structures for thread safety when switching to parallel environments (such as calling `par_for_each_in`). This happens only when `-Z threads > 1` so it doesn't affect single-threaded mode's compile efficiency. r? `@cjgillot`
2023-05-12Rollup merge of #111393 - klensy:win-0.48, r=oli-obkMatthias Krüger-2/+4
bump windows crate 0.46 -> 0.48 This drops duped version of crate(0.46), reduces `rustc_driver.dll` ~800kb and reduces exported functions number from 26k to 22k. Also while here, added `tidy-alphabetical` sorting to lists in tidy allowed lists.
2023-05-09bump windows crate 0.46 -> 0.48 in workspaceklensy-2/+4
2023-05-09Rollup merge of #111252 - matthewjasper:min-spec-improvements, r=compiler-errorsDylan DPC-0/+2
Min specialization improvements - Don't allow specialization impls with no items, such implementations are probably not correct and only occur as mistakes in the compiler and standard library - Fix a missing normalization call - Adds spans for lifetime errors from overly general specializations Closes #79457 Closes #109815
2023-05-07Use smaller ints for bitflagsNilstrieb-1/+1
2023-05-06add `DynSend / DynSync` for `CopyTaggedPtr`SparrowLii-5/+8
2023-05-06correct import of owned_sliceSparrowLii-13/+6
2023-05-06correct literals for dyn thread safeSparrowLii-21/+24
2023-05-06rename relative names in `sync`SparrowLii-23/+28
2023-05-06fix `parallel!`SparrowLii-0/+7
2023-05-06fix some nitsSparrowLii-39/+27
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-39/+467
2023-05-05Disallow (min) specialization imps with no itemsMatthew Jasper-0/+2
Such implementations are usually mistakes and are not used in the compiler or standard library (after this commit) so forbid them with `min_specialization`.
2023-04-30Use the full Fingerprint when stringifying SvhBen Kimock-5/+10
2023-04-27Auto merge of #107782 - Zoxc:worker-local, r=cjgillotbors-34/+188
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-27Rollup merge of #110814 - WaffleLapkin:sprinkle_#inline, r=NilstriebMatthias Krüger-0/+17
Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr` This is based on `nm --demangle (rustc +a --print sysroot)/lib/librustc_driver-*.so | rg CopyTaggedPtr` which shows many methods that should probably be inlined. May fix the regression in https://github.com/rust-lang/rust/pull/110795. r? ```@Nilstrieb```
2023-04-25Rollup merge of #110615 - WaffleLapkin:impl_tag, r=cjgillotMatthias Krüger-6/+204
Add `impl_tag!` macro to implement `Tag` for tagged pointer easily r? `@Nilstrieb` This should also lifts the need to think about safety from the callers (`impl_tag!` is robust (ish, see the macro issue)) and removes the possibility of making a "weird" `Tag` impl.
2023-04-25Add `#[inline]` in `impl_tag`Maybe Waffle-0/+2
2023-04-25Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`Maybe Waffle-0/+17
2023-04-24Switch `impl_tag!` from explicit tags to `${index()}`Maybe Waffle-47/+52
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-15/+16
2023-04-20Simplify `bits_for_tags` implMaybe Waffle-13/+3
2023-04-20Remove confusing commentMaybe Waffle-31/+0