Reformat the world

This commit is contained in:
Tim Wojtulewicz 2021-09-16 15:35:39 -07:00
parent 194cb24547
commit b2f171ec69
714 changed files with 35149 additions and 35203 deletions

View file

@ -7,25 +7,27 @@
#include "zeek/script_opt/ZAM/IterInfo.h"
#include "zeek/script_opt/ZAM/Support.h"
namespace zeek::detail {
namespace zeek::detail
{
// Static information about globals used in a function.
class GlobalInfo {
class GlobalInfo
{
public:
IDPtr id;
int slot;
};
};
// These are the counterparts to CaseMapI and CaseMapsI in ZAM.h,
// but concretized to use instruction numbers rather than pointers
// to instructions.
template<typename T> using CaseMap = std::map<T, int>;
template<typename T> using CaseMaps = std::vector<CaseMap<T>>;
template <typename T> using CaseMap = std::map<T, int>;
template <typename T> using CaseMaps = std::vector<CaseMap<T>>;
using TableIterVec = std::vector<TableIterInfo>;
class ZBody : public Stmt {
class ZBody : public Stmt
{
public:
ZBody(const char* _func_name, const ZAMCompiler* zc);
@ -62,7 +64,7 @@ protected:
bool CheckAnyType(const TypePtr& any_type, const TypePtr& expected_type,
const Location* loc) const;
StmtPtr Duplicate() override { return {NewRef{}, this}; }
StmtPtr Duplicate() override { return {NewRef{}, this}; }
void StmtDescribe(ODesc* d) const override;
TraversalCode Traverse(TraversalCallback* cb) const override;
@ -105,28 +107,29 @@ private:
//
// These need to be pointers so we can manipulate them in a
// const method.
std::vector<int>* inst_count = nullptr; // for profiling
double* CPU_time = nullptr; // cumulative CPU time for the program
std::vector<double>* inst_CPU; // per-instruction CPU time.
std::vector<int>* inst_count = nullptr; // for profiling
double* CPU_time = nullptr; // cumulative CPU time for the program
std::vector<double>* inst_CPU; // per-instruction CPU time.
CaseMaps<bro_int_t> int_cases;
CaseMaps<bro_uint_t> uint_cases;
CaseMaps<double> double_cases;
CaseMaps<std::string> str_cases;
};
};
// This is a statement that resumes execution into a code block in a
// ZBody. Used for deferred execution for "when" statements.
class ZAMResumption : public Stmt {
class ZAMResumption : public Stmt
{
public:
ZAMResumption(ZBody* _am, int _xfer_pc)
: Stmt(STMT_ZAM_RESUMPTION), am(_am), xfer_pc(_xfer_pc)
{ }
ZAMResumption(ZBody* _am, int _xfer_pc) : Stmt(STMT_ZAM_RESUMPTION), am(_am), xfer_pc(_xfer_pc)
{
}
ValPtr Exec(Frame* f, StmtFlowType& flow) override;
StmtPtr Duplicate() override { return {NewRef{}, this}; }
StmtPtr Duplicate() override { return {NewRef{}, this}; }
void StmtDescribe(ODesc* d) const override;
@ -135,10 +138,9 @@ protected:
ZBody* am;
int xfer_pc = 0;
};
};
// Prints the execution profile.
extern void report_ZOP_profile();
} // namespace zeek::detail
} // namespace zeek::detail