inlining of Zeek script functions

This commit is contained in:
Vern Paxson 2020-11-19 16:05:42 -08:00
parent 3c39f11726
commit c42586af2c
63 changed files with 21807 additions and 171 deletions

View file

@ -115,7 +115,7 @@ std::string render_call_stack()
if ( ci.call )
{
auto loc = ci.call->GetLocationInfo();
auto loc = ci.call->Original()->GetLocationInfo();
rval += util::fmt(" at %s:%d", loc->filename, loc->first_line);
}
@ -310,6 +310,7 @@ ScriptFunc::ScriptFunc(const IDPtr& arg_id, StmtPtr arg_body,
{
Body b;
b.stmts = AddInits(std::move(arg_body), aggr_inits);
current_body = b.stmts;
b.priority = priority;
bodies.push_back(b);
}
@ -385,7 +386,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const
{
if ( sample_logger )
sample_logger->LocationSeen(
body.stmts->GetLocationInfo());
body.stmts->Original()->GetLocationInfo());
// Fill in the rest of the frame with the function's arguments.
for ( auto j = 0u; j < args->size(); ++j )
@ -497,6 +498,8 @@ void ScriptFunc::AddBody(StmtPtr new_body,
b.stmts = new_body;
b.priority = priority;
current_body = new_body;
bodies.push_back(b);
sort(bodies.begin(), bodies.end());
}
@ -627,6 +630,7 @@ BuiltinFunc::BuiltinFunc(built_in_func arg_func, const char* arg_name,
type = id->GetType<FuncType>();
id->SetVal(make_intrusive<Val>(IntrusivePtr{NewRef{}, this}));
id->SetConst();
}
BuiltinFunc::~BuiltinFunc()