mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/ZAM-assert-streamlining'
* origin/topic/vern/ZAM-assert-streamlining: simplified ZAM instructions for executing "assert" statements
This commit is contained in:
commit
d788ab8f0e
4 changed files with 19 additions and 17 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
|||
7.1.0-dev.823 | 2024-12-13 12:14:46 -0700
|
||||
|
||||
* simplified ZAM instructions for executing "assert" statements (Vern Paxson, Corelight)
|
||||
|
||||
7.1.0-dev.821 | 2024-12-13 12:14:17 -0700
|
||||
|
||||
* cirrus/container_image_manifest: match RC tags, too (Arne Welzel, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
7.1.0-dev.821
|
||||
7.1.0-dev.823
|
||||
|
|
|
@ -348,22 +348,20 @@ eval static auto assertion_result_hook = id::find_func("assertion_result");
|
|||
$$ = ! $1 || run_result_hook;
|
||||
|
||||
op Report-Assert
|
||||
# Operands are (1) result from Should-Report-Assert, (2) assertion value,
|
||||
# (3) description of the condition (always a constant).
|
||||
# Operands are (1) assertion value, (2) description of the condition
|
||||
# (always a constant).
|
||||
op1-read
|
||||
classes VVC
|
||||
op-types I I S
|
||||
eval if ( $$ )
|
||||
{
|
||||
zeek::StringValPtr msg_val = zeek::val_mgr->EmptyString();
|
||||
report_assert($1, $2->ToStdString(), msg_val, Z_LOC->Loc());
|
||||
}
|
||||
classes VC
|
||||
op-types I S
|
||||
eval {
|
||||
zeek::StringValPtr msg_val = zeek::val_mgr->EmptyString();
|
||||
report_assert($$, $1->ToStdString(), msg_val, Z_LOC->Loc());
|
||||
}
|
||||
|
||||
op Report-Assert-With-Message
|
||||
# The same, but with an additional operand being the associated message
|
||||
# (as a variable, so it comes in $2 rather than $3).
|
||||
# (as a variable, so it comes in $1 rather than $2).
|
||||
op1-read
|
||||
classes VVVC
|
||||
op-types I I S S
|
||||
eval if ( $$ )
|
||||
report_assert($1, $3->ToStdString(), {NewRef{}, $2}, Z_LOC->Loc());
|
||||
classes VVC
|
||||
op-types I S S
|
||||
eval report_assert($$, $2->ToStdString(), {NewRef{}, $1}, Z_LOC->Loc());
|
||||
|
|
|
@ -1083,10 +1083,10 @@ const ZAMStmt ZAMCompiler::CompileAssert(const AssertStmt* as) {
|
|||
else
|
||||
msg_slot = FrameSlot(msg->AsNameExpr());
|
||||
|
||||
z = ZInstI(OP_REPORT_ASSERT_WITH_MESSAGE_VVVC, decision_slot, cond_slot, msg_slot, cond_desc_e.get());
|
||||
z = ZInstI(OP_REPORT_ASSERT_WITH_MESSAGE_VVC, cond_slot, msg_slot, cond_desc_e.get());
|
||||
}
|
||||
else
|
||||
z = ZInstI(OP_REPORT_ASSERT_VVC, decision_slot, cond_slot, cond_desc_e.get());
|
||||
z = ZInstI(OP_REPORT_ASSERT_VC, cond_slot, cond_desc_e.get());
|
||||
|
||||
auto end_inst = AddInst(z);
|
||||
AddCFT(insts1.back(), CFT_BLOCK_END);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue