about summary refs log tree commit diff
path: root/compiler/rustc_query_system
AgeCommit message (Collapse)AuthorLines
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-3/+5
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-28Rollup merge of #116534 - cjgillot:no-dep-tasks, r=davidtwcoJubilee-22/+4
Remove -Zdep-tasks. This option is not useful any more, we can use `tracing` and `RUSTC_LOG` to debug the dep-graph.
2023-10-26Stash and cancel cycle errors for auto trait leakage in opaquesMichael Goulet-1/+13
2023-10-22fix broken link: update incremental compilation urlgvozdvmozgu-1/+1
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-10-08Remove -Zdep-tasks.Camille GILLOT-22/+4
2023-10-03Rollup merge of #115863 - chenyukang:yukang-add-message-tidy-check, r=davidtwcoMatthias Krüger-2/+0
Add check_unused_messages in tidy From https://github.com/rust-lang/rust/pull/115728#issuecomment-1715490553 The check is not 100% accurate, I guess it's enough for now.
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-3/+1
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-26Don't store lazyness in DefKindMichael Goulet-3/+1
2023-09-25Rename `cold_path` to `outline`John Kåre Alsaker-2/+2
2023-09-21Move `DepKind` to `rustc_query_system` and define it as `u16`John Kåre Alsaker-331/+364
2023-09-20Auto merge of #115542 - saethlin:fileencoder-is-bufwriter, r=WaffleLapkinbors-3/+5
Simplify/Optimize FileEncoder FileEncoder is basically a BufWriter except that it exposes access to the not-written-to-yet region of the buffer so that some users can write directly to the buffer. This strategy is awesome because it lets us avoid calling memcpy for small copies, but the previous strategy was based on the writer accessing a `&mut [MaybeUninit<u8>; N]` and returning a `&[u8]` which is an API which currently mandates the use of unsafe code, making that interface in general not that appealing. So this PR cleans up the FileEncoder implementation and builds on that general idea of direct buffer access in order to prevent `memcpy` calls in a few key places when encoding the dep graph and rmeta tables. The interface used here is now 100% safe, but with the caveat that internally we need to avoid trusting the number of bytes that the provided function claims to have written. The original primary objective of this PR was to clean up the FileEncoder implementation so that the fix for the following issues would be easy to implement. The fix for these issues is to correctly update self.buffered even when writes fail, which I think it's easy to verify manually is now done, because all the FileEncoder methods are small. Fixes https://github.com/rust-lang/rust/issues/115298 Fixes https://github.com/rust-lang/rust/issues/114671 Fixes https://github.com/rust-lang/rust/issues/114045 Fixes https://github.com/rust-lang/rust/issues/108100 Fixes https://github.com/rust-lang/rust/issues/106787
2023-09-20PR feedbackBen Kimock-4/+1
2023-09-20Cleanup unused messages in ftl filesyukang-2/+0
2023-09-12Use `UnhashMap` for the indexJohn Kåre Alsaker-2/+3
2023-09-12Encode the number of dep kinds encountered in the dep graphJohn Kåre Alsaker-3/+15
2023-09-12Store a index per dep node kindJohn Kåre Alsaker-7/+14
2023-09-10Reimplement FileEncoder with a small-write optimizationBen Kimock-3/+8
2023-09-11Auto merge of #115388 - Zoxc:sharded-lock, r=SparrowLiibors-16/+10
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-10Auto merge of #115668 - Zoxc:deadlock-msg, r=jackh726bors-1/+3
Make the deadlock panic clearly refer to a deadlock
2023-09-08Make the deadlock panic clearly refer to a deadlockJohn Kåre Alsaker-1/+3
2023-09-08Add optimized lock methods for `Sharded`John Kåre Alsaker-16/+10
2023-09-07Use `Freeze` for `SourceFile.lines`John Kåre Alsaker-4/+5
2023-09-07Auto merge of #110050 - saethlin:better-u32-encoding, r=nnethercotebors-43/+381
Use a specialized varint + bitpacking scheme for DepGraph encoding The previous scheme here uses leb128 to encode the edge tables that represent the incr comp dependency graph. The problem with that scheme is that leb128 has overhead for larger values, and generally relies on the distribution of encoded values being heavily skewed towards smaller values. That is definitely not the case for a dep node index, since they are handed out sequentially and the whole range is covered, the distribution is actually biased in the opposite direction: Most dep nodes are large. This PR implements a different varint encoding scheme. Instead of applying varint encoding to individual dep node indices (which is extremely branchy) we now apply it per node. While being built, each node now stores its edges in a `SmallVec` with a bit of extra logic to track the max value of each edge. Then we varint encode the whole batch. This is a gamble: We save on space by only claiming 2 bits per node instead of ~3 bits per edge which is a nice savings but needs to balance out with the space overhead that a single large index in a node with a lot of edges will encode unnecessary bytes in each of that node's edge indices. Then, to keep the runtime overhead of this encoding scheme down we deserialize our indices by loading 4 bytes for each then masking off the bytes that are't ours. This is much less code and branches than leb128, but relies on having some readable bytes past the end of each edge list. We explicitly add such padding to the in-memory data during decoding. And we also do this decoding lazily, turning a dense on-disk encoding into a peak memory reduction. Then we apply a bit-packing scheme; since in https://github.com/rust-lang/rust/pull/115391 we now have unused bits on `DepKind`, we use those unused bits (currently there are 7!) to store the 2 bits that we need for the byte width of the edges in each node, then use the remaining bits to store the length of the edge list, if it fits. r? `@nnethercote`
2023-09-06Add comments with the same level of detail as the PR descriptionBen Kimock-12/+54
2023-09-04Use a specialized varint + bitpacking scheme for DepGraph encodingBen Kimock-44/+340
2023-09-03Use relative positions inside a SourceFile.Camille GILLOT-33/+7
2023-09-01Use `OnceLock` for `SingleCache`John Kåre Alsaker-6/+6
2023-08-30Don't use `wait_for_query` without the Rayon thread poolJohn Kåre Alsaker-13/+13
2023-08-29Auto merge of #114894 - Zoxc:sharded-cfg-cleanup2, r=cjgillotbors-47/+10
Remove conditional use of `Sharded` from query state `Sharded` is already a zero cost abstraction, so it shouldn't affect the performance of the single thread compiler if LLVM does its job. r? `@cjgillot`
2023-08-27Pass ErrorGuaranteed to cycle errorMichael Goulet-6/+10
2023-08-25Fix waiting on a query that panickedJohn Kåre Alsaker-1/+12
2023-08-24Optimize `lock_shards`John Kåre Alsaker-9/+5
2023-08-24Remove conditional use of `Sharded` from query stateJohn Kåre Alsaker-43/+10
2023-08-24Auto merge of #114860 - Zoxc:sharded-layout, r=SparrowLiibors-1/+1
Make `Sharded` an enum and specialize it for the single thread case This changes `Sharded` to use a single shard by an enum, reducing the size of `Sharded` for greater cache efficiency. 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.7009s</td><td align="right">1.6748s</td><td align="right">💚 -1.53%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2525s</td><td align="right">0.2451s</td><td align="right">💚 -2.90%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9519s</td><td align="right">0.9353s</td><td align="right">💚 -1.74%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5504s</td><td align="right">1.5280s</td><td align="right">💚 -1.45%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.9536s</td><td align="right">5.8873s</td><td align="right">💚 -1.11%</td></tr><tr><td>Total</td><td align="right">10.4092s</td><td align="right">10.2706s</td><td align="right">💚 -1.33%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9825s</td><td align="right">💚 -1.75%</td></tr></table> I did see an unexpected 0.23% change for the serial compiler, so this could use a perf run to see if that reproduces. cc `@SparrowLii`
2023-08-16Remove conditional use of `Sharded` from query cachesJohn Kåre Alsaker-49/+7
2023-08-16Keep SHARDS fixed instead of a function of `cfg!(parallel_compiler)`John Kåre Alsaker-1/+1
2023-08-13Pass WorkProductMap to build_dep_graph instead of FxIndexMapbjorn3-5/+7
Constructing an FxIndexMap is useless work as the iteration order never matters.
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-1/+4
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+4
2023-08-04replace few explicit use of parking_lot with rustc_data_structures::sync oncesklensy-14/+12
2023-08-03bump parking_lot 0.11 to 0.12klensy-1/+1
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-2/+2
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-2/+1
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21add `naive_layout_of` queryMoulins-1/+2
2023-07-20Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obkbors-0/+4
add links to query documentation for E0391 This PR adds links to https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for the rustc --explain E0391 and within the compiler error itself. Fixes: #113184
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-12/+33
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-1/+3
2023-07-18added links as a notenxya-1/+3
2023-07-18add links to query documentation for E0391nxya-1/+1