aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-02-25 19:13:42 +0100
committerGitHub <noreply@github.com>2017-02-25 19:13:42 +0100
commit8a0a4fbdb7fc118a44cbc3dbd85095093717e7b4 (patch)
treeef3d2d2aba411e0e88c1f56526f895cdf11bb119 /compiler/src/dotty/tools
parentdb24246e90f4b8afcaf1fc66df99d38d9a2cb736 (diff)
parentd009eb81f0b4d9f71b70a1ac023c833629e3c44c (diff)
downloaddotty-8a0a4fbdb7fc118a44cbc3dbd85095093717e7b4.tar.gz
dotty-8a0a4fbdb7fc118a44cbc3dbd85095093717e7b4.tar.bz2
dotty-8a0a4fbdb7fc118a44cbc3dbd85095093717e7b4.zip
Merge pull request #2017 from dotty-staging/refchecks-less-slow
Make resolveSuper less slow
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/MixinOps.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
index 25aa9ffaf..9f7ceeaed 100644
--- a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
+++ b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
@@ -40,6 +40,12 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx:
def isCurrent(sym: Symbol) =
ctx.atPhase(thisTransform) { implicit ctx =>
cls.info.member(sym.name).hasAltWith(_.symbol == sym)
+ // this is a hot spot, where we spend several seconds while compiling stdlib
+ // unfortunately it will discard and recompute all the member chaches,
+ // both making itself slow and slowing down anything that runs after it
+ // because resolveSuper uses hacks with explicit adding to scopes through .enter
+ // this cannot be fixed by a smarter caching strategy. With current implementation
+ // we HAVE to discard caches here for correctness
}
/** Does `method` need a forwarder to in class `cls`
@@ -53,8 +59,8 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx:
def needsDisambiguation = competingMethods.exists(x=> !(x is Deferred)) // multiple implementations are available
def hasNonInterfaceDefinition = competingMethods.exists(!_.owner.is(Trait)) // there is a definition originating from class
meth.is(Method, butNot = PrivateOrAccessorOrDeferred) &&
- isCurrent(meth) &&
- (needsDisambiguation || hasNonInterfaceDefinition || meth.owner.is(Scala2x))
+ (meth.owner.is(Scala2x) || needsDisambiguation || hasNonInterfaceDefinition ) &&
+ isCurrent(meth)
}
/** Get `sym` of the method that needs a forwarder