summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src/plumbing.rs
AgeCommit message (Collapse)AuthorLines
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-2/+2
2022-07-06Use a dedicated DepKind for the forever-red node.Camille GILLOT-0/+11
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-5/+6
2022-07-06Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-deadDylan DPC-5/+8
Only compute DefKind through the query.
2022-07-05Clarify the behaviour from inside the query system.Camille GILLOT-5/+8
2022-07-04Only compute DefKind through the query.Camille GILLOT-1/+1
2022-06-29get rid of `tcx` in deadlock handler when parallel compilationSparrowLii-5/+0
2022-06-16Move `finish` out of the `Encoder` trait.Nicholas Nethercote-2/+1
This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.)
2022-06-10Revert dc08bc51f2c58a0f5f815a07f9bb3d671153b5a1.Nicholas Nethercote-1/+2
2022-06-08Move `finish` out of the `Encoder` trait.Nicholas Nethercote-2/+1
This simplifies things, but requires making `CacheEncoder` non-generic.
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-4/+2
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-05-04Enable tracing for all queryiesOli Scherer-0/+3
2022-02-27Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillotbors-3/+2
Avoid query cache sharding code in single-threaded mode In non-parallel compilers, this is just adding needless overhead at compilation time (since there is only one shard statically anyway). This amounts to roughly ~10 seconds reduction in bootstrap time, with overall neutral (some wins, some losses) performance results. Parallel compiler performance should be largely unaffected by this PR; sharding is kept there.
2022-02-21Auto merge of #94066 - Mark-Simulacrum:factor-out-simple-def-kind, r=davidtwcobors-6/+4
Remove SimpleDefKind Now that rustc_query_system depends on rustc_hir, we can just directly make use of the regular DefKind.
2022-02-20Delete QueryLookupMark Rousskov-2/+1
This was largely just caching the shard value at this point, which is not particularly useful -- in the use sites the key was being hashed nearby anyway.
2022-02-20Move Sharded maps into each QueryCache implMark Rousskov-1/+1
2022-02-17Remove SimpleDefKindMark Rousskov-6/+4
2022-02-16Move ty::print methods to Drop-based scope guardsMark Rousskov-4/+5
2022-02-09Auto merge of #93741 - Mark-Simulacrum:global-job-id, r=cjgillotbors-12/+21
Refactor query system to maintain a global job id counter This replaces the per-shard counters with a single global counter, simplifying the JobId struct down to just a u64 and removing the need to pipe a DepKind generic through a bunch of code. The performance implications on non-parallel compilers are likely minimal (this switches to `Cell<u64>` as the backing storage over a `u64`, but the latter was already inside a `RefCell` so it's not really a significance divergence). On parallel compilers, the cost of a single global u64 counter may be more significant: it adds a serialization point in theory. On the other hand, we can imagine changing the counter to have a thread-local component if it becomes worrisome or some similar structure. The new design is sufficiently simpler that it warrants the potential for slight changes down the line if/when we get parallel compilation to be more of a default. A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid possibly overflowing it and causing problems; it is effectively impossible that we would overflow a u64 counter in this context.
2022-02-08Switch QueryJobId to a single global counterMark Rousskov-12/+21
This replaces the per-shard counters with a single global counter, simplifying the JobId struct down to just a u64 and removing the need to pipe a DepKind generic through a bunch of code. The performance implications on non-parallel compilers are likely minimal (this switches to `Cell<u64>` as the backing storage over a `u64`, but the latter was already inside a `RefCell` so it's not really a significance divergence). On parallel compilers, the cost of a single global u64 counter may be more significant: it adds a serialization point in theory. On the other hand, we can imagine changing the counter to have a thread-local component if it becomes worrisome or some similar structure. The new design is sufficiently simpler that it warrants the potential for slight changes down the line if/when we get parallel compilation to be more of a default. A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid possibly overflowing it and causing problems; it is effectively impossible that we would overflow a u64 counter in this context.
2022-02-0814956 -> 14952 exportsklensy-2/+2
2022-02-0715221 -> 14956 exportsklensy-1/+1
2021-12-14Remove `in_band_lifetimes` from `rustc_query_impl`LegionMammal978-4/+4
See #91867 for more information.
2021-12-12Query modifierDeadbeef-0/+12
2021-10-25Avoid a branch on key being local for queries that use the same local and ↵bjorn3-7/+19
extern providers
2021-10-23Do not require QueryCtxt for cache_on_disk.Camille GILLOT-2/+1
2021-10-23Build the query vtable directly.Camille GILLOT-31/+19
2021-10-21Do not depend on the stored value when trying to cache on disk.Camille GILLOT-1/+1
2021-10-20Build jump table at runtime.Camille GILLOT-59/+70
2021-10-20Invoke callbacks from rustc_middle.Camille GILLOT-31/+1
2021-10-20Merge two query callbacks arrays.Camille GILLOT-65/+33
2021-10-20Make hash_result an Option.Camille GILLOT-12/+6
2021-10-06Query the fingerprint style during key reconstructionMark Rousskov-3/+4
Keys can be reconstructed from fingerprints that are not DefPathHash, but then we cannot extract a DefId from them.
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-1/+0
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-03Access StableHashingContext in rustc_query_system.Camille GILLOT-1/+0
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-10-02Prevent macro ambiguity errorsbjorn3-13/+13
The previous macro_rules! parsers failed when an additional modifier was added with ambiguity errors. The error is pretty unclear as to what exactly the cause here is, but this change simplifies the argument parsing code such that the error is avoided.
2021-09-21Disable visible path calculation for PrettyPrinter in Ok path of compilerAlik Aslanyan-2/+5
2021-08-29Retrieve `DefKind` from HIR map to reduce chance of cyclesNoah Lev-4/+6
`tcx.def_kind()` could theoretically invoke another query, which could cause an infinite query loop. Accessing the HIR map directly makes that less likely to happen. I also changed it to use `as_local()` (`tcx.def_kind()` seems to implicitly call `expect_local()`) and `opt_def_kind()` to reduce the chance of panicking on valid code.
2021-08-27Note that type aliases cannot be recursiveNoah Lev-1/+6
2021-07-25Create `QuerySideEffects` and use it for diagnosticsAaron Hill-9/+11
2021-07-18Remove deadlock virtual call.Camille GILLOT-6/+5
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-33/+43
2021-06-15Auto merge of #85154 - cjgillot:lessfn, r=bjorn3bors-5/+5
Reduce amount of function pointers in query invocation. r? `@ghost`
2021-05-31Auto merge of #85266 - cjgillot:hir-dep-clean, r=michaelwoeristerbors-34/+1
Remove obsolete workaround. The regression test for #62649 appears to pass even without the workaround.
2021-05-30Only test if key is local.Camille GILLOT-2/+1
2021-05-30Reduce amount of function pointers.Camille GILLOT-4/+5
2021-05-27Remove obsolete workaround.Camille GILLOT-34/+1
2021-05-15Remove def_path_str.Camille GILLOT-5/+2