mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/standalone-fixes2'
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
* origin/topic/vern/standalone-fixes2: Fixes for -O gen-standalone-C++ for tracking BiFs, lambdas, attribute types, and independent globals
This commit is contained in:
commit
0700427bac
5 changed files with 58 additions and 8 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
8.1.0-dev.607 | 2025-09-26 14:19:40 -0700
|
||||||
|
|
||||||
|
* Fixes for -O gen-standalone-C++ for tracking BiFs, lambdas, attribute types, and independent globals (Vern Paxson, Corelight)
|
||||||
|
|
||||||
8.1.0-dev.605 | 2025-09-26 11:19:17 -0700
|
8.1.0-dev.605 | 2025-09-26 11:19:17 -0700
|
||||||
|
|
||||||
* OpaqueVal, OCSP, X509: drop outdated LibreSSL guards to fix OpenBSD (Klemens Nanni)
|
* OpaqueVal, OCSP, X509: drop outdated LibreSSL guards to fix OpenBSD (Klemens Nanni)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
8.1.0-dev.605
|
8.1.0-dev.607
|
||||||
|
|
|
@ -83,9 +83,22 @@ void CPPCompile::Compile(bool report_uncompilable) {
|
||||||
accessed_globals.insert(g);
|
accessed_globals.insert(g);
|
||||||
for ( auto& ag : pf->AllGlobals() )
|
for ( auto& ag : pf->AllGlobals() )
|
||||||
all_accessed_globals.insert(ag);
|
all_accessed_globals.insert(ag);
|
||||||
|
for ( auto& l : pf->Lambdas() )
|
||||||
|
// We might not have profiled this previously if none
|
||||||
|
// of the functions refer to the global. This can
|
||||||
|
// happen for example for a global "const" table that's
|
||||||
|
// made available for external lookup use.
|
||||||
|
pfs->ProfileLambda(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( auto& g : pfs->BiFGlobals() )
|
||||||
|
all_accessed_globals.insert(g);
|
||||||
|
|
||||||
|
for ( auto& t : pfs->MainTypes() )
|
||||||
|
if ( obj_matches_opt_files(t) == AnalyzeDecision::SHOULD )
|
||||||
|
rep_types.insert(TypeRep(t));
|
||||||
|
|
||||||
for ( auto& l : pfs->Lambdas() )
|
for ( auto& l : pfs->Lambdas() )
|
||||||
if ( obj_matches_opt_files(l) == AnalyzeDecision::SHOULD )
|
if ( obj_matches_opt_files(l) == AnalyzeDecision::SHOULD )
|
||||||
accessed_lambdas.insert(l);
|
accessed_lambdas.insert(l);
|
||||||
|
|
|
@ -622,6 +622,20 @@ ProfileFuncs::ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred
|
||||||
ComputeSideEffects();
|
ComputeSideEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileFuncs::ProfileLambda(const LambdaExpr* l) {
|
||||||
|
if ( lambdas.contains(l) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
lambdas.insert(l);
|
||||||
|
pending_exprs.push_back(l);
|
||||||
|
|
||||||
|
do
|
||||||
|
DrainPendingExprs();
|
||||||
|
while ( ! pending_exprs.empty() );
|
||||||
|
|
||||||
|
AnalyzeLambdaProfile(l);
|
||||||
|
}
|
||||||
|
|
||||||
bool ProfileFuncs::IsTableWithDefaultAggr(const Type* t) {
|
bool ProfileFuncs::IsTableWithDefaultAggr(const Type* t) {
|
||||||
auto analy = tbl_has_aggr_default.find(t);
|
auto analy = tbl_has_aggr_default.find(t);
|
||||||
if ( analy != tbl_has_aggr_default.end() )
|
if ( analy != tbl_has_aggr_default.end() )
|
||||||
|
@ -848,14 +862,22 @@ void ProfileFuncs::ComputeBodyHashes(std::vector<FuncInfo>& funcs) {
|
||||||
ComputeProfileHash(f.ProfilePtr());
|
ComputeProfileHash(f.ProfilePtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto& l : lambdas ) {
|
for ( auto& l : lambdas )
|
||||||
|
AnalyzeLambdaProfile(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileFuncs::AnalyzeLambdaProfile(const LambdaExpr* l) {
|
||||||
|
if ( processed_lambdas.contains(l) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
processed_lambdas.insert(l);
|
||||||
|
|
||||||
auto pf = ExprProf(l);
|
auto pf = ExprProf(l);
|
||||||
func_profs[l->PrimaryFunc().get()] = pf;
|
func_profs[l->PrimaryFunc().get()] = pf;
|
||||||
lambda_primaries[l->Name()] = l->PrimaryFunc().get();
|
lambda_primaries[l->Name()] = l->PrimaryFunc().get();
|
||||||
|
|
||||||
if ( compute_func_hashes || ! pf->HasHashVal() )
|
if ( compute_func_hashes || ! pf->HasHashVal() )
|
||||||
ComputeProfileHash(pf);
|
ComputeProfileHash(pf);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileFuncs::ComputeProfileHash(std::shared_ptr<ProfileFunc> pf) {
|
void ProfileFuncs::ComputeProfileHash(std::shared_ptr<ProfileFunc> pf) {
|
||||||
|
|
|
@ -366,6 +366,10 @@ public:
|
||||||
ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred, bool compute_func_hashes,
|
ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred, bool compute_func_hashes,
|
||||||
bool full_record_hashes);
|
bool full_record_hashes);
|
||||||
|
|
||||||
|
// Used to profile additional lambdas that (potentially) weren't part
|
||||||
|
// of the overall function profiling.
|
||||||
|
void ProfileLambda(const LambdaExpr* l);
|
||||||
|
|
||||||
// The following accessors provide a global profile across all of
|
// The following accessors provide a global profile across all of
|
||||||
// the (non-skipped) functions in "funcs". See the comments for
|
// the (non-skipped) functions in "funcs". See the comments for
|
||||||
// the associated member variables for documentation.
|
// the associated member variables for documentation.
|
||||||
|
@ -449,6 +453,9 @@ protected:
|
||||||
// Compute hashes to associate with each function
|
// Compute hashes to associate with each function
|
||||||
void ComputeBodyHashes(std::vector<FuncInfo>& funcs);
|
void ComputeBodyHashes(std::vector<FuncInfo>& funcs);
|
||||||
|
|
||||||
|
// For a given lambda, completes analysis of its profile.
|
||||||
|
void AnalyzeLambdaProfile(const LambdaExpr* l);
|
||||||
|
|
||||||
// Compute the hash associated with a single function profile.
|
// Compute the hash associated with a single function profile.
|
||||||
void ComputeProfileHash(std::shared_ptr<ProfileFunc> pf);
|
void ComputeProfileHash(std::shared_ptr<ProfileFunc> pf);
|
||||||
|
|
||||||
|
@ -540,6 +547,10 @@ protected:
|
||||||
// And for lambda's.
|
// And for lambda's.
|
||||||
std::unordered_set<const LambdaExpr*> lambdas;
|
std::unordered_set<const LambdaExpr*> lambdas;
|
||||||
|
|
||||||
|
// Lambdas that we have already processed. An optimization to avoid
|
||||||
|
// unnecessary work.
|
||||||
|
std::unordered_set<const LambdaExpr*> processed_lambdas;
|
||||||
|
|
||||||
// Names of generated events.
|
// Names of generated events.
|
||||||
std::unordered_set<std::string> events;
|
std::unordered_set<std::string> events;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue