@@ -225,8 +225,10 @@ trait StagedWasmEvaluator extends SAIOps {
225
225
})
226
226
// TODO: put the cond.s to path condition
227
227
if (cond.toInt != 0 ) {
228
+ ExploreTree .fillWithIfElse(cond.s, true )
228
229
eval(thn, restK _, mkont, restK _ :: trail)(newCtx)
229
230
} else {
231
+ ExploreTree .fillWithIfElse(cond.s.not, false )
230
232
eval(els, restK _, mkont, restK _ :: trail)(newCtx)
231
233
}
232
234
()
@@ -239,9 +241,11 @@ trait StagedWasmEvaluator extends SAIOps {
239
241
// TODO: put the cond.s to path condition
240
242
if (cond.toInt != 0 ) {
241
243
info(s " Jump to $label" )
244
+ ExploreTree .fillWithIfElse(cond.s, true )
242
245
trail(label)(newCtx)(mkont)
243
246
} else {
244
247
info(s " Continue " )
248
+ ExploreTree .fillWithIfElse(cond.s.not, false )
245
249
eval(rest, kont, mkont, trail)(newCtx)
246
250
}
247
251
()
@@ -575,6 +579,13 @@ trait StagedWasmEvaluator extends SAIOps {
575
579
}
576
580
}
577
581
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
+
578
589
// runtime Num type
579
590
implicit class StagedNumOps (num : StagedNum ) {
580
591
@@ -733,6 +744,12 @@ trait StagedWasmEvaluator extends SAIOps {
733
744
}
734
745
}
735
746
}
747
+
748
+ implicit class SymbolicOps (s : Rep [SymVal ]) {
749
+ def not (): Rep [SymVal ] = {
750
+ " sym-not" .reflectCtrlWith(s)
751
+ }
752
+ }
736
753
}
737
754
738
755
trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
@@ -881,6 +898,10 @@ trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
881
898
shallow(lhs); emit(" >= " ); shallow(rhs)
882
899
case Node (_, " num-to-int" , List (num), _) =>
883
900
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()" )
884
905
case Node (_, " dummy" , _, _) => emit(" std::monostate()" )
885
906
case Node (_, " dummy-op" , _, _) => emit(" std::monostate()" )
886
907
case Node (_, " no-op" , _, _) =>
0 commit comments