mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
removed skeletal (non-functioning) "when" support from ZAM
This commit is contained in:
parent
84906171ba
commit
61891e615a
3 changed files with 0 additions and 100 deletions
|
@ -137,7 +137,6 @@ private:
|
|||
const ZAMStmt CompileCatchReturn(const CatchReturnStmt* cr);
|
||||
const ZAMStmt CompileStmts(const StmtList* sl);
|
||||
const ZAMStmt CompileInit(const InitStmt* is);
|
||||
const ZAMStmt CompileWhen(const WhenStmt* ws);
|
||||
|
||||
const ZAMStmt CompileNext() { return GenGoTo(nexts.back()); }
|
||||
const ZAMStmt CompileBreak() { return GenGoTo(breaks.back()); }
|
||||
|
|
|
@ -1845,28 +1845,6 @@ type V
|
|||
eval (*tiv_ptr)[z.v1].Clear();
|
||||
|
||||
|
||||
|
||||
op When
|
||||
op1-read
|
||||
type VVVV
|
||||
eval auto when_body = make_intrusive<ZAMResumption>(this, z.v2);
|
||||
auto timeout_body = make_intrusive<ZAMResumption>(this, z.v3);
|
||||
ExprPtr when_cond = {NewRef{}, const_cast<Expr*>(z.e)};
|
||||
new trigger::Trigger(when_cond, when_body, timeout_body, frame[z.v1].double_val, f, z.v4, z.loc);
|
||||
|
||||
op When
|
||||
type VVVC
|
||||
eval auto when_body = make_intrusive<ZAMResumption>(this, z.v1);
|
||||
auto timeout_body = make_intrusive<ZAMResumption>(this, z.v2);
|
||||
ExprPtr when_cond = {NewRef{}, const_cast<Expr*>(z.e)};
|
||||
new trigger::Trigger(when_cond, when_body, timeout_body, z.c.double_val, f, z.v3, z.loc);
|
||||
|
||||
op When
|
||||
type VV
|
||||
eval auto when_body = make_intrusive<ZAMResumption>(this, z.v2);
|
||||
ExprPtr when_cond = {NewRef{}, const_cast<Expr*>(z.e)};
|
||||
new trigger::Trigger(when_cond, when_body, nullptr, -1.0, f, z.v1, z.loc);
|
||||
|
||||
op CheckAnyLen
|
||||
op1-read
|
||||
type Vi
|
||||
|
|
|
@ -63,9 +63,6 @@ const ZAMStmt ZAMCompiler::CompileStmt(const Stmt* s)
|
|||
case STMT_NULL:
|
||||
return EmptyStmt();
|
||||
|
||||
case STMT_WHEN:
|
||||
return CompileWhen(static_cast<const WhenStmt*>(s));
|
||||
|
||||
case STMT_CHECK_ANY_LEN:
|
||||
{
|
||||
auto cs = static_cast<const CheckAnyLenStmt*>(s);
|
||||
|
@ -1125,78 +1122,4 @@ const ZAMStmt ZAMCompiler::InitTable(IDPtr id, TableType* tt, Attributes* attrs)
|
|||
return AddInst(z);
|
||||
}
|
||||
|
||||
const ZAMStmt ZAMCompiler::CompileWhen(const WhenStmt* ws)
|
||||
{
|
||||
auto cond = ws->Cond();
|
||||
auto body = ws->Body();
|
||||
auto timeout = ws->TimeoutExpr();
|
||||
auto timeout_body = ws->TimeoutBody();
|
||||
auto is_return = ws->IsReturn();
|
||||
|
||||
ZInstI z;
|
||||
|
||||
if ( timeout )
|
||||
{
|
||||
// Note, we fill in is_return by hand since it's already
|
||||
// an int_val, doesn't need translation.
|
||||
if ( timeout->Tag() == EXPR_CONST )
|
||||
{
|
||||
z = GenInst(OP_WHEN_VVVC, timeout->AsConstExpr());
|
||||
z.op_type = OP_VVVC_I1_I2_I3;
|
||||
z.v3 = is_return;
|
||||
}
|
||||
else
|
||||
{
|
||||
z = GenInst(OP_WHEN_VVVV, timeout->AsNameExpr());
|
||||
z.op_type = OP_VVVV_I2_I3_I4;
|
||||
z.v4 = is_return;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
z = GenInst(OP_WHEN_VV);
|
||||
z.op_type = OP_VV_I1_I2;
|
||||
z.v1 = is_return;
|
||||
}
|
||||
|
||||
z.e = cond.get();
|
||||
|
||||
auto when_eval = AddInst(z);
|
||||
|
||||
auto branch_past_blocks = GoToStub();
|
||||
|
||||
auto when_body = CompileStmt(body);
|
||||
auto when_done = ReturnX();
|
||||
|
||||
if ( timeout )
|
||||
{
|
||||
auto t_body = CompileStmt(timeout_body);
|
||||
auto t_done = ReturnX();
|
||||
|
||||
if ( timeout->Tag() == EXPR_CONST )
|
||||
{
|
||||
SetV1(when_eval, GoToTargetBeyond(branch_past_blocks));
|
||||
SetV2(when_eval, GoToTargetBeyond(when_done));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetV2(when_eval, GoToTargetBeyond(branch_past_blocks));
|
||||
SetV3(when_eval, GoToTargetBeyond(when_done));
|
||||
}
|
||||
|
||||
SetGoTo(branch_past_blocks, GoToTargetBeyond(t_done));
|
||||
|
||||
return t_done;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
SetV2(when_eval, GoToTargetBeyond(branch_past_blocks));
|
||||
SetGoTo(branch_past_blocks, GoToTargetBeyond(when_done));
|
||||
|
||||
return when_done;
|
||||
}
|
||||
}
|
||||
|
||||
} // zeek::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue