@@ -225,8 +225,10 @@ trait StagedWasmEvaluator extends SAIOps {
225225 })
226226 // TODO: put the cond.s to path condition
227227 if (cond.toInt != 0 ) {
228+ ExploreTree .fillWithIfElse(cond.s, true )
228229 eval(thn, restK _, mkont, restK _ :: trail)(newCtx)
229230 } else {
231+ ExploreTree .fillWithIfElse(cond.s.not, false )
230232 eval(els, restK _, mkont, restK _ :: trail)(newCtx)
231233 }
232234 ()
@@ -239,9 +241,11 @@ trait StagedWasmEvaluator extends SAIOps {
239241 // TODO: put the cond.s to path condition
240242 if (cond.toInt != 0 ) {
241243 info(s " Jump to $label" )
244+ ExploreTree .fillWithIfElse(cond.s, true )
242245 trail(label)(newCtx)(mkont)
243246 } else {
244247 info(s " Continue " )
248+ ExploreTree .fillWithIfElse(cond.s.not, false )
245249 eval(rest, kont, mkont, trail)(newCtx)
246250 }
247251 ()
@@ -575,6 +579,13 @@ trait StagedWasmEvaluator extends SAIOps {
575579 }
576580 }
577581
582+ // Exploration tree,
583+ object ExploreTree {
584+ def fillWithIfElse (s : Rep [SymVal ], branch : Boolean ): Rep [Unit ] = {
585+ " tree-fill-if-else" .reflectCtrlWith[Unit ](s, branch)
586+ }
587+ }
588+
578589 // runtime Num type
579590 implicit class StagedNumOps (num : StagedNum ) {
580591
@@ -733,6 +744,12 @@ trait StagedWasmEvaluator extends SAIOps {
733744 }
734745 }
735746 }
747+
748+ implicit class SymbolicOps (s : Rep [SymVal ]) {
749+ def not (): Rep [SymVal ] = {
750+ " sym-not" .reflectCtrlWith(s)
751+ }
752+ }
736753}
737754
738755trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
@@ -881,6 +898,10 @@ trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
881898 shallow(lhs); emit(" >= " ); shallow(rhs)
882899 case Node (_, " num-to-int" , List (num), _) =>
883900 shallow(num); emit(" .toInt()" )
901+ case Node (_, " tree-fill-if-else" , List (s, b), _) =>
902+ emit(" ExploreTree.fillIfElseNode(" ); shallow(s); emit(" , " ); shallow(b); emit(" )" )
903+ case Node (_, " sym-not" , List (s), _) =>
904+ shallow(s); emit(" .negate()" )
884905 case Node (_, " dummy" , _, _) => emit(" std::monostate()" )
885906 case Node (_, " dummy-op" , _, _) => emit(" std::monostate()" )
886907 case Node (_, " no-op" , _, _) =>
0 commit comments