about summary refs log tree commit diff
path: root/src/librustc/dep_graph
AgeCommit message (Collapse)AuthorLines
2017-10-02incr.comp.: Use red/green tracking for CGU re-use.Michael Woerister-19/+50
2017-10-02incr.comp.: Add some logging to DepGraph::try_mark_green().Michael Woerister-4/+32
2017-10-02incr.comp.: Make some DepNodes non-anonymous.Michael Woerister-46/+8
2017-10-02incr.comp.: Re-execute queries during red/green marking in order to find out ↵Michael Woerister-19/+32
their color.
2017-10-02incr.comp.: Add minimal version of try_mark_green procedure.Michael Woerister-25/+154
2017-10-02incr.comp.: Determine red/green state of every new node.Michael Woerister-10/+54
2017-09-27Remove SerializedDepNodeIndex::new it is already impl for IdxSantiago Pastorino-8/+0
2017-09-27Remove DepNodeIndexNew::new and ::index, they are already impl for IdxSantiago Pastorino-13/+5
2017-09-24move unsafety checking to MIRAriel Ben-Yehuda-0/+1
No functional changes intended.
2017-09-23incr.comp.: Remove out-dated unit test and unnecessary assertion.Michael Woerister-3/+0
2017-09-23incr.comp.: Remove support for loading metadata fingerprints.Michael Woerister-2/+18
2017-09-23incr.comp.: Serialize and deserialize new DepGraphMichael Woerister-60/+198
2017-09-23incr.comp.: Initial implemenation of append-only dep-graph.Michael Woerister-44/+278
2017-09-22Auto merge of #44696 - michaelwoerister:fingerprints-in-dep-graph-3, ↵bors-23/+85
r=nikomatsakis incr.comp.: Move task result fingerprinting into DepGraph. This PR - makes the DepGraph store all `Fingerprints` of task results, - allows `DepNode` to be marked as input nodes, - makes HIR node hashing use the regular fingerprinting infrastructure, - removes the now unused `IncrementalHashesMap`, and - makes sure that `traits_in_scope_map` fingerprints are stable. r? @nikomatsakis cc @alexcrichton
2017-09-20Fix ICEscalexm-0/+2
2017-09-20incr.comp.: Add some comments.Michael Woerister-0/+8
2017-09-20incr.comp.: Store result fingerprints in DepGraph.Michael Woerister-7/+40
2017-09-20incr.comp.: Allow for marking DepKinds as inputs.Michael Woerister-17/+38
2017-09-18incr.comp.: Remove tcx from StableHashingContext.Michael Woerister-2/+2
2017-09-18Fix issues uncovered by rebasing:Michael Woerister-0/+12
- Don't hash traits in scope as part of HIR hashing any more. - Some queries returned DefIndexes from other crates. - Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-18incr.comp.: Move result fingerprinting to DepGraph::with_task().Michael Woerister-11/+32
This makes sure that we don't introduce strange cases where we have nodes outside the query system that could break red/green tracking and it will allow to keep red/green neatly encapsulated within the DepGraph implementation.
2017-09-17rustc: Move codegen to a queryAlex Crichton-0/+4
This commit moves the actual code generation in the compiler behind a query keyed by a codegen unit's name. This ended up entailing quite a few internal refactorings to enable this, along with a few cut corners: * The `OutputFilenames` structure is now tracked in the `TyCtxt` as it affects a whole bunch of trans and such. This is now behind a query and threaded into the construction of the `TyCtxt`. * The `TyCtxt` now has a channel "out the back" intended to send data to worker threads in rustc_trans. This is used as a sort of side effect of the codegen query but morally what's happening here is the return value of the query (currently unit but morally a path) is only valid once the background threads have all finished. * Dispatching work items to the codegen threads was refactored to only rely on data in `TyCtxt`, which mostly just involved refactoring where data was stored, moving it from the translation thread to the controller thread's `CodegenContext` or the like. * A new thread locals was introduced in trans to work around the query system. This is used in the implementation of `assert_module_sources` which looks like an artifact of the old query system and will presumably go away once red/green is up and running.
2017-09-17rustc: Remove another global map from transAlex Crichton-0/+1
This commit removes the `crate_trans_items` field from the `CrateContext` of trans. This field, a big map, was calculated during partioning and was a set of all translation items. This isn't quite incremental-friendly because the map may change a lot but not have much effect on downstream consumers. Instead a new query was added for the one location this map was needed, along with a new comment explaining what the location is doing!
2017-09-17rustc: Mostly remove `ExportedSymbols`Alex Crichton-1/+1
This is a big map that ends up inside of a `CrateContext` during translation for all codegen units. This means that any change to the map may end up causing an incremental recompilation of a codegen unit! In order to reduce the amount of dependencies here between codegen units and the actual input crate this commit refactors dealing with exported symbols and such into various queries. The new queries are largely based on existing queries with filled out implementations for the local crate in addition to external crates, but the main idea is that while translating codegen untis no unit needs the entire set of exported symbols, instead they only need queries about particulare `DefId` instances every now and then. The linking stage, however, still generates a full list of all exported symbols from all crates, but that's going to always happen unconditionally anyway, so no news there!
2017-09-17rustc: Move some attr methods to queriesAlex Crichton-0/+2
Otherwise we may emit double errors related to the `#[export_name]` attribute, for example, and using a query should ensure that it's only emitted at most once.
2017-09-17rustc: Make trans collect/partition a queryAlex Crichton-0/+1
This commit moves the `collect_and_partition_translation_items` function into a query on `TyCtxt` instead of a free function in trans, allowing us to track dependencies and such of the function.
2017-09-17rustc: Calculate `ExportedSymbols` in a queryAlex Crichton-1/+2
This commit moves the definition of the `ExportedSymbols` structure to the `rustc` crate and then creates a query that'll be used to construct the `ExportedSymbols` set. This in turn uses the reachablity query exposed in the previous commit.
2017-09-14rustc: Preallocate when building the dep graphAlex Crichton-3/+2
This commit alters the `query` function in the dep graph module to preallocate memory using `with_capacity` instead of relying on automatic growth. Discovered in #44576 it was found that for the syntex_syntax clean incremental benchmark the peak memory usage was found when the dep graph was being saved, particularly the `DepGraphQuery` data structure itself. PRs like #44142 which add more queries end up just making this much larger! I didn't see an immediately obvious way to reduce the size of the `DepGraphQuery` object, but it turns out that `with_capacity` helps quite a bit! Locally 831 MB was used [before] this commit, and 770 MB is in use at the peak of the compiler [after] this commit. That's a nice 7.5% improvement! This won't quite make up for the losses in #44142 but I figured it's a good start. [before]: https://gist.github.com/alexcrichton/2d2b9c7a65503761925c5a0bcfeb0d1e [before]: https://gist.github.com/alexcrichton/6da51f2a6184bfb81694cc44f06deb5b
2017-09-11rustc: Remove HirId from queriesAlex Crichton-9/+9
This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Some queries could move straight to `HirId` but others that don't always have a correspondance between `HirId` and `DefId` moved to two-level maps where the query operates over a `DefIndex`, returning a map, which is then keyed off `ItemLocalId`. Closes #44414
2017-09-09Auto merge of #44335 - arielb1:node-hashing, r=alexcrichtonbors-1/+20
Avoid hashing when creating a DepNode from a HirId Instead, combine the already-present DefPathHash with the 32-bit ItemLocalIndex. Should fix #44323. r? @alexcrichton
2017-09-07rustc: Remove `CrateStore::crates` as a methodAlex Crichton-0/+1
This commit moves the `crates` method to a query and then migrates all callers to use a query instead of the now-renamed `crates_untracked` method where possible. Closes #41417
2017-09-05rustc: Move stability functionality into queriesAlex Crichton-2/+3
This commit primarily removes the `stability` field from `TyCtxt` as well as its internal mutable state, instead using a query to build the stability index as well as primarily using queries for other related lookups. Like previous commits the calculation of the stability index is wrapped in a `with_ignore` node to avoid regressing the current tests, and otherwise this commit also introduces #44232 but somewhat intentionally so.
2017-09-05rustc: Rename item_body query to extern_const_bodyAlex Crichton-1/+1
Should hopefully more accurately reflect what's happening! This commit also removes the cache in the cstore implementation as it's already cached through the query infrastructure.
2017-09-05rustc: Hide `maybe_unused_*` fields in queriesAlex Crichton-0/+2
This commit makes the `maybe_unused_extern_crates` and `maybe_unused_trait_imports` fields of `TyCtxt` private and ensures that they're accessed with queries so the values and results can be tracked.
2017-09-05rustc: Convert `freevars` to a queryAlex Crichton-0/+2
This removes a public mutable (but not actually used mutably) field from the `TyCtxt`, moving it over to a query to ensure that it's tracked over time.
2017-09-05rustc: Remove `CrateStore::used_crate*`Alex Crichton-0/+2
This commit removes the `use_crates` and `used_crate_source` methods in favor of a mix of queries and helper methods being used now instead.
2017-09-05rustc: Migrate `visible_parent_map` to a queryAlex Crichton-0/+3
Turns out it was basically already a query if you squinted hard enough!
2017-09-05rustc: Migrate `CrateStore::item_body` to a queryAlex Crichton-0/+1
This commit migrates the `item_body` method on `CrateStore` to a query instead to enable better tracking of dependencies and whatnot.
2017-09-05rustc: Remove lang item methods from CrateStoreAlex Crichton-0/+2
Given the previous commit, these are now trivially representable as queries!
2017-09-05rustc: Migrate lang items to a queryAlex Crichton-0/+1
This commit moves the calculation of the `LanguageItems` structure into a query rather than being calculated before the `TyCtxt` exists, with the eventual end goal of removing some `CrateStore` methods.
2017-09-05rustc: Flag some CrateStore methods as "untracked"Alex Crichton-0/+6
The main use of `CrateStore` *before* the `TyCtxt` is created is during resolution, but we want to be sure that any methods used before resolution are not used after the `TyCtxt` is created. This commit starts moving the methods used by resolve to all be named `{name}_untracked` where the rest of the compiler uses just `{name}` as a query. During this transition a number of new queries were added to account for post-resolve usage of these methods.
2017-09-05rustc: Hide the `named_region_map` behind queriesAlex Crichton-0/+4
This commit makes the `named_region_map` field of `GlobalCtxt` private by encapsulating the fields behind new queries, and the new queries are also targeted at particular `HirId` nodes instead of accessing the entire map.
2017-09-05rustc: Remove a number of mutable fields in cstoreAlex Crichton-0/+5
This commit started by moving methods from `CrateStore` to queries, but it ended up necessitating some deeper refactorings to move more items in general to queries. Before this commit the *resolver* would walk over the AST and process foreign modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would then also process the command line `-l` directives and such. This information was then stored as precalculated lists in the `CrateStore` object for iterating over later. After this, commit, however, this pass no longer happens during resolution but now instead happens through queries. A query for the linked libraries of a crate will crawl the crate for `extern` blocks and then process the linkage annotations at that time.
2017-09-05rustc: Move implementations_of_trait to a queryAlex Crichton-0/+3
While we're at it, make it two separate queries so one's for rustdoc and one's for the compiler, hopefully being a bit more targeted.
2017-09-05rustc: Fix a borrow mut error with debug assertionsAlex Crichton-3/+6
2017-09-05rustc: Move original_crate_name to a queryAlex Crichton-0/+1
2017-09-05rustc: Move crate_hash to a queryAlex Crichton-0/+1
2017-09-05rustc: Move crate_disambiguator to queriesAlex Crichton-0/+1
2017-09-05rustc: Move {plugin,derive}_registrar_fn to queriesAlex Crichton-0/+2
2017-09-05rustc: Migrate `CStore::native_libraries` to a queryAlex Crichton-0/+1