From 5efba9e11544d456f924f6c36737d0f23f2ea739 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Mon, 19 Apr 2021 16:12:15 -0700 Subject: [PATCH] Stmt tag for compiled-to-C++; Inliner knows to avoid it --- src/Stmt.cc | 1 + src/StmtEnums.h | 1 + src/script_opt/Inline.cc | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Stmt.cc b/src/Stmt.cc index 66ea1a1c23..a695b86d30 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -34,6 +34,7 @@ const char* stmt_name(StmtTag t) "", "fallthrough", "while", "catch-return", "check-any-length", + "compiled-C++", "null", }; diff --git a/src/StmtEnums.h b/src/StmtEnums.h index 195597c4cc..d667d5f9a0 100644 --- a/src/StmtEnums.h +++ b/src/StmtEnums.h @@ -20,6 +20,7 @@ enum StmtTag { STMT_WHILE, STMT_CATCH_RETURN, // for reduced InlineExpr's STMT_CHECK_ANY_LEN, // internal reduced statement + STMT_CPP, // compiled C++ STMT_NULL #define NUM_STMTS (int(STMT_NULL) + 1) }; diff --git a/src/script_opt/Inline.cc b/src/script_opt/Inline.cc index 4e7b7effa2..44147624f2 100644 --- a/src/script_opt/Inline.cc +++ b/src/script_opt/Inline.cc @@ -109,8 +109,8 @@ void Inliner::Analyze() } for ( auto& f : funcs ) - // Candidates are non-event, non-hook, non-recursive - // functions ... that don't use lambdas or when's, + // Candidates are non-event, non-hook, non-recursive, + // non-compiled functions ... that don't use lambdas or when's, // since we don't currently compute the closures/frame // sizes for them correctly, and more fundamentally since // we don't compile them and hence inlining them will @@ -118,7 +118,8 @@ void Inliner::Analyze() if ( f.Func()->Flavor() == FUNC_FLAVOR_FUNCTION && non_recursive_funcs.count(f.Func()) > 0 && f.Profile()->NumLambdas() == 0 && - f.Profile()->NumWhenStmts() == 0 ) + f.Profile()->NumWhenStmts() == 0 && + f.Body()->Tag() != STMT_CPP ) inline_ables.insert(f.Func()); for ( auto& f : funcs )