summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/query
AgeCommit message (Collapse)AuthorLines
2021-03-16Auto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasperbors-1/+1
Implement (but don't use) valtree and refactor in preparation of use This PR does not cause any functional change. It refactors various things that are needed to make valtrees possible. This refactoring got big enough that I decided I'd want it reviewed as a PR instead of trying to make one huge PR with all the changes. cc `@rust-lang/wg-const-eval` on the following commits: * 2027184 implement valtree * eeecea9 fallible Scalar -> ScalarInt * 042f663 ScalarInt convenience methods cc `@eddyb` on ef04a6d cc `@rust-lang/wg-mir-opt` for cf1700c (`mir::Constant` can now represent either a `ConstValue` or a `ty::Const`, and it is totally possible to have two different representations for the same value)
2021-03-14Don't encode file information for span with a dummy locationAaron Hill-3/+3
Fixes #83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
2021-03-12Implement valtreeOli Scherer-1/+1
valtree is a version of constants that is inherently safe to be used within types. This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types. valtrees do not have this problem.
2021-02-19Workaround rustdoc not honouring cfg(parallel_compiler).Camille GILLOT-1/+0
2021-02-19Move the query system to rustc_query_impl.Camille GILLOT-1616/+18
2021-02-19Introduce a QueryEngine trait object.Camille GILLOT-51/+89
2021-02-19Make encode_query_results more generic.Camille GILLOT-7/+9
2021-02-19Move query names and Providers to parent module.Camille GILLOT-71/+65
2021-02-19Wrap QueryDescription into a macro.Camille GILLOT-3/+13
2021-02-19Split DepKindStruct in two.Camille GILLOT-2/+142
2021-02-19Use QueryCtxt in DepKindStruct.Camille GILLOT-2/+2
2021-02-19Use a QueryContext for try_mark_green.Camille GILLOT-1/+95
2021-02-19Select caching strategy per query.Camille GILLOT-70/+1
The per-Key choice was not used.
2021-02-19Move definition of callbacks to parent module.Camille GILLOT-83/+88
2021-02-19Move handle_deadlock where it is used.Camille GILLOT-29/+1
2021-02-19Move try_load_from_on_disk_cache to the QueryContext.Camille GILLOT-1/+10
2021-02-19Move try_print_query_stack to rustc_interface.Camille GILLOT-48/+38
2021-02-19Make alloc_self_profile_query_strings a standalone function.Camille GILLOT-37/+40
2021-02-19Make QueryEngine opaque to TyCtxt.Camille GILLOT-34/+62
2021-02-19Opacify query invocation.Camille GILLOT-4/+16
2021-02-19Wrap TyCtxt inside a QueryCtxt for queries.Camille GILLOT-34/+65
2021-02-19Decouple the on-disk cache from the query engine.Camille GILLOT-9/+0
2021-02-19Decouple QueryContext from DepContext.Camille GILLOT-2/+2
2021-02-19Don't require a QueryContext to access the DepGraph.Camille GILLOT-5/+0
2021-02-19Group logic about the Providers struct.Camille GILLOT-5/+5
2021-02-18Print -Ztime-passes (and misc stats/logs) on stderr, not stdout.Eduard-Mihai Burtescu-11/+11
2021-02-16avoid full-slicing slicesMatthias Krüger-1/+1
If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-13Check query cache before calling into the query engine.Camille GILLOT-3/+21
2021-02-13Separate the query cache from the query state.Camille GILLOT-20/+26
2021-02-13Introduce query_storage.Camille GILLOT-6/+9
2021-02-13Introduce query_stored module.Camille GILLOT-8/+12
2021-02-13Merge {get,ensure}_query.Camille GILLOT-2/+2
2021-02-09Auto merge of #81905 - Dylan-DPC:rollup-mxpz1j7, r=Dylan-DPCbors-1/+23
Rollup of 11 pull requests Successful merges: - #72209 (Add checking for no_mangle to unsafe_code lint) - #80732 (Allow Trait inheritance with cycles on associated types take 2) - #81697 (Add "every" as a doc alias for "all".) - #81826 (Prefer match over combinators to make some Box methods inlineable) - #81834 (Resolve typedef in HashMap lldb pretty-printer only if possible) - #81841 ([rustbuild] Output rustdoc-json-types docs ) - #81849 (Expand the docs for ops::ControlFlow a bit) - #81876 (parser: Fix panic in 'const impl' recovery) - #81882 (:arrow_up: rust-analyzer) - #81888 (Fix pretty printer macro_rules with semicolon.) - #81896 (Remove outdated comment in windows' mutex.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-08Switch query descriptions to just StringMark Rousskov-3/+2
In practice we never used the borrowed variant anyway.
2021-02-05Revert "Auto merge of #79637 - spastorino:revert-trait-inheritance-self, ↵Santiago Pastorino-1/+23
r=Mark-Simulacrum" This reverts commit b4def89d76896eec73b4af33642ba7e5eb53c567, reversing changes made to 7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb.
2021-01-25Auto merge of #68828 - oli-obk:inline_cycle, r=wesleywiserbors-0/+11
Prevent query cycles in the MIR inliner r? `@eddyb` `@wesleywiser` cc `@rust-lang/wg-mir-opt` The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR. The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles. This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2021-01-23Prevent query cycles during inliningoli-0/+11
2021-01-23Iterate to encode def_kind.Camille GILLOT-0/+16
2021-01-17Impl EncodableWithShorthand for PredicateKindJack Huey-0/+5
2021-01-16Can't use EncodableWithShorthand for PredicateJack Huey-5/+0
2021-01-13Properly handle `SyntaxContext` of dummy spans in incr compAaron Hill-12/+20
Fixes #80336 Due to macro expansion, we may end up with spans with an invalid location and non-root `SyntaxContext`. This commits preserves the `SyntaxContext` of such spans in the incremental cache, and ensures that we always hash the `SyntaxContext` when computing the `Fingerprint` of a `Span` Previously, we would discard the `SyntaxContext` during serialization to the incremental cache, causing the span's `Fingerprint` to change across compilation sessions.
2021-01-11Serialize incr comp structures to file via fixed-size bufferTyson Nottingham-36/+52
Reduce a large memory spike that happens during serialization by writing the incr comp structures to file by way of a fixed-size buffer, rather than an unbounded vector. Effort was made to keep the instruction count close to that of the previous implementation. However, buffered writing to a file inherently has more overhead than writing to a vector, because each write may result in a handleable error. To reduce this overhead, arrangements are made so that each LEB128-encoded integer can be written to the buffer with only one capacity and error check. Higher-level optimizations in which entire composite structures can be written with one capacity and error check are possible, but would require much more work. The performance is mostly on par with the previous implementation, with small to moderate instruction count regressions. The memory reduction is significant, however, so it seems like a worth-while trade-off.
2021-01-08Make force_from_dep_node a function pointer.Camille GILLOT-107/+1
2021-01-08Make try_load_from_on_disk_cache a function pointer.Camille GILLOT-26/+0
2021-01-04Auto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkorbors-8/+9
Use `UnhashMap` whenever we have a key of `DefPathHash`
2021-01-01rustc_serialize: specialize opaque decoding of some u8 sequencesTyson Nottingham-0/+9
2021-01-01rustc_serialize: specialize opaque encoding of some u8 sequencesTyson Nottingham-0/+10
2021-01-01Use `UnhashMap` whenever we have a key of `DefPathHash`Aaron Hill-8/+9
2020-12-23Rollup merge of #80204 - pierwill:pierwill-rustcmiddle-ondisk, r=varkorGuillaume Gomez-2/+2
docs: Edit rustc_middle::ty::query::on_disk_cache Expand abbreviations for "incremental compliation". Also added the word "to" to the description of CacheEncoder.
2020-12-19docs: Edit rustc_middle::ty::query::on_disk_cachepierwill-2/+2
Expand abbreviations for "incremental compliation". Also added the word "to" to the description of CacheEncoder.