diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2007-08-28 14:36:52 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2007-08-28 14:36:52 +0000 |
commit | 649de8069317a921f4b43e20469b6f938b2a2783 (patch) | |
tree | 45ed8371fad6b3de341c3db4af0e25ddb77035c8 /src/compiler/scala/tools/nsc/backend/opt/Inliners.scala | |
parent | 22f1be16fb364a8ae9749c0a59f0535cbe18b561 (diff) | |
download | scala-649de8069317a921f4b43e20469b6f938b2a2783.tar.gz scala-649de8069317a921f4b43e20469b6f938b2a2783.tar.bz2 scala-649de8069317a921f4b43e20469b6f938b2a2783.zip |
Various improvements/bug fixes in the icode rea...
Various improvements/bug fixes in the icode reader.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/opt/Inliners.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/opt/Inliners.scala | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index 6f52db1acc..3f48f8b576 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -300,10 +300,14 @@ abstract class Inliners extends SubComponent { } var concreteMethod = msym; if (receiver != msym.owner && receiver != NoSymbol) { - concreteMethod = msym.overridingSymbol(receiver); if (settings.debug.value) log("" + i + " has actual receiver: " + receiver); } + if (!concreteMethod.isFinal && receiver.isFinal) { + concreteMethod = lookupImpl(concreteMethod, receiver) + if (settings.debug.value) + log("\tlooked up method: " + concreteMethod.fullNameString) + } if (settings.debug.value) log("Treating " + i + "\n\tclasses.contains: " + classes.contains(receiver) @@ -311,7 +315,8 @@ abstract class Inliners extends SubComponent { if ( classes.contains(receiver) && (isClosureClass(receiver) - || concreteMethod.isFinal)) { + || concreteMethod.isFinal + || receiver.isFinal)) { classes(receiver).lookupMethod(concreteMethod) match { case Some(inc) => if (inc.symbol != m.symbol @@ -422,6 +427,20 @@ abstract class Inliners extends SubComponent { true } + private def lookupImpl(meth: Symbol, clazz: Symbol): Symbol = { +// println("\t\tlooking up " + meth + " in " + clazz.fullNameString + " meth.owner = " + meth.owner) + if (meth.owner == clazz) meth + else { + val implementingMethod = meth.overridingSymbol(clazz) + if (implementingMethod != NoSymbol) + implementingMethod + else if (meth.owner.isTrait) + meth + else + lookupImpl(meth, clazz.tpe.parents(0).typeSymbol) + } + } + /** small method size (in blocks) */ val SMALL_METHOD_SIZE = 4 |