diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-03-11 16:59:16 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-03-11 23:36:38 +0100 |
commit | a4597c4e2e664f744eeb68541ddbab997afc03cc (patch) | |
tree | d97b447155965ceeb81ea5a0c16778bb5ba86b6c /src/dotty/tools/dotc/core/Types.scala | |
parent | 305a9f06bd2b2ac6070beb184d61ff6db4cb9155 (diff) | |
download | dotty-a4597c4e2e664f744eeb68541ddbab997afc03cc.tar.gz dotty-a4597c4e2e664f744eeb68541ddbab997afc03cc.tar.bz2 dotty-a4597c4e2e664f744eeb68541ddbab997afc03cc.zip |
Fix incorrect hashing leading to cache pollution
Before this commit, Hashable#addDelta did not work correctly when the
input hash was the special value NotCached, instead of returning
NotCached, it returned NotCached + delta. This means that many different
values ended up being cached with the same hash when they should not be
cached at all, this is especially bad since our HashSet implementation
uses open addressing.
I noticed this bug while working on a phase to collect API information
for sbt (this phase needs to collect every member of a class, including
inherited members), after enabling it, the compileStdLib test took
~500 seconds to complete, this commit reduces this to ~100 seconds.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index dd12a0188..17c2ec4ca 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2479,7 +2479,7 @@ object Types { def copyBoundType(bt: BT) = new MethodParamImpl(bt, paramNum) // need to customize hashCode and equals to prevent infinite recursion for dep meth types. - override def computeHash = addDelta(System.identityHashCode(binder), paramNum) + override def computeHash = addDelta(binder.identityHash, paramNum) override def equals(that: Any) = that match { case that: MethodParam => (this.binder eq that.binder) && this.paramNum == that.paramNum |