coalescing of event handlers (ZAM optimization)

This commit is contained in:
Vern Paxson 2023-11-16 12:58:28 -08:00
parent a488dcffb6
commit 3d21d80dac
6 changed files with 267 additions and 46 deletions

View file

@ -473,17 +473,15 @@ static void analyze_scripts_for_ZAM(std::unique_ptr<ProfileFuncs>& pfs) {
bool did_one = false;
for ( auto& f : funcs ) {
if ( ! f.ShouldAnalyze() )
continue;
auto func = f.Func();
auto l = lambdas.find(func);
bool is_lambda = l != lambdas.end();
if ( ! analysis_options.only_funcs.empty() || ! analysis_options.only_files.empty() ) {
if ( ! should_analyze(f.FuncPtr(), f.Body()) )
continue;
}
else if ( ! analysis_options.compile_all && ! is_lambda && inl && inl->WasFullyInlined(func) &&
func_used_indirectly.count(func) == 0 ) {
if ( ! analysis_options.compile_all && ! is_lambda && inl && inl->WasFullyInlined(func) &&
func_used_indirectly.count(func) == 0 ) {
// No need to compile as it won't be called directly.
// We'd like to zero out the body to recover the
// memory, but a *few* such functions do get called,
@ -563,7 +561,7 @@ void analyze_scripts(bool no_unused_warnings) {
if ( should_analyze(func.FuncPtr(), func.Body()) )
have_one_to_do = true;
else
func.SetSkip(true);
func.SetShouldNotAnalyze();
if ( ! have_one_to_do )
reporter->FatalError("no matching functions/files for C++ compilation");