diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index d83e7341e6..7f5ca3c357 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -23,7 +23,7 @@ abstract class CopyPropagation { import icodes._ /** Locations can be local variables, this, and fields. */ - abstract sealed class Location; + abstract sealed class Location case class LocalVar(l: Local) extends Location case class Field(r: Record, sym: Symbol) extends Location case object This extends Location @@ -459,11 +459,16 @@ abstract class CopyPropagation { final def cleanReferencesTo(s: copyLattice.State, target: Location) { def cleanRecord(r: Record): Record = { r.bindings retain { (loc, value) => - value match { + (value match { case Deref(loc1) if (loc1 == target) => false case Boxed(loc1) if (loc1 == target) => false case _ => true - } + }) && (target match { + case Field(AllRecords, sym1) => + println(target + " sym1: " + sym1.idString + " loc: " + loc.idString) + !(loc == sym1) + case _ => true + }) } r } @@ -479,8 +484,8 @@ abstract class CopyPropagation { (value match { case Deref(loc1) if (loc1 == target) => false case Boxed(loc1) if (loc1 == target) => false - case Record(_, _) => - cleanRecord(value.asInstanceOf[Record]); + case rec @ Record(_, _) => + cleanRecord(rec); true case _ => true }) && |