about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
AgeCommit message (Collapse)AuthorLines
2025-09-08fixup limit handling codeJana Dönszelmann-1/+1
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+0
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-10/+10
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28use let chains in mir, resolve, targetKivooeo-10/+10
2025-07-24Use LocalKey<Cell> methods moreCameron Steffen-2/+2
2025-07-05use `is_multiple_of` instead of manual moduloFolkert de Vries-1/+1
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-20Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obkTrevor Gross-5/+5
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool` This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations. **Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements. r? oli-obk
2025-06-11Do not clone Arc when hashing span.Camille GILLOT-4/+4
2025-06-11Use `rustc_thread_pool` instead of `rustc-rayon-core`Celina G. Val-5/+5
2025-06-08Remove all unused feature gates from the compilerbjorn3-1/+0
2025-06-03Ensure query keys are printed with reduced queriesMichael Goulet-5/+8
2025-05-14Handle `rustc_query_system` cases of `rustc::potential_query_instability` lintismailarilik-1/+9
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-07Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obkbors-171/+287
Use thread local dep graph encoding This adds thread local encoding of dep graph nodes. Each thread has a `MemEncoder` that gets flushed to the global `FileEncoder` when it exceeds 64 kB. Each thread also has a local cache of dep indices. This means there can now be empty gaps in `SerializedDepGraph`. Indices are marked green and also allocated by the new atomic operation `DepNodeColorMap::try_mark_green` as the encoder lock is removed.
2025-05-06Use the portable `AtomicU64`John Kåre Alsaker-2/+2
2025-05-06Rename `graph::implementation::Graph` to `LinkedGraph`Zalathar-3/+3
2025-05-05Add some comments about thread local indicesJohn Kåre Alsaker-1/+5
2025-05-05Tweak index chunk allocationJohn Kåre Alsaker-5/+9
2025-05-01Add some commentsJohn Kåre Alsaker-1/+3
2025-05-01Use thread local dep graph encodingJohn Kåre Alsaker-170/+276
2025-04-29Add some commentsJohn Kåre Alsaker-0/+2
2025-04-29Add a jobserver proxy to ensure at least one token is always heldJohn Kåre Alsaker-6/+10
2025-04-25Auto merge of #139756 - Zoxc:out-of-order-dep-graph, r=oli-obkbors-43/+85
Allow out of order dep graph node encoding This allows out of order dep graph node encoding by also encoding the index instead of using the file node order as the index. `MemEncoder` is also brought back to life and used for encoding. Both of these are done to enable thread-local encoding of dep graph nodes. This is based on https://github.com/rust-lang/rust/pull/139636.
2025-04-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-22Make sure there's no duplicate indices in the dep graphJohn Kåre Alsaker-1/+5
2025-04-22Tweak edgesJohn Kåre Alsaker-8/+5
2025-04-22Use `IndexVec::from_elem_n`John Kåre Alsaker-10/+7
2025-04-22Add index to the dep graph format and encode via `MemEncoder`John Kåre Alsaker-39/+83
2025-04-17Rollup merge of #139236 - Zoxc:anon-counter, r=davidtwcoMatthias Krüger-8/+16
Use a session counter to make anon dep nodes unique This changes the unique session hash used to ensure unique anon dep nodes per session from a timestamp to a counter. This is nicer for debugging as it makes the dep graph deterministic.
2025-04-13Rollup merge of #139636 - Zoxc:graph-edges-len-u32, r=compiler-errorsJacob Pratt-8/+10
Encode dep node edge count as u32 instead of usize This encodes the dep node edge count as u32 instead of usize. It doesn't need to be usize as the count is limited the the unique number of dep nodes which we use a 32-bit index for. It probably saves some branches for encoding / decoding, but it isn't too hot as the count gets packed in with other fields when it's low. <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th><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><td align="right">Physical Memory</td><td align="right">Physical Memory</td><td align="right">%</th><td align="right">Committed Memory</td><td align="right">Committed Memory</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.3343s</td><td align="right">0.3343s</td><td align="right"> -0.00%</td><td align="right">97.02 MiB</td><td align="right">96.89 MiB</td><td align="right"> -0.13%</td><td align="right">167.93 MiB</td><td align="right">167.80 MiB</td><td align="right"> -0.08%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1353s</td><td align="right">0.1350s</td><td align="right"> -0.19%</td><td align="right">61.91 MiB</td><td align="right">61.83 MiB</td><td align="right"> -0.13%</td><td align="right">124.64 MiB</td><td align="right">124.64 MiB</td><td align="right"> 0.00%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.2479s</td><td align="right">0.2481s</td><td align="right"> 0.10%</td><td align="right">78.34 MiB</td><td align="right">78.35 MiB</td><td align="right"> 0.02%</td><td align="right">145.20 MiB</td><td align="right">145.31 MiB</td><td align="right"> 0.08%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.5347s</td><td align="right">0.5333s</td><td align="right"> -0.26%</td><td align="right">118.63 MiB</td><td align="right">118.66 MiB</td><td align="right"> 0.02%</td><td align="right">193.05 MiB</td><td align="right">193.11 MiB</td><td align="right"> 0.03%</td></tr><tr><td>Total</td><td align="right">1.2521s</td><td align="right">1.2507s</td><td align="right"> -0.11%</td><td align="right">355.90 MiB</td><td align="right">355.74 MiB</td><td align="right"> -0.05%</td><td align="right">630.83 MiB</td><td align="right">630.87 MiB</td><td align="right"> 0.01%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9991s</td><td align="right"> -0.09%</td><td align="right">1 byte</td><td align="right">1.00 bytes</td><td align="right"> -0.06%</td><td align="right">1 byte</td><td align="right">1.00 bytes</td><td align="right"> 0.01%</td></tr></table>
2025-04-10Encode dep node edge count as u32 instead of usizeJohn Kåre Alsaker-8/+10
2025-04-05Reuse the index from promoted nodes when coloring executed tasksJohn Kåre Alsaker-36/+88
2025-04-02Add a dep kind for use of the anon node with zero dependenciesJohn Kåre Alsaker-5/+8
2025-04-02Use a session counter to make anon dep nodes uniqueJohn Kåre Alsaker-8/+16
2025-03-30Encode synthetic by-move coroutine body with a different DefPathDataMichael Goulet-3/+4
2025-03-27Rollup merge of #138844 - petrochenkov:cfgtrace2, r=nnethercoteJacob Pratt-1/+1
expand: Leave traces when expanding `cfg` attributes This is the same as https://github.com/rust-lang/rust/pull/138515, but for `cfg(true)` instead of `cfg_attr`. The difference is that `cfg(true)`s already left "traces" after themselves - the `cfg` attributes themselves, with `expanded_inert_attrs` set to true, with full tokens, available to proc macros. This is not a reasonably expected behavior, but it could not be removed without a replacement, because a [major rustdoc feature](https://github.com/rust-lang/rfcs/pull/3631) and a number of clippy lints rely on it. This PR implements a replacement. This needs a crater run, because it changes observable behavior (in an intended way) - proc macros can no longer see expanded `cfg(true)` attributes. (Some minor unnecessary special casing for `sym::cfg_attr` is also removed in this PR.) r? `@nnethercote`
2025-03-27Rollup merge of #138672 - Zoxc:deferred-queries-in-deadlock-handler, r=oli-obkStuart Cook-100/+217
Avoiding calling queries when collecting active queries This PR changes active query collection to no longer call queries. Instead the fields needing queries have their computation delayed to when an cycle error is emitted or when printing the query backtrace in a panic. This is done by splitting the fields in `QueryStackFrame` needing queries into a new `QueryStackFrameExtra` type. When collecting queries `QueryStackFrame` will contain a closure that can create `QueryStackFrameExtra`, which does make use of queries. Calling `lift` on a `QueryStackFrame` or `CycleError` will convert it to a variant containing `QueryStackFrameExtra` using those closures. This also only calls queries needed to collect information on a cycle errors, instead of information on all active queries. Calling queries when collecting active queries is a bit odd. Calling queries should not be done in the deadlock handler at all. This avoids the out of memory scenario in https://github.com/rust-lang/rust/issues/124901.
2025-03-26Auto merge of #138824 - Zoxc:dep-graph-no-prev-map, r=oli-obkbors-185/+144
Remove `prev_index_to_index` field from `CurrentDepGraph` The dep graph currently has 2 ways to map a previous index into a current index. The `prev_index_to_index` map stores the current index equivalent of a previous index. For indices which are marked green, we also store the same information in the `DepNodeColorMap`. We actually only need to known the mapping for green nodes however, so this PR removes `prev_index_to_index` and instead makes use of the `DepNodeColorMap`. To avoid racing when promoting a node from the previous session, the encoder lock is now used to ensure only one thread encodes the promoted node. This was previously done by the lock in `prev_index_to_index`. This also changes `nodes_newly_allocated_in_current_session` used to detect duplicate dep nodes to contain both new and previous nodes, which is simpler and can better catch duplicates. The dep node index encoding used in `DepNodeColorMap` is tweak to avoid subtraction / addition to optimize accessing the current equivalent of a previous index. r? `@oli-obk`
2025-03-26expand: Leave traces when expanding `cfg` attributesVadim Petrochenkov-1/+1
2025-03-26Use a function to create `QueryStackDeferred` to ensure context is CopyJohn Kåre Alsaker-3/+7
2025-03-26Avoiding calling queries when collecting active queriesJohn Kåre Alsaker-100/+213
2025-03-25Rollup merge of #138874 - Zoxc:waiter-race, r=SparrowLii,davidtwcoJacob Pratt-25/+12
Batch mark waiters as unblocked when resuming in the deadlock handler This fixes a race when resuming multiple threads to resolve query cycles. This now marks all threads as unblocked before resuming any of them. Previously if one was resumed and marked as unblocked at a time. The first thread resumed could fall asleep then Rayon would detect a second false deadlock. Later the initial deadlock handler thread would resume further threads. This also reverts the workaround added in https://github.com/rust-lang/rust/pull/137731. cc `@SparrowLii` `@lqd`
2025-03-25Rollup merge of #138581 - Zoxc:abort-handler-if-locked, r=SparrowLiiMatthias Krüger-4/+12
Abort in deadlock handler if we fail to get a query map Resolving query cycles requires the complete active query map, or it may miss query cycles. We did not check that the map is completely constructed before. If there is some error collecting the map, something has gone wrong already. This adds a check to abort/panic if we fail to construct the complete map. This can help differentiate errors from the `deadlock detected` case if constructing query map has errors in practice. An `Option` is not used for `collect_active_jobs` as the panic handler can still make use of a partial map.
2025-03-24Remove `prev_index_to_index` field from `CurrentDepGraph`John Kåre Alsaker-185/+144
2025-03-24Auto merge of #138629 - Zoxc:graph-anon-hashmap, r=oli-obkbors-49/+115
Only use the new node hashmap for anonymous nodes This is a rebase of https://github.com/rust-lang/rust/pull/112469. cc `@cjgillot`
2025-03-24Remove `QueryWaiter::notify`John Kåre Alsaker-8/+2
2025-03-24Batch mark waiters as unblocked when resuming in the deadlock handlerJohn Kåre Alsaker-2/+8
2025-03-24Revert "resume one waiter at a call"John Kåre Alsaker-15/+2
This reverts commit cc1e4ede9388d87750c3751f41e8c6c4f6cae995.
2025-03-21Address commentsJohn Kåre Alsaker-4/+8