about summary refs log tree commit diff
path: root/src/librustc/dep_graph
AgeCommit message (Collapse)AuthorLines
2016-09-06write to inherent_impls during the visitorNiko Matsakis-0/+11
The goal here is to avoid writing to the `inherent_impls` map from within the general `Coherence` task, and instead write to it as we visit. Writing to it from the Coherence task is actually an information leak; it happened to be safe because Coherence read from `DepNode::Krate`, but that was very coarse. I removed the `Rc` here because, upon manual inspection, nobody clones the data in this table, and it meant that we can accumulate the data in place. That said, the pattern that is used for the inherent impls map is *generally* an anti-pattern (that is, holding the borrow lock for the duration of using the contents), so it'd probably be better to clone (and I doubt that would be expensive -- how many inherent impls does a typical type have?).
2016-08-31simplify DepNode for trait selectionNiko Matsakis-4/+3
2016-08-23consider DepNode::Krate to be an inputNiko Matsakis-0/+5
This seems not only more correct but allows us to write tests that check whether the krate hash as a whole is clean/dirty
2016-08-09make it possible to test if HIR is dirtyNiko Matsakis-0/+1
This requires passing in the dirty-node set explicitly since HIR nodes wind up added to the graph either way.
2016-08-09make DepNode PartialOrdNiko Matsakis-2/+2
2016-08-08track MIR through the dep-graphNiko Matsakis-6/+16
Per the discussion on #34765, we make one `DepNode::Mir` variant and use it to represent both the MIR tracking map as well as passes that operate on MIR. We also track loads of cached MIR (which naturally comes from metadata). Note that the "HAIR" pass adds a read of TypeckItemBody because it uses a myriad of tables that are not individually tracked.
2016-08-02replace graph rewriting with detecting inlined idsNiko Matsakis-0/+26
We now detect inlined id's earlier (in the HIR map) and rewrite a read of them to be a read of the metadata for the associated item.
2016-07-28Keep multiple files per work-productNiko Matsakis-6/+5
In the older version, a `.o` and ` .bc` file were separate work-products. This newer version keeps, for each codegen-unit, a set of files of different kinds. We assume that if any kinds are available then all the kinds we need are available, since the precise set of switches will depend on attributes and command-line switches. Should probably test this: the effect of changing attributes in particular might not be successfully tracked?
2016-07-28Address mw nitsNiko Matsakis-5/+5
2016-07-28Extend DepGraph so it can track "work-products"Niko Matsakis-9/+128
A work product right now is just a `.o` file. In the future it probably includes other kinds of files, such as `.bc` files saving the unoptimized LLVM IR. However, because WorkProductIds must be independent of DefIds, so that they don't need translation, this system may not be suitable *as is* for storing fine-grained information (such as the MIR for individual defs), as it was originally intended. We will want to refactor some for that.
2016-07-01fix RUST_LOG, hopefully for real this timeAriel Ben-Yehuda-2/+0
2016-06-03avoid extra cloneNiko Matsakis-3/+3
2016-05-31expand `DepNode::TraitSelect` to include type idsNiko Matsakis-18/+31
To handle the general case, we include a vector of def-ids, so that we can account for things like `(Foo, Bar)` which references both `Foo` and `Bar`. This means it is not Copy, so re-jigger some APIs to use borrowing more intelligently.
2016-05-18add task for linkingNiko Matsakis-0/+2
In MSVC (at least), linking requires accessing metadata, which generates reads.
2016-05-18add debug info to dep_graphNiko Matsakis-1/+5
2016-05-18cleanup dep-graph debugging codeNiko Matsakis-0/+70
Create some re-usable filtering subroutines.
2016-05-18identify inputs of `MetaData(X)` nodesNiko Matsakis-6/+15
Generate a second hash file that contains the metadata for an X node.
2016-05-18when encoding, push MetaData(foo) task on stackNiko Matsakis-0/+1
This lets us determine what was used to construct the metadata. Conflicts: src/librustc_metadata/encoder.rs
2016-05-18add a MetaData node and trigger reads from itNiko Matsakis-0/+5
Conflicts: src/librustc_metadata/csearch.rs
2016-05-18thread the DepGraph to session/crate-storeNiko Matsakis-6/+0
This is a [breaking-change] for plugin authors. You must now create a dep-graph earlier.
2016-05-18add MetaData DepNode variantNiko Matsakis-0/+6
2016-05-11rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.Eduard Burtescu-2/+2
2016-05-11rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.Eduard Burtescu-4/+4
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-0/+2
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-08Auto merge of #33130 - eddyb:mir-const, r=nikomatsakisbors-0/+2
Implement constant support in MIR. All of the intended features in `trans::consts` are now supported by `mir::constant`. The implementation is considered a temporary measure until `miri` replaces it. A `-Z orbit` bootstrap build will only translate LLVM IR from AST for `#[rustc_no_mir]` functions. Furthermore, almost all checks of constant expressions have been moved to MIR. In non-`const` functions, trees of temporaries are promoted, as per RFC 1414 (rvalue promotion). Promotion before MIR borrowck would allow reasoning about promoted values' lifetimes. The improved checking comes at the cost of four `[breaking-change]`s: * repeat counts must contain a constant expression, e.g.: `let arr = [0; { println!("foo"); 5 }];` used to be allowed (it behaved like `let arr = [0; 5];`) * dereference of a reference to a `static` cannot be used in another `static`, e.g.: `static X: [u8; 1] = [1]; static Y: u8 = (&X)[0];` was unintentionally allowed before * the type of a `static` *must* be `Sync`, irrespective of the initializer, e.g. `static FOO: *const T = &BAR;` worked as `&T` is `Sync`, but it shouldn't because `*const T` isn't * a `static` cannot wrap `UnsafeCell` around a type that *may* need drop, e.g. `static X: MakeSync<UnsafeCell<Option<String>>> = MakeSync(UnsafeCell::new(None));` was previously allowed based on the fact `None` alone doesn't need drop, but in `UnsafeCell` it can be later changed to `Some(String)` which *does* need dropping The drop restrictions are relaxed by RFC 1440 (#33156), which is implemented, but feature-gated. However, creating `UnsafeCell` from constants is unstable, so users can just enable the feature gate.
2016-05-07Rollup merge of #33313 - birkenfeld:depgraph-panic, r=nikomatsakisSteve Klabnik-1/+4
dep_graph: avoid panicking in thread when channel closed On my system, when the processor is already loaded, and I try to run the test suite, e.g. compile-fail/dep-graph-assoc-type-trans.rs fails because of undecodable JSON. Running the compiler manually, I can see that the dep graph thread panics (and puts non-JSON on stderr) while `send`ing on `swap_out`, presumably because the other end has already quit. I think that in this case, we can just gracefully exit the thread.
2016-05-07mir: prepare for rvalue promotion support.Eduard Burtescu-0/+2
2016-05-03Short-cut Sized matching on ADTsAriel Ben-Yehuda-0/+2
Put a constraint type on every ADT def, such that the ADT def is sized iff the constraint type is, and use that in selection. This ignores types that are obviously sized. This improves typeck performance by ~15%.
2016-05-03Warn unused trait importsSeo Sanghyeon-0/+2
2016-05-01dep_graph: avoid panicking in thread when channel closedGeorg Brandl-1/+4
On my system, when the processor is already loaded, and I try to run the test suite, e.g. compile-fail/dep-graph-assoc-type-trans.rs fails because of undecodable JSON. Running the compiler manually, I can see that the dep graph thread panics (and puts non-JSON on stderr) while `send`ing on `swap_out`, presumably because the other end has already quit. I think that in this case, we can just gracefully exit the thread.
2016-04-19Check transmutes between types without statically known sizes.Eduard Burtescu-2/+0
2016-04-06rebase over the hir renameNiko Matsakis-2/+2
2016-04-06break dep-graph into modules, parameterize DepNodeNiko Matsakis-233/+399
it is useful later to customize how change the type we use for reference items away from DefId
2016-04-06rustc: move middle::{def,def_id,pat_util} to hir.Eduard Burtescu-1/+1
2016-04-06rustc: move rustc_front to rustc::hir.Eduard Burtescu-2/+2
2016-03-31librustc: replace panic!() with bug!()Benjamin Herr-2/+2
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-1/+1
2016-03-14Initial incorporation of specialization:Aaron Turon-5/+4
- Rewrites the overlap checker to instead build up a specialization graph, checking for overlap errors in the process. - Use the specialization order during impl selection. This commit does not yet handle associated types correctly, and assumes that all items are `default` and are overridden.
2016-03-13Auto merge of #31916 - nagisa:mir-passmgr-2, r=arielb1bors-0/+2
Add Pass manager for MIR A new PR, since rebasing the original one (https://github.com/rust-lang/rust/pull/31448) properly was a pain. Since then there has been several changes most notable of which: 1. Removed the pretty-printing with `#[rustc_mir(graphviz/pretty)]`, mostly because we now have `--unpretty=mir`, IMHO that’s the direction we should expand this functionality into; 2. Reverted the infercx change done for typeck, because typeck can make an infercx for itself by being a `MirMapPass` r? @nikomatsakis
2016-03-11Forbid items with the same name being defined in overlapping inherentAaron Turon-0/+1
impl blocks. For example, the following is now correctly illegal: ```rust struct Foo; impl Foo { fn id() {} } impl Foo { fn id() {} } ``` "Overlapping" here is determined the same way it is for traits (and in fact shares the same code path): roughly, there must be some way of substituting any generic types to unify the impls, such that none of the `where` clauses are provably unsatisfiable under such a unification. Closes #22889
2016-03-04Address commentsSimonas Kazlauskas-1/+2
2016-03-04Add Pass manager for MIRSimonas Kazlauskas-0/+1
2016-03-03Rename middle::ty::ctxt to TyCtxtJeffrey Seyfried-3/+3
2016-02-24Make list of statements flatSimonas Kazlauskas-1/+1
In MIR we previously tried to match `let x in { exprs; let y in { exprs; }}` with our data structures which is rather unwieldy, espeicially because it requires some sort of recursion or stack to process, while, a flat list of statements is enough – lets only relinquish their lifetime at the end of the block (i.e. end of the list). Also fixes #31853.
2016-02-05Instrument a bunch of tasks that employ the HIR map in one way orNiko Matsakis-0/+13
another and were not previously instrumented.
2016-02-05Instrument the AST map so that it registers reads when data isNiko Matsakis-0/+7
acccessed.
2016-02-05Add a local counter that tracks how many tasks are pushed or not pushed,Niko Matsakis-4/+47
so that we can still get assertion failures even when dep-graph construction is disabled.
2016-01-19remove the `SimplifiedType` from the `DepNode` for now, just to keepNiko Matsakis-2/+1
size of `DepNode` smaller and because we are not that fine-grained yet anyhow
2016-01-06Fix numerous typos, renamings, and minor nits raised by mw.Niko Matsakis-27/+33
2016-01-05Refactor compiler to make use of dep-tracking-maps. Also, in cases whereNiko Matsakis-0/+56
we were using interior mutability (RefCells, TyIvar), add some reads/writes.