Merge remote-tracking branch 'origin/topic/vern/standalone-BiF-access'

* origin/topic/vern/standalone-BiF-access:
  Fix for standalone initializations that require BiFs, and streamlining of standalone BiF-tracking
This commit is contained in:
Tim Wojtulewicz 2025-09-30 20:45:19 +00:00
commit 99fa163db2
5 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,7 @@
8.1.0-dev.619 | 2025-09-30 20:45:19 +0000
* Fix for standalone initializations that require BiFs, and streamlining of standalone BiF-tracking (Vern Paxson, Corelight)
8.1.0-dev.617 | 2025-09-30 20:12:14 +0000 8.1.0-dev.617 | 2025-09-30 20:12:14 +0000
* fixed bug in logic for including/excluding files for script optimization (Vern Paxson, Corelight) * fixed bug in logic for including/excluding files for script optimization (Vern Paxson, Corelight)

View file

@ -1 +1 @@
8.1.0-dev.617 8.1.0-dev.619

View file

@ -322,7 +322,9 @@ void CPPCompile::GenStandaloneActivation() {
Emit("void standalone_init__CPP()"); Emit("void standalone_init__CPP()");
StartBlock(); StartBlock();
Emit("init__CPP();"); Emit("init__CPP();");
Emit("load_BiFs__CPP(); // support initializations that call BiFs ...");
Emit("standalone_activation__CPP();"); Emit("standalone_activation__CPP();");
Emit("// ... and later use of BiFs from plugins not initially available");
Emit("standalone_finalizations.push_back(load_BiFs__CPP);"); Emit("standalone_finalizations.push_back(load_BiFs__CPP);");
EndBlock(); EndBlock();
} }

View file

@ -388,7 +388,10 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e) {
auto sf = static_cast<ScriptFunc*>(func_vf); auto sf = static_cast<ScriptFunc*>(func_vf);
script_calls.insert(sf); script_calls.insert(sf);
} }
else
// Track the BiF, though not if we know we're not going to
// compile the call to it.
else if ( obj_matches_opt_files(e) != AnalyzeDecision::SHOULD_NOT )
BiF_globals.insert(func); BiF_globals.insert(func);
} }
else { else {

View file

@ -256,7 +256,8 @@ protected:
std::unordered_set<ScriptFunc*> script_calls; std::unordered_set<ScriptFunc*> script_calls;
// Same for BiF's, though for them we record the corresponding global // Same for BiF's, though for them we record the corresponding global
// rather than the BuiltinFunc*. // rather than the BuiltinFunc*. In addition, we only track BiFs germane
// to code we're compiling.
IDSet BiF_globals; IDSet BiF_globals;
// Script functions appearing in "when" clauses. // Script functions appearing in "when" clauses.