From 4928e074d4a895d564fee8756c5342b6e23896ea Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Wed, 16 Aug 2023 17:04:39 -0700 Subject: [PATCH] addressed some nits re "-O gen-C++" script optimization --- src/script_opt/CPP/Compile.h | 4 ++-- src/script_opt/CPP/Driver.cc | 2 -- src/script_opt/CPP/Stmts.cc | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/script_opt/CPP/Compile.h b/src/script_opt/CPP/Compile.h index d0809fbb6a..f8c5822270 100644 --- a/src/script_opt/CPP/Compile.h +++ b/src/script_opt/CPP/Compile.h @@ -830,7 +830,7 @@ private: // If "all_deep" is true, it means make all of the captures // deep copies, not just the ones that were explicitly marked - // as deep copies. That functionality is used to supporting + // as deep copies. That functionality is used to support // Clone() methods; it's not needed when creating a new lambda // instance. std::string GenLambdaClone(const LambdaExpr* l, bool all_deep); @@ -928,7 +928,7 @@ private: // an IntrusivePtr to such a type. const char* IntrusiveVal(const TypePtr& t); - // Maps types to indices in the global "types__CPP" array. + // Maps types to indices in the global "CPP__Type__" array. CPPTracker types = {"types", true}; // Used to prevent analysis of mutually-referring types from diff --git a/src/script_opt/CPP/Driver.cc b/src/script_opt/CPP/Driver.cc index 2cecb4923c..0b23b9bc91 100644 --- a/src/script_opt/CPP/Driver.cc +++ b/src/script_opt/CPP/Driver.cc @@ -124,8 +124,6 @@ void CPPCompile::Compile(bool report_uncompilable) types.AddKey(tp, pfs.HashType(t)); } - Emit("TypePtr types__CPP[%s];", Fmt(static_cast(types.DistinctKeys().size()))); - NL(); for ( auto& g : pfs.AllGlobals() ) diff --git a/src/script_opt/CPP/Stmts.cc b/src/script_opt/CPP/Stmts.cc index a28b4bae92..192fb4ed5c 100644 --- a/src/script_opt/CPP/Stmts.cc +++ b/src/script_opt/CPP/Stmts.cc @@ -89,6 +89,9 @@ void CPPCompile::GenStmt(const Stmt* s) Emit("return false;"); break; + case STMT_FALLTHROUGH: + break; + case STMT_PRINT: { auto el = static_cast(s)->ExprList(); @@ -96,9 +99,6 @@ void CPPCompile::GenStmt(const Stmt* s) } break; - case STMT_FALLTHROUGH: - break; - default: reporter->InternalError("bad statement type in CPPCompile::GenStmt"); }