]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakis
authorCorey Farwell <coreyf@rwell.org>
Fri, 7 Apr 2017 13:20:05 +0000 (09:20 -0400)
committerGitHub <noreply@github.com>
Fri, 7 Apr 2017 13:20:05 +0000 (09:20 -0400)
commit88e97f05412e71cde26b1da0c1d33a4818d27286
tree09221584779776e365d58b613be2d00f578eac1e
parentef9eee74026bb00b75c45f31a692052855ae7e8a
parentbb6387295a85da70546ed3ce7fa0d702b9cb9d6c
Rollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakis

Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation)

In almost all cases where we construct a `DefPath`, we just hash it and throw it away again immediately.
With this PR, the compiler will immediately compute and store the hash for each `DefPath` as it is allocated. This way we
+ can get rid of any subsequent `DefPath` hash caching (e.g. the `DefPathHashes`),
+ don't need to allocate a transient `Vec` for holding the `DefPath` (although I'm always surprised how little these small, dynamic allocations seem to hurt performance), and
+ we don't hash `DefPath` prefixes over and over again.

That last part is because we construct the hash for `prefix::foo` by hashing `(hash(prefix), foo)` instead of hashing every component of prefix.

The last commit of this PR is pretty neat, I think:
```
The SVH (Strict Version Hash) of a crate is currently computed
by hashing the ICHes (Incremental Computation Hashes) of the
crate's HIR. This is fine, expect that for incr. comp. we compute
two ICH values for each HIR item, one for the complete item and
one that just includes the item's interface. The two hashes are
are needed for dependency tracking but if we are compiling
non-incrementally and just need the ICH values for the SVH,
one of them is enough, giving us the opportunity to save some
work in this case.
```

r? @nikomatsakis

This PR depends on https://github.com/rust-lang/rust/pull/40878 to be merged first (you can ignore the first commit for reviewing, that's just https://github.com/rust-lang/rust/pull/40878).
src/librustc_driver/driver.rs