@@ -224,11 +224,12 @@ trait StagedWasmEvaluator extends SAIOps {
224
224
eval(rest, kont, mk, trail)(newRestCtx)
225
225
})
226
226
// TODO: put the cond.s to path condition
227
+ ExploreTree .fillWithIfElse(cond.s)
227
228
if (cond.toInt != 0 ) {
228
- ExploreTree .fillWithIfElse(cond.s, true )
229
+ ExploreTree .moveCursor( true )
229
230
eval(thn, restK _, mkont, restK _ :: trail)(newCtx)
230
231
} else {
231
- ExploreTree .fillWithIfElse(cond.s.not, false )
232
+ ExploreTree .moveCursor( false )
232
233
eval(els, restK _, mkont, restK _ :: trail)(newCtx)
233
234
}
234
235
()
@@ -239,13 +240,14 @@ trait StagedWasmEvaluator extends SAIOps {
239
240
val (cond, newCtx) = Stack .pop()
240
241
info(s " The br_if( ${label})'s condition is " , cond.toInt)
241
242
// TODO: put the cond.s to path condition
243
+ ExploreTree .fillWithIfElse(cond.s)
242
244
if (cond.toInt != 0 ) {
243
245
info(s " Jump to $label" )
244
- ExploreTree .fillWithIfElse(cond.s, true )
246
+ ExploreTree .moveCursor( true )
245
247
trail(label)(newCtx)(mkont)
246
248
} else {
247
249
info(s " Continue " )
248
- ExploreTree .fillWithIfElse(cond.s.not, false )
250
+ ExploreTree .moveCursor( false )
249
251
eval(rest, kont, mkont, trail)(newCtx)
250
252
}
251
253
()
@@ -581,8 +583,12 @@ trait StagedWasmEvaluator extends SAIOps {
581
583
582
584
// Exploration tree,
583
585
object ExploreTree {
584
- def fillWithIfElse (s : Rep [SymVal ], branch : Boolean ): Rep [Unit ] = {
585
- " tree-fill-if-else" .reflectCtrlWith[Unit ](s, branch)
586
+ def fillWithIfElse (s : Rep [SymVal ]): Rep [Unit ] = {
587
+ " tree-fill-if-else" .reflectCtrlWith[Unit ](s)
588
+ }
589
+
590
+ def moveCursor (branch : Boolean ): Rep [Unit ] = {
591
+ " tree-move-cursor" .reflectCtrlWith[Unit ](branch)
586
592
}
587
593
}
588
594
@@ -898,8 +904,10 @@ trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
898
904
shallow(lhs); emit(" >= " ); shallow(rhs)
899
905
case Node (_, " num-to-int" , List (num), _) =>
900
906
shallow(num); emit(" .toInt()" )
901
- case Node (_, " tree-fill-if-else" , List (s, b), _) =>
902
- emit(" ExploreTree.fillIfElseNode(" ); shallow(s); emit(" , " ); shallow(b); emit(" )" )
907
+ case Node (_, " tree-fill-if-else" , List (s), _) =>
908
+ emit(" ExploreTree.fillIfElseNode(" ); shallow(s); emit(" )" )
909
+ case Node (_, " tree-move-cursor" , List (b), _) =>
910
+ emit(" ExploreTree.moveCursor(" ); shallow(b); emit(" )" )
903
911
case Node (_, " sym-not" , List (s), _) =>
904
912
shallow(s); emit(" .negate()" )
905
913
case Node (_, " dummy" , _, _) => emit(" std::monostate()" )
0 commit comments