@@ -576,7 +576,11 @@ trait StagedWasmEvaluator extends SAIOps {
576576 }
577577 ()
578578 case Import (" i32" , " sym_assert" , _) =>
579- // TODO: implement sym_assert
579+ val (condTy, newCtx) = ctx.pop()
580+ val v = Stack .popC(condTy)
581+ val s = Stack .popS(condTy)
582+ runtimeSymAssert(s)
583+ runtimeAssert(v.toInt != 0 )
580584 eval(rest, kont, mkont, trail)(ctx.pop()._2)
581585 case Import (m, f, _) => throw new Exception (s " Unknown import $m. $f at $funcIndex" )
582586 case _ => throw new Exception (s " Definition at $funcIndex is not callable " )
@@ -715,6 +719,10 @@ trait StagedWasmEvaluator extends SAIOps {
715719 " assert-true" .reflectCtrlWith[Unit ](b)
716720 }
717721
722+ def runtimeSymAssert (s : StagedSymbolicNum ): Rep [Unit ] = {
723+ " sym-assert-true" .reflectCtrlWith[Unit ](s.s)
724+ }
725+
718726 // stack operations
719727 object Stack {
720728 def shiftC (offset : Int , size : Int ) = {
@@ -1578,6 +1586,8 @@ trait StagedWasmCppGen extends CGenBase with CppSAICodeGenBase {
15781586 emit(" SymEnv.read(" ); shallow(sym); emit(" )" )
15791587 case Node (_, " assert-true" , List (cond), _) =>
15801588 emit(" GENSYM_ASSERT(" ); shallow(cond); emit(" )" )
1589+ case Node (_, " sym-assert-true" , List (s_cond), _) =>
1590+ emit(" GENSYM_SYM_ASSERT(" ); shallow(s_cond); emit(" )" )
15811591 case Node (_, " tree-fill-if-else" , List (sym, id), _) =>
15821592 emit(" ExploreTree.fillIfElseNode(" ); shallow(sym); emit(" , " ); emit(id.toString); emit(" )" )
15831593 case Node (_, " tree-fill-not-to-explore" , List (), _) =>
0 commit comments