@@ -6,7 +6,7 @@ import scala.reflect.SourceContext
6
6
import scala .lms .internal .{GenericNestedCodegen , GenericFatCodegen , GenerationFailedException }
7
7
8
8
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 =>
10
10
11
11
// split effectful statements: one piece for each affected mutable object.
12
12
// this provides for simple dce: pieces not referenced are eliminated.
@@ -64,8 +64,8 @@ trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIte
64
64
TP (s1, Reflect (PreviousIteration (k),u,es:+ loopSym))
65
65
case t => t
66
66
}
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
69
69
}
70
70
71
71
if (u.maySimple)
@@ -137,10 +137,15 @@ trait SplitEffectsExpFat extends IfThenElseFatExp with WhileExp with PreviousIte
137
137
138
138
case class SimpleFatWhile (cond : Block [Boolean ], body : List [Block [Any ]]) extends FatDef {
139
139
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
+ }
140
145
}
141
146
142
147
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)
144
149
case _ => super .syms(e)
145
150
}
146
151
@@ -186,7 +191,7 @@ trait BaseGenSplitEffects extends BaseGenIfThenElseFat with GenericFatCodegen {
186
191
case TP (s,d@ While (c,b)) => TTP (List (s),List (d),SimpleFatWhile (c,List (b)))
187
192
case TP (s,d@ Reflect (While (c,b),u,es)) =>
188
193
val x = SimpleFatWhile (c,List (b))
189
- x.extradeps = es.asInstanceOf [List [Sym [Any ]]]
194
+ x.setExtraDeps( es.asInstanceOf [List [Sym [Any ]]])
190
195
TTP (List (s),List (d),x)
191
196
case TP (s,d@ Reflect (PreviousIteration (k),u,es)) =>
192
197
val x = SimpleFatPrevious (k,es.asInstanceOf [List [Sym [Any ]]])
@@ -225,7 +230,7 @@ trait BaseGenSplitEffects extends BaseGenIfThenElseFat with GenericFatCodegen {
225
230
case ((c, " while" ), wls : List [TTP ]) =>
226
231
val x = SimpleFatWhile (wls.map(_.rhs.asInstanceOf [SimpleFatWhile ].cond).apply(0 ), // FIXME: merge cond!!!
227
232
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) )
229
234
TTP (wls.flatMap(_.lhs), wls.flatMap(_.mhs), // TODO: merge cond blocks!
230
235
x)
231
236
case ((k: Exp [Nothing ]," prev" ), pvs : List [TTP ]) =>
0 commit comments