about summary refs log tree commit diff
path: root/compiler/rustc_incremental/src
AgeCommit message (Collapse)AuthorLines
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-3/+2
2021-09-06Auto merge of #83214 - cjgillot:dep-map, r=michaelwoeristerbors-64/+84
Mmap the incremental data instead of reading it. Instead of reading the full incremental state using `fs::read_file`, we memmap it using a private read-only file-backed map. This allows the system to reclaim any memory we are not using, while ensuring we are not polluted by outside modifications to the file. Suggested in https://github.com/rust-lang/rust/pull/83036#issuecomment-800458082 by `@bjorn3`
2021-09-02Stop using walk_crate.Camille GILLOT-1/+1
2021-08-28Drop the query result memmap before serializing it back.Camille GILLOT-1/+15
2021-08-28Move save_in to file_format.Camille GILLOT-58/+61
2021-08-28Mmap the incremental data instead of reading it.Camille GILLOT-6/+9
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-24/+23
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-6/+4
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-13/+6
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-06-30Simplify DepGraph creation.Camille GILLOT-6/+9
2021-06-08Do not require the DefPathTable to construct the on-disk cache.Camille GILLOT-6/+2
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-6/+13
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-02Auto merge of #85337 - cjgillot:less-anon, r=michaelwoeristerbors-0/+1
Avoid creating anonymous nodes with zero or one dependency. Anonymous nodes are only useful to encode dependencies, and cannot be replayed from one compilation session to another. As such, anonymous nodes without dependency are always green. Anonymous nodes with only one dependency are equivalent to this dependency. cc #45408 cc `@michaelwoerister`
2021-06-01Auto merge of #85331 - cjgillot:dirty-dancing, r=Aaron1011bors-100/+28
Make rustc_dirty/clean annotations exhaustive by default Fixes #45009
2021-06-01Avoid creating anonymous nodes with zero or one dependency.Camille GILLOT-0/+1
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-13/+6
2021-05-29Auto merge of #85698 - ehuss:incremental-session-panic, r=estebankbors-23/+43
Don't panic when failing to initialize incremental directory. This removes a panic when rustc fails to initialize the incremental directory. This can commonly happen on various filesystems that don't support locking (often various network filesystems). Panics can be confusing and scary, and there are already plenty of issues reporting this. This has been panicking since 1.22 due to I think #44502 which was a major rework of how things work. Previously, things were simpler and the [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.21.0/src/librustc_incremental/persist/load.rs#L43-L65) function would emit an error and then continue on without panicking. With 1.22, [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.22.0/src/librustc_incremental/persist/load.rs#L44) was changed so that it assumes it can load the data without errors. Today, the problem is that it calls [`prepare_session_directory`](https://github.com/rust-lang/rust/blob/fbf1b1a7193cda17008ab590e06ad28d9924023b/compiler/rustc_interface/src/passes.rs#L175-L179) and then immediately calls `garbage_collect_session_directories` which will panic since the session is `IncrCompSession::NotInitialized`. The solution here is to have `prepare_session_directory` return an error that must be handled so that compilation stops if it fails. Some other options: * Ignore directory lock failures. * Print a warning on directory lock failure, but otherwise continue with incremental enabled. * Print a warning on directory lock failure, and disable incremental. * Provide a different locking mechanism. Cargo ignores lock errors if locking is not supported, so that would be a precedent for the first option. These options would require quite a bit more changes, but I'm happy to entertain any of them, as I think they all have valid justifications. There is more discussion on the many issues where this is reported: #49773, #59224, #66513, #76251. I'm not sure if this can be considered closing any of those, though, since I think there is some value in discussing if there is a way to avoid the error altogether. But I think it would make sense to at least close all but one to consolidate them.
2021-05-28Add specific help for *how* to fix an incremental lock error.Eric Huss-0/+13
2021-05-25Don't panic when failing to initialize incremental directory.Eric Huss-23/+30
2021-05-22Get rid of PreviousDepGraph.Camille GILLOT-7/+7
2021-05-16Remove remains of rustc_dirty.Camille GILLOT-43/+18
2021-05-15Fix tests on traits.Camille GILLOT-14/+7
2021-05-15Remove `label` in dirty/clean annotations.Camille GILLOT-44/+4
2021-05-12Use () for codegen queries.Camille GILLOT-1/+1
2021-05-12Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillotbors-3/+3
rustc_driver cleanup Best reviewed one commit at a time.
2021-05-02Let load_query_result_cache take a &DefPathTablebjorn3-3/+3
This allows removing a confusing mem::replace in create_global_ctxt
2021-04-27Add [TRACKED_NO_CRATE_HASH] and [SUBSTRUCT] directivesJoshua Nelson-2/+2
This is necessary for options that should invalidate the incremental hash but *not* affect the crate hash (e.g. --remap-path-prefix). This doesn't add `for_crate_hash` to the trait directly because it's not relevant for *types*, only for *options*, which are fields on a larger struct. Instead, it adds a new `SUBSTRUCT` directive for options, which does take a `for_crate_hash` parameter. - Use TRACKED_NO_CRATE_HASH for --remap-path-prefix - Add test that `remap_path_prefix` is tracked - Reduce duplication in the test suite to avoid future churn
2021-03-30Also profile finishing the encoding.Camille GILLOT-1/+1
2021-03-30Address review.Camille GILLOT-6/+2
2021-03-30Stream the dep-graph to a file.Camille GILLOT-70/+117
2021-03-27Remove (lots of) dead codeJoshua Nelson-14/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-22Only enable assert_dep_graph when query-dep-graph is enabled.Camille GILLOT-0/+8
2021-03-22Auto merge of #83273 - cjgillot:endecode, r=michaelwoeristerbors-0/+1
Simplify encoder and decoder Extracted from https://github.com/rust-lang/rust/pull/83036 and https://github.com/rust-lang/rust/pull/82780.
2021-03-19Move raw bytes handling to Encoder/Decoder.Camille GILLOT-0/+1
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-2/+2
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-09Deduplicate unchecked_attrs errors.Camille GILLOT-2/+3
2021-03-09Track HirId when visiting attributes.Camille GILLOT-1/+1
2021-03-09Remove hir::Crate::attrs.Camille GILLOT-1/+1
2021-03-09Access attrs directly from HirId in rustc_incremental::assert_dep_graph.Camille GILLOT-6/+7
2021-02-18Print -Ztime-passes (and misc stats/logs) on stderr, not stdout.Eduard-Mihai Burtescu-4/+4
2021-02-15Use less HirId when referring to items.Camille GILLOT-14/+14
2021-02-15Only store a LocalDefId in hir::ForeignItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-2/+2
Items are guaranteed to be HIR owner.
2021-01-19Auto merge of #80957 - tgnottingham:direct_serialize_depgraph, ↵bors-75/+7
r=michaelwoerister Serialize dependency graph directly from DepGraph Reduce memory usage by serializing dep graph directly from `DepGraph`, rather than copying it into `SerializedDepGraph` and serializing that.
2021-01-12Serialize dependency graph directly from DepGraphTyson Nottingham-75/+7
Reduce memory usage by serializing dep graph directly from `DepGraph`, rather than copying it into `SerializedDepGraph` and serializing that.
2021-01-12Remove DepKind::CrateMetadata and pre-allocation of DepNodesTyson Nottingham-11/+0
Remove much of the special-case handling around crate metadata dependency tracking by replacing `DepKind::CrateMetadata` and the pre-allocation of corresponding `DepNodes` with on-demand invocation of the `crate_hash` query.
2021-01-11Serialize incr comp structures to file via fixed-size bufferTyson Nottingham-39/+47
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-06Optimize away some `fs::metadata` calls.Dan Gohman-32/+34
This also eliminates a use of a `Path` convenience function, in support of #80741, refactoring `std::path` to focus on pure data structures and algorithms.