Merge remote-tracking branch 'origin/topic/vern/zam-EH-coalesce'

* origin/topic/vern/zam-EH-coalesce:
  BTest updates to accommodate event handler coalescence differences
  BTests for testing that event handler coalescence operates as expected
  coalescing of event handlers (ZAM optimization)

Minor fixups during merge as commented on the PR.
This commit is contained in:
Arne Welzel 2023-11-17 18:00:32 +01:00
commit b0a200a5dc
17 changed files with 395 additions and 69 deletions

View file

@ -170,13 +170,16 @@ EventGroup::EventGroup(EventGroupKind kind, std::string_view name) : kind(kind),
// from the public zeek:: namespace.
void EventGroup::UpdateFuncBodies() {
static auto is_group_disabled = [](const auto& g) { return g->IsDisabled(); };
static auto is_body_enabled = [](const auto& b) { return ! b.disabled; };
for ( auto& func : funcs ) {
for ( auto& b : func->bodies )
func->has_enabled_bodies = false;
func->all_bodies_enabled = true;
for ( auto& b : func->bodies ) {
b.disabled = std::any_of(b.groups.cbegin(), b.groups.cend(), is_group_disabled);
static auto is_body_enabled = [](const auto& b) { return ! b.disabled; };
func->has_enabled_bodies = std::any_of(func->bodies.cbegin(), func->bodies.cend(), is_body_enabled);
func->has_enabled_bodies |= is_body_enabled(b);
func->all_bodies_enabled &= is_body_enabled(b);
}
}
}