aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2017-02-21 17:06:10 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2017-02-21 17:06:10 +0100
commitd009eb81f0b4d9f71b70a1ac023c833629e3c44c (patch)
tree22a00433a909d06c1a78e50dbdccaf88612dc5bd /compiler/src/dotty/tools/dotc/transform/MixinOps.scala
parent5bcbad29a368bf6a06230aed73488995e733d97a (diff)
downloaddotty-d009eb81f0b4d9f71b70a1ac023c833629e3c44c.tar.gz
dotty-d009eb81f0b4d9f71b70a1ac023c833629e3c44c.tar.bz2
dotty-d009eb81f0b4d9f71b70a1ac023c833629e3c44c.zip
ResolveSuper: MixinOps save 2-3 seconds on stdlib compilation.
By ordering tests in a smarter way. Add leave a big scary comment.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/MixinOps.scala')
-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