mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
allow profiling without updating of hash values
This commit is contained in:
parent
3962810e4b
commit
d2c6208421
3 changed files with 30 additions and 19 deletions
|
@ -546,7 +546,9 @@ void ProfileFunc::CheckRecordConstructor(TypePtr t) {
|
|||
}
|
||||
}
|
||||
|
||||
ProfileFuncs::ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred, bool _full_record_hashes) {
|
||||
ProfileFuncs::ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred, bool _compute_func_hashes,
|
||||
bool _full_record_hashes) {
|
||||
compute_func_hashes = _compute_func_hashes;
|
||||
full_record_hashes = _full_record_hashes;
|
||||
|
||||
for ( auto& f : funcs ) {
|
||||
|
@ -558,6 +560,11 @@ ProfileFuncs::ProfileFuncs(std::vector<FuncInfo>& funcs, is_compilable_pred pred
|
|||
// Track the profile even if we're not compiling the function, since
|
||||
// the AST optimizer will still need it to reason about function-call
|
||||
// side effects.
|
||||
|
||||
// Propagate previous hash if requested.
|
||||
if ( ! compute_func_hashes && f.Profile() )
|
||||
pf->SetHashVal(f.Profile()->HashVal());
|
||||
|
||||
f.SetProfile(std::move(pf));
|
||||
func_profs[f.Func()] = f.ProfilePtr();
|
||||
}
|
||||
|
@ -805,15 +812,18 @@ void ProfileFuncs::ComputeTypeHashes(const std::vector<const Type*>& types) {
|
|||
}
|
||||
|
||||
void ProfileFuncs::ComputeBodyHashes(std::vector<FuncInfo>& funcs) {
|
||||
for ( auto& f : funcs )
|
||||
if ( ! f.ShouldSkip() )
|
||||
ComputeProfileHash(f.ProfilePtr());
|
||||
if ( compute_func_hashes )
|
||||
for ( auto& f : funcs )
|
||||
if ( ! f.ShouldSkip() )
|
||||
ComputeProfileHash(f.ProfilePtr());
|
||||
|
||||
for ( auto& l : lambdas ) {
|
||||
auto pf = ExprProf(l);
|
||||
func_profs[l->PrimaryFunc().get()] = pf;
|
||||
lambda_primaries[l->Name()] = l->PrimaryFunc().get();
|
||||
ComputeProfileHash(pf);
|
||||
|
||||
if ( compute_func_hashes )
|
||||
ComputeProfileHash(pf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue