Skip to content

Commit 8279c59

Browse files
committed
fix travis build
code coverage plugin was choking on an issue with __assign in SplitEffects
1 parent 9b7db90 commit 8279c59

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/common/SplitEffects.scala

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import scala.reflect.SourceContext
66
import scala.lms.internal.{GenericNestedCodegen, GenericFatCodegen, GenerationFailedException}
77

88

9-
trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIterationDummyExp { this: BooleanOpsExp with EqualExpBridge =>
9+
trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIterationDummyExp { thisIR: BooleanOpsExp with EqualExpBridge =>
1010

1111
// split effectful statements: one piece for each affected mutable object.
1212
// this provides for simple dce: pieces not referenced are eliminated.
@@ -64,8 +64,8 @@ trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIte
6464
TP(s1, Reflect(PreviousIteration(k),u,es:+loopSym))
6565
case t => t
6666
}
67-
(this: EmbeddedControls).__assign(globalDefs, globalDefs map xform) // FIXME: SI-6100
68-
(this: EmbeddedControls).__assign(localDefs, localDefs map xform) // FIXME: SI-6100
67+
(thisIR: EmbeddedControls).__assign(globalDefs, globalDefs map xform) // FIXME: SI-6100
68+
(thisIR: EmbeddedControls).__assign(localDefs, localDefs map xform) // FIXME: SI-6100
6969
}
7070

7171
if (u.maySimple)
@@ -137,10 +137,15 @@ trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIte
137137

138138
case class SimpleFatWhile(cond: Block[Boolean], body: List[Block[Any]]) extends FatDef {
139139
var extradeps: List[Sym[Any]] = Nil //HACK
140+
def setExtraDeps(es: List[Sym[Any]]) = {
141+
// need to do it this way. otherwise we get compiler errors, but strangely
142+
// only when instrumenting code for coverage.
143+
(thisIR: EmbeddedControls).__assign(extradeps, es)
144+
}
140145
}
141146

142147
override def syms(e: Any): List[Sym[Any]] = e match {
143-
case x@SimpleFatWhile(c, b) => syms(c) ++ syms(b) ++ syms(x.extradeps)
148+
case x@SimpleFatWhile(c, b) => syms(c) ++ syms(b) ++ syms(x.extradeps)
144149
case _ => super.syms(e)
145150
}
146151

@@ -186,7 +191,7 @@ trait BaseGenSplitEffects extends BaseGenIfThenElseFat with GenericFatCodegen {
186191
case TP(s,d@While(c,b)) => TTP(List(s),List(d),SimpleFatWhile(c,List(b)))
187192
case TP(s,d@Reflect(While(c,b),u,es)) =>
188193
val x = SimpleFatWhile(c,List(b))
189-
x.extradeps = es.asInstanceOf[List[Sym[Any]]]
194+
x.setExtraDeps(es.asInstanceOf[List[Sym[Any]]])
190195
TTP(List(s),List(d),x)
191196
case TP(s,d@Reflect(PreviousIteration(k),u,es)) =>
192197
val x = SimpleFatPrevious(k,es.asInstanceOf[List[Sym[Any]]])
@@ -225,7 +230,7 @@ trait BaseGenSplitEffects extends BaseGenIfThenElseFat with GenericFatCodegen {
225230
case ((c, "while"), wls: List[TTP]) =>
226231
val x = SimpleFatWhile(wls.map(_.rhs.asInstanceOf[SimpleFatWhile].cond).apply(0), //FIXME: merge cond!!!
227232
wls.flatMap(_.rhs.asInstanceOf[SimpleFatWhile].body))
228-
x.extradeps = wls.flatMap(_.rhs.asInstanceOf[SimpleFatWhile].extradeps) diff wls.flatMap(_.lhs)
233+
x.setExtraDeps(wls.flatMap(_.rhs.asInstanceOf[SimpleFatWhile].extradeps) diff wls.flatMap(_.lhs))
229234
TTP(wls.flatMap(_.lhs), wls.flatMap(_.mhs), // TODO: merge cond blocks!
230235
x)
231236
case ((k:Exp[Nothing],"prev"), pvs: List[TTP]) =>

0 commit comments

Comments
 (0)