Commit 761e22ae authored by Sapphie's avatar Sapphie
Browse files

Implement unstable

parent 2ccfd18a
......@@ -90,7 +90,7 @@ abstract class CPSOptimizer[T <: CPSTreeModule { type Name = Symbol }]
} else {
val replacedArgs = args map { a => s.aSubst.getOrElse(a, a)}
val primArgPair = (prim, replacedArgs)
if (!unstable(prim) && s.eInvEnv.contains(primArgPair)) {
if (!unstable(prim) && !impure(prim) && s.eInvEnv.contains(primArgPair)) {
val newS = s.withASubst(name, s.eInvEnv(primArgPair))
val newBody = shrink(body, newS)
newBody
......@@ -274,7 +274,10 @@ object CPSOptimizerHigh extends CPSOptimizer(SymbolicCPSTreeModule)
protected val impure: ValuePrimitive => Boolean =
Set(ByteRead, ByteWrite, BlockSet)
protected val unstable: ValuePrimitive => Boolean = ???
protected val unstable: ValuePrimitive => Boolean = {
case BlockAlloc(_) | BlockGet | ByteRead => true
case _ => false
}
protected val blockAllocTag: PartialFunction[ValuePrimitive, Literal] = {
case BlockAlloc(t) => t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment