Deprecate bro_int_t and bro_uint_t

This commit is contained in:
Tim Wojtulewicz 2022-06-28 15:32:26 -07:00
parent d066013793
commit f624c18383
67 changed files with 331 additions and 320 deletions

View file

@ -32,7 +32,7 @@
// find optimization opportunities, including inlining.
//
// For some Zeek scripting types, we use their natural C++ counterparts,
// such as "bro_uint_t" for "count" values. In the source code these
// such as "zeek_uint_t" for "count" values. In the source code these
// are referred to as "native" types. Other types, like tables, keep
// their interpreter-equivalent type (e.g., TableVal). These are dealt
// with almost entirely using IntrusivePtr's. The few exceptions (i.e.,
@ -899,7 +899,7 @@ private:
//
// "Native" types are those Zeek scripting types that we support
// using low-level C++ types (like "bro_uint_t" for "count").
// using low-level C++ types (like "zeek_uint_t" for "count").
// Types that we instead support using some form of ValPtr
// representation are "non-native".
bool IsNativeType(const TypePtr& t) const;

View file

@ -216,8 +216,8 @@ void CPPCompile::GenProlog()
NL();
const_info[TYPE_BOOL] = CreateConstInitInfo("Bool", "ValPtr", "bool");
const_info[TYPE_INT] = CreateConstInitInfo("Int", "ValPtr", "bro_int_t");
const_info[TYPE_COUNT] = CreateConstInitInfo("Count", "ValPtr", "bro_uint_t");
const_info[TYPE_INT] = CreateConstInitInfo("Int", "ValPtr", "zeek_int_t");
const_info[TYPE_COUNT] = CreateConstInitInfo("Count", "ValPtr", "zeek_uint_t");
const_info[TYPE_DOUBLE] = CreateConstInitInfo("Double", "ValPtr", "double");
const_info[TYPE_TIME] = CreateConstInitInfo("Time", "ValPtr", "double");
const_info[TYPE_INTERVAL] = CreateConstInitInfo("Interval", "ValPtr", "double");

View file

@ -666,10 +666,10 @@ string CPPCompile::GenArithCoerceExpr(const Expr* e, GenType gt)
switch ( t->InternalType() )
{
case TYPE_INTERNAL_INT:
cast_name = "bro_int_t";
cast_name = "zeek_int_t";
break;
case TYPE_INTERNAL_UNSIGNED:
cast_name = "bro_uint_t";
cast_name = "zeek_uint_t";
break;
case TYPE_INTERNAL_DOUBLE:
cast_name = "double";

View file

@ -392,7 +392,7 @@ public:
}
private:
bro_uint_t p;
zeek_uint_t p;
};
// Abstract class for compound items (those defined in terms of other items).

View file

@ -195,7 +195,7 @@ inline PatternValPtr re_append__CPP(const PatternValPtr& p1, const PatternValPtr
extern ValPtr schedule__CPP(double dt, EventHandlerPtr event, std::vector<ValPtr> args);
// Simple helper functions for supporting absolute value.
inline bro_uint_t iabs__CPP(bro_int_t v)
inline zeek_uint_t iabs__CPP(zeek_int_t v)
{
return v < 0 ? -v : v;
}
@ -207,28 +207,28 @@ inline double fabs__CPP(double v)
// The following operations are provided using functions to support
// error checking/reporting.
inline bro_int_t idiv__CPP(bro_int_t v1, bro_int_t v2)
inline zeek_int_t idiv__CPP(zeek_int_t v1, zeek_int_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("division by zero");
return v1 / v2;
}
inline bro_int_t imod__CPP(bro_int_t v1, bro_int_t v2)
inline zeek_int_t imod__CPP(zeek_int_t v1, zeek_int_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("modulo by zero");
return v1 % v2;
}
inline bro_uint_t udiv__CPP(bro_uint_t v1, bro_uint_t v2)
inline zeek_uint_t udiv__CPP(zeek_uint_t v1, zeek_uint_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("division by zero");
return v1 / v2;
}
inline bro_uint_t umod__CPP(bro_uint_t v1, bro_uint_t v2)
inline zeek_uint_t umod__CPP(zeek_uint_t v1, zeek_uint_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("modulo by zero");

View file

@ -83,8 +83,8 @@ extern VectorValPtr vector_select__CPP(const VectorValPtr& v1, VectorValPtr v2,
extern VectorValPtr vector_coerce_to__CPP(const VectorValPtr& v, const TypePtr& targ);
// Similar coercion, but works for v having perhaps not the correct type.
extern VectorValPtr vec_coerce_to_bro_int_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_bro_uint_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_zeek_int_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_zeek_uint_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_double__CPP(const VectorValPtr& v, TypePtr targ);
// A dummy function used during code generation for unsupported operations

View file

@ -161,17 +161,17 @@ const char* CPPCompile::TypeName(const TypePtr& t)
case TYPE_BOOL:
return "bool";
case TYPE_COUNT:
return "bro_uint_t";
return "zeek_uint_t";
case TYPE_DOUBLE:
return "double";
case TYPE_ENUM:
return "int";
case TYPE_INT:
return "bro_int_t";
return "zeek_int_t";
case TYPE_INTERVAL:
return "double";
case TYPE_PORT:
return "bro_uint_t";
return "zeek_uint_t";
case TYPE_TIME:
return "double";
case TYPE_VOID:

View file

@ -99,7 +99,7 @@ private:
// unseen confluence regions outer to those, and (2) they
// can get quite deep due when inlining, so there are savings
// to avoid having to track outer to them.
std::vector<bro_uint_t> barrier_blocks;
std::vector<zeek_uint_t> barrier_blocks;
// The following is parallel to confluence_blocks except
// the front entry tracks identifiers at the outermost

View file

@ -70,7 +70,7 @@ void IDOptInfo::Clear()
}
void IDOptInfo::DefinedAfter(const Stmt* s, const ExprPtr& e,
const std::vector<const Stmt*>& conf_blocks, bro_uint_t conf_start)
const std::vector<const Stmt*>& conf_blocks, zeek_uint_t conf_start)
{
if ( tracing )
printf("ID %s defined at %d: %s\n", trace_ID, s ? s->GetOptInfo()->stmt_num : NO_DEF,
@ -174,7 +174,7 @@ void IDOptInfo::BranchBackTo(const Stmt* from, const Stmt* to, bool close_all)
auto from_reg = ActiveRegion();
auto f_oi = from->GetOptInfo();
auto t_oi = to->GetOptInfo();
bro_uint_t t_r_ind = FindRegionBeforeIndex(t_oi->stmt_num);
zeek_uint_t t_r_ind = FindRegionBeforeIndex(t_oi->stmt_num);
auto& t_r = usage_regions[t_r_ind];
if ( from_reg && from_reg->DefinedAfter() != t_r.DefinedAfter() &&

View file

@ -144,7 +144,7 @@ public:
// It should be processed starting at conf_start (note that
// conf_blocks may be empty).
void DefinedAfter(const Stmt* s, const ExprPtr& e, const std::vector<const Stmt*>& conf_blocks,
bro_uint_t conf_start);
zeek_uint_t conf_start);
// Called upon encountering a "return" statement.
void ReturnAt(const Stmt* s);

View file

@ -478,7 +478,7 @@ void ZAMCompiler::ReMapFrame()
frame1_to_frame2.resize(frame_layout1.size(), -1);
managed_slotsI.clear();
for ( bro_uint_t i = 0; i < insts1.size(); ++i )
for ( zeek_uint_t i = 0; i < insts1.size(); ++i )
{
auto inst = insts1[i];
@ -655,7 +655,7 @@ void ZAMCompiler::ReMapInterpreterFrame()
remapped_intrp_frame_sizes[func] = next_interp_slot;
}
void ZAMCompiler::ReMapVar(const ID* id, int slot, bro_uint_t inst)
void ZAMCompiler::ReMapVar(const ID* id, int slot, zeek_uint_t inst)
{
// A greedy algorithm for this is to simply find the first suitable
// frame slot. We do that with one twist: we also look for a
@ -731,7 +731,7 @@ void ZAMCompiler::ReMapVar(const ID* id, int slot, bro_uint_t inst)
void ZAMCompiler::CheckSlotAssignment(int slot, const ZInstI* inst)
{
ASSERT(slot >= 0 && static_cast<bro_uint_t>(slot) < frame_denizens.size());
ASSERT(slot >= 0 && static_cast<zeek_uint_t>(slot) < frame_denizens.size());
// We construct temporaries such that their values are never used
// earlier than their definitions in loop bodies. For other
@ -770,7 +770,7 @@ void ZAMCompiler::CheckSlotUse(int slot, const ZInstI* inst)
if ( slot < 0 )
return;
ASSERT(static_cast<bro_uint_t>(slot) < frame_denizens.size());
ASSERT(static_cast<zeek_uint_t>(slot) < frame_denizens.size());
if ( denizen_beginning.count(slot) == 0 )
{
@ -957,9 +957,9 @@ ZInstI* ZAMCompiler::FirstLiveInst(ZInstI* i, bool follow_gotos)
return nullptr;
}
bro_uint_t ZAMCompiler::FirstLiveInst(bro_uint_t i, bool follow_gotos)
zeek_uint_t ZAMCompiler::FirstLiveInst(zeek_uint_t i, bool follow_gotos)
{
bro_uint_t num_inspected = 0;
zeek_uint_t num_inspected = 0;
while ( i < insts1.size() )
{
auto i0 = insts1[i];
@ -987,7 +987,7 @@ bro_uint_t ZAMCompiler::FirstLiveInst(bro_uint_t i, bool follow_gotos)
return i;
}
void ZAMCompiler::KillInst(bro_uint_t i)
void ZAMCompiler::KillInst(zeek_uint_t i)
{
auto inst = insts1[i];
@ -1042,7 +1042,7 @@ void ZAMCompiler::KillInst(bro_uint_t i)
}
}
void ZAMCompiler::KillInsts(bro_uint_t i)
void ZAMCompiler::KillInsts(zeek_uint_t i)
{
auto inst = insts1[i];

View file

@ -416,11 +416,11 @@ bool ZAMCompiler::BuiltIn_to_lower(const NameExpr* n, const ExprPList& args)
return true;
}
bro_uint_t ZAMCompiler::ConstArgsMask(const ExprPList& args, int nargs) const
zeek_uint_t ZAMCompiler::ConstArgsMask(const ExprPList& args, int nargs) const
{
ASSERT(args.length() == nargs);
bro_uint_t mask = 0;
zeek_uint_t mask = 0;
for ( int i = 0; i < nargs; ++i )
{

View file

@ -76,9 +76,9 @@ public:
template <typename T> const CaseMaps<T>& GetCases() const
{
if constexpr ( std::is_same_v<T, bro_int_t> )
if constexpr ( std::is_same_v<T, zeek_int_t> )
return int_cases;
else if constexpr ( std::is_same_v<T, bro_uint_t> )
else if constexpr ( std::is_same_v<T, zeek_uint_t> )
return uint_cases;
else if constexpr ( std::is_same_v<T, double> )
return double_cases;
@ -256,7 +256,7 @@ private:
// being the first argument (argument "0" in the list) and the
// low-ordered bit being the last. Second parameter is the number
// of arguments that should be present.
bro_uint_t ConstArgsMask(const ExprPList& args, int nargs) const;
zeek_uint_t ConstArgsMask(const ExprPList& args, int nargs) const;
int ConvertToInt(const Expr* e)
{
@ -419,7 +419,7 @@ private:
// Computes the remapping for a variable currently in the given slot,
// whose scope begins at the given instruction.
void ReMapVar(const ID* id, int slot, bro_uint_t inst);
void ReMapVar(const ID* id, int slot, zeek_uint_t inst);
// Look to initialize the beginning of local lifetime based on slot
// assignment at instruction inst.
@ -463,7 +463,7 @@ private:
// First form returns nil if there's nothing live after i.
// Second form returns insts1.size() in that case.
ZInstI* FirstLiveInst(ZInstI* i, bool follow_gotos = false);
bro_uint_t FirstLiveInst(bro_uint_t i, bool follow_gotos = false);
zeek_uint_t FirstLiveInst(zeek_uint_t i, bool follow_gotos = false);
// Same, but not including i.
ZInstI* NextLiveInst(ZInstI* i, bool follow_gotos = false)
@ -482,12 +482,12 @@ private:
// into insts1; any labels associated with it are transferred
// to its next live successor, if any.
void KillInst(ZInstI* i) { KillInst(i->inst_num); }
void KillInst(bro_uint_t i);
void KillInst(zeek_uint_t i);
// The same, but kills any successor instructions until finding
// one that's labeled.
void KillInsts(ZInstI* i) { KillInsts(i->inst_num); }
void KillInsts(bro_uint_t i);
void KillInsts(zeek_uint_t i);
// The first of these is used as we compile down to ZInstI's.
// The second is the final intermediary code. They're separate
@ -569,8 +569,8 @@ private:
// Intermediary switch tables (branching to ZInst's rather
// than concrete instruction offsets).
CaseMapsI<bro_int_t> int_casesI;
CaseMapsI<bro_uint_t> uint_casesI;
CaseMapsI<zeek_int_t> int_casesI;
CaseMapsI<zeek_uint_t> uint_casesI;
CaseMapsI<double> double_casesI;
// Note, we use this not only for strings but for addresses
@ -578,8 +578,8 @@ private:
CaseMapsI<std::string> str_casesI;
// Same, but for the concretized versions.
CaseMaps<bro_int_t> int_cases;
CaseMaps<bro_uint_t> uint_cases;
CaseMaps<zeek_int_t> int_cases;
CaseMaps<zeek_uint_t> uint_cases;
CaseMaps<double> double_cases;
CaseMaps<std::string> str_cases;

View file

@ -442,7 +442,7 @@ template <typename T> void ZAMCompiler::DumpCases(const T& cases, const char* ty
std::string case_val;
if constexpr ( std::is_same_v<T, std::string> )
case_val = m.first;
else if constexpr ( std::is_same_v<T, bro_int_t> || std::is_same_v<T, bro_uint_t> ||
else if constexpr ( std::is_same_v<T, zeek_int_t> || std::is_same_v<T, zeek_uint_t> ||
std::is_same_v<T, double> )
case_val = std::to_string(m.first);

View file

@ -641,7 +641,7 @@ const ZAMStmt ZAMCompiler::CompileIndex(const NameExpr* n1, int n2_slot, const T
auto var_ind = ind->Tag() == EXPR_NAME;
auto n3 = var_ind ? ind->AsNameExpr() : nullptr;
auto c3 = var_ind ? nullptr : ind->AsConstExpr();
bro_uint_t c = 0;
zeek_uint_t c = 0;
if ( ! var_ind )
{

View file

@ -126,8 +126,8 @@ public:
void IterFinished() { ++iter; }
// Counter of where we are in the iteration.
bro_uint_t iter; // initialized to 0 at start of loop
bro_uint_t n; // we loop from 0 ... n-1
zeek_uint_t iter; // initialized to 0 at start of loop
zeek_uint_t n; // we loop from 0 ... n-1
// The low-level value we're iterating over.
const std::vector<std::optional<ZVal>>* vv;

View file

@ -8,7 +8,7 @@
# in either the nature of the instruction's operands (typically, whether
# they are variables residing on the ZAM execution frame, or constants)
# and/or the Zeek type of the operands (e.g., "count" or "double" or "addr").
#
#
# The Gen-ZAM utility processes this file to generate numerous C++ inclusion
# files that are then compiled into Zeek. These files span the range of (1)
# hooks that enable run-time generation of ZAM code to execute ASTs (which
@ -16,7 +16,7 @@
# properties of the different instructions, (3) code to evaluate (execute)
# each instruction, and (4) macros (C++ #define's) to aid in writing that
# code. See Gen-ZAM.h for a list of the different inclusion files.
#
#
# Operation templates are declarative, other than the imperative C++ snippets
# they include for instruction evaluation/execution. You specify a template
# using lines of text for which, for the most part, the first word on the
@ -27,7 +27,7 @@
# last attribute. Comments begin with '#' at the start of the line (no
# leading whitespace allowed), and can be intermingled with a template's
# attributes.
#
#
# Each ZAM instruction includes up to 4 integer values and one constant
# (specified as a ZVal). Often, the integer values are interpreted as offsets
# ("slots") into the ZAM execution "frame", though sometimes they have other
@ -39,53 +39,53 @@
# "operands". Thus, for example, an instruction with two operands used the
# first 3 integer values, the first as the assignment slot and the other two
# for computing the result to put in that slot.
#
#
# The first attribute of each template states the type of operation specified
# in the template, along with the name of the operation. The possible types
# are:
#
#
# op an operation that generally corresponds to a single ZAM
# instruction, and is fully specified
#
#
# expr-op an operation corresponding to an AST expression node
# (some sort of Expr object). Gen-ZAM generates code for
# automatically converting Expr objects to ZAM instructions.
# The name of the operation must match that used in the AST
# tag, so for example for "expr-op Foo" there must be a
# corresponding "EXPR_FOO" tag.
#
#
# unary-expr-op an expr-op for a unary Expr object
# binary-expr-op an expr-op for a binary Expr object
# rel-expr-op an expr-op for a (binary) Expr object that
# represents a relational operation
#
#
# assign-op directly assigning either a ZVal or a record field
# to either a frame slot or a record field
#
#
# unary-op an operation with one operand that requires special
# treatment that doesn't fit with how unary-expr-op's
# are expressed
#
#
# direct-unary-op an operation with one operand that corresponds to
# a specific ZAMCompiler method for generating its
# instruction
#
#
# internal-op similar to "op", but for ZAM instructions only used
# internally, and thus not having any AST counterpart
# internal-binary-op the same, for operations that take two operands
# internal-assignment-op the same, for operations that assign ZVals
# produced by loading interpreter variables
# or calling functions
#
#
# After specifying the type of operation, you list additional attributes to
# fill out the template, ending by convention with the C++ evaluation snippet
# (if appropriate). The most significant (and complex) of these are:
#
#
# type specifies how to interpret the operation in terms of ZAM
# instruction slots (and constant). The specification is
# in terms of single-letter mnemonics for the different
# possible types:
#
#
# F special value designating a record field being
# assigned to
# H event handler
@ -96,7 +96,7 @@
# V variable (frame slot)
# X used to indicate an empty specifier
# i integer constant, often a record field offset
#
#
# The full specification consists of concatenating mnemonics
# with the order left-to-right corresponding to each of the
# instruction's 4 integer values (stopping with the last one
@ -108,10 +108,10 @@
# also a frame variable, the second operand is the instruction's
# constant, and the third operand is the instruction's third
# integer value, with the fourth integer value not being used.
#
#
# op-type for some form of expr-op, specifies to which Zeek scripting
# types the expression applies:
#
#
# A addr
# D double
# F file
@ -122,29 +122,29 @@
# T table
# U count
# V vector
#
#
# along with two special types: 'X' indicates that Gen-ZAM
# should not iterate over any possible values, and '*'
# indicates that Gen-ZAM should additionally iterate over
# all of possible values not explicitly listed (used in
# conjunction with eval-type - see below)
#
#
# eval specifies a block of C++ code used to evaluation the
# execution of the instruction. The block begins with the
# remainder of the "eval" line and continues until either a
# blank line or a line that starts with non-whitespace.
#
#
# Blocks can include special '$' parameters that Gen-ZAM
# automatically expands. "$1" refers to an operation's first
# operand, "$2" to its second, etc. "$$" refers to the
# operation's assignment target.
#
#
# For simple expr-op's you can express the block as simply
# the C++ expression to compute. For example, for multiplication
# (named "Times"), the "eval" block is simply "$1 * $2",
# rather than "$$ = $1 * $2"; Gen-ZAM knows to expand it
# accordingly.
#
#
# Finally, to help with avoiding duplicate code, you can
# define macros that expand to code snippets you want to use
# in multiple places. You specify these using a "macro"
@ -154,95 +154,95 @@
# instead just indent the lines you want included, ending
# (as with "eval" blocks) with an empty line or a line that
# starts with non-whitespace.
#
#
# We list the remaining types of attributes alphabetically. Note that some
# only apply to certain types of operations.
#
#
# assign-val for an assignment operation, the name of the
# C++ variable that holds the value to assign
#
#
# custom-method a ZAMCompiler method that Gen-ZAM should use for
# this operation, rather than generating one
#
#
# eval-mixed an expression "eval" block that applies to two
# different op-type's
#
#
# eval-pre code to add to the beginning of the "eval" block.
# This can be required for operations where Gen-ZAM
# generates elements of the C++ (such as for expr-op's).
#
#
# eval-type evaluation code associated with one specific op-type
#
#
# explicit-result-type the operation's evaluation yields a ZVal
# rather than a low-level C++ type
#
#
# field-op the operation is a direct assignment to a record field
#
#
# includes-field-op the operation should include a version
# that assigs to a record field as well as a
# version for assigning to a frame variable
#
#
# indirect-call the operation represents an indirect call (through
# a variable, rather than directly). Only meaningful
# if num-call-args is also specified.
#
#
# method-post C++ code to add to the end of the method that
# dynamically generates ZAM code
#
#
# no-const do not generate a version of the unary-expr-op
# where the operand is a constant
#
#
# no-eval this operation does not have an "eval" block
# (because it will be translated instead into internal
# operations)
#
#
# num-call-args indicates that the operation is a function call,
# and specifies how many arguments the call takes.
# A specification of 'n' means "build a ZAM instruction
# for calling with an arbitrary number of arguments".
#
#
# op-accessor tells Gen-ZAM what ZVal accessor to use to get to
# the underlying values of the operand(s)
#
#
# op1-accessor the same as op-accessor except only for the first
# operand
#
#
# op1-internal states that the operation's treatment of the
# instruction's first integer value is for internal
# purposes; the value does not correspond to a frame
# variable
#
#
# op1-read the operation treats the instruction's first integer
# value as a frame variable, but only reads the value.
# (The default is that the frame variable is written
# to but not read.)
#
#
# op1-read-write the operation treats the instruction's first integer
# value as a frame variable, and both reads and
# writes the value.
#
#
# op2-accessor the same as op-accessor except only for the second
# operand
#
#
# set-type the instruction's primary type comes from either the
# assignment target ("$$"), the first operand ("$1"),
# or the second operand ("$2")
#
#
# set-type2 the same as set-type but for the instruction's
# secondary type
#
#
# side-effects the operation has side-effects, so even if its
# assignment target winds up being "dead" (the value is
# no longer used), the operation should still occur.
# Optionally, this attribute can include two arguments
# specifying the ZAM opcode to use if the assignment
# is dead, and the internal "type" of that opcode.
#
#
# For example, "side-effects OP_CALL1_V OP_V" means
# "this operation has side-effects; if eliminating
# its assignment, change the ZAM op-code to OP_CALL1_V,
# which has an internal type of OP_V".
#
#
# vector generate a version of the operation that takes
# vectors as operands
@ -297,14 +297,14 @@ op-type I U D A N S T V *
explicit-result-type
set-type $$
set-type2 $1
eval-type I $$ = ZVal(bro_int_t($1 < 0 ? -$1 : $1));
eval-type I $$ = ZVal(zeek_int_t($1 < 0 ? -$1 : $1));
eval-type U $$ = ZVal($1);
eval-type D $$ = ZVal($1 < 0 ? -$1 : $1);
eval-type A $$ = ZVal(bro_uint_t($1->AsAddr().GetFamily() == IPv4 ? 32 : 128));
eval-type A $$ = ZVal(zeek_uint_t($1->AsAddr().GetFamily() == IPv4 ? 32 : 128));
eval-type N $$ = ZVal(pow(2.0, double(128 - $1->AsSubNet().LengthIPv6())));
eval-type S $$ = ZVal(bro_uint_t($1->Len()));
eval-type T $$ = ZVal(bro_uint_t($1->Size()));
eval-type V $$ = ZVal(bro_uint_t($1->Size()));
eval-type S $$ = ZVal(zeek_uint_t($1->Len()));
eval-type T $$ = ZVal(zeek_uint_t($1->Size()));
eval-type V $$ = ZVal(zeek_uint_t($1->Size()));
eval auto v = frame[z.v2].ToVal(z.t2)->SizeVal();
$$ = BuildVal(v, z.t);
@ -510,12 +510,12 @@ eval $1 % $2
binary-expr-op And-And
op-type I
vector
eval bro_int_t($1 && $2)
eval zeek_int_t($1 && $2)
binary-expr-op Or-Or
op-type I
vector
eval bro_int_t($1 || $2)
eval zeek_int_t($1 || $2)
binary-expr-op And
op-type U P T
@ -833,13 +833,13 @@ internal-op Val-Is-In-Vector
type VVV
eval auto& vec = frame[z.v3].vector_val;
auto ind = frame[z.v2].int_val;
frame[z.v1].int_val = ind >= 0 && static_cast<bro_uint_t>(ind) < vec->Size();
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
internal-op Const-Is-In-Vector
type VCV
eval auto& vec = frame[z.v2].vector_val;
auto ind = z.c.int_val;
frame[z.v1].int_val = ind >= 0 && static_cast<bro_uint_t>(ind) < vec->Size();
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
expr-op Cond
type VVVV
@ -869,7 +869,7 @@ eval auto& vsel = *frame[z.v2].vector_val->RawVec();
(*res)[i] = vsel[i]->int_val ? v1[i] : v2[i];
auto& full_res = frame[z.v1].vector_val;
Unref(full_res);
full_res = new VectorVal(cast_intrusive<VectorType>(z.t), res);
full_res = new VectorVal(cast_intrusive<VectorType>(z.t), res);
# Our instruction format doesn't accommodate two constants, so for
# the singular case of a V ? C1 : C2 conditional, we split it into
@ -944,7 +944,7 @@ eval EvalIndexVec(frame[z.v3].uint_val)
macro EvalIndexVec(index)
auto vv = frame[z.v2].vector_val->RawVec();
const auto& vec = *vv;
bro_uint_t ind = index;
zeek_uint_t ind = index;
if ( ind >= vv->size() )
ZAM_run_time_error(z.loc, "no such index");
AssignV1(CopyVal(*vec[ind]))
@ -959,7 +959,7 @@ eval EvalIndexAnyVec(frame[z.v3].uint_val)
macro EvalIndexAnyVec(index)
auto vv = frame[z.v2].vector_val;
bro_uint_t ind = index;
zeek_uint_t ind = index;
if ( ind >= vv->Size() )
ZAM_run_time_error(z.loc, "no such index");
AssignV1(ZVal(vv->ValAt(ind).release()))
@ -1141,7 +1141,7 @@ eval auto v = frame[z.v2].int_val;
ZAM_run_time_error(z.loc, "underflow converting int to count");
break;
}
frame[z.v1].uint_val = bro_uint_t(v);
frame[z.v1].uint_val = zeek_uint_t(v);
internal-op Coerce-UD
type VV
@ -1156,7 +1156,7 @@ eval auto v = frame[z.v2].double_val;
ZAM_run_time_error(z.loc, "overflow converting double to count");
break;
}
frame[z.v1].uint_val = bro_uint_t(v);
frame[z.v1].uint_val = zeek_uint_t(v);
internal-op Coerce-IU
type VV
@ -1166,7 +1166,7 @@ eval auto v = frame[z.v2].uint_val;
ZAM_run_time_error(z.loc, "overflow converting count to int");
break;
}
frame[z.v1].int_val = bro_int_t(v);
frame[z.v1].int_val = zeek_int_t(v);
internal-op Coerce-ID
type VV
@ -1181,7 +1181,7 @@ eval auto v = frame[z.v2].double_val;
ZAM_run_time_error(z.loc, "overflow converting double to int");
break;
}
frame[z.v1].int_val = bro_int_t(v);
frame[z.v1].int_val = zeek_int_t(v);
internal-op Coerce-DI
type VV
@ -1804,7 +1804,7 @@ op CheckAnyLen
op1-read
type Vi
eval auto v = frame[z.v1].list_val;
if ( v->Vals().size() != static_cast<bro_uint_t>(z.v2) )
if ( v->Vals().size() != static_cast<zeek_uint_t>(z.v2) )
ZAM_run_time_error(z.loc, "mismatch in list lengths");
op Print
@ -2002,11 +2002,11 @@ eval EvalSubBytes(frame[z.v2], frame[z.v3].uint_val, z.v4)
internal-op Sub-Bytes
type VViV
eval EvalSubBytes(frame[z.v2], bro_uint_t(z.v4), frame[z.v3].int_val)
eval EvalSubBytes(frame[z.v2], zeek_uint_t(z.v4), frame[z.v3].int_val)
internal-op Sub-Bytes
type VVii
eval EvalSubBytes(frame[z.v2], bro_uint_t(z.v3), z.v4)
eval EvalSubBytes(frame[z.v2], zeek_uint_t(z.v3), z.v4)
internal-op Sub-Bytes
type VVVC
@ -2018,11 +2018,11 @@ eval EvalSubBytes(z.c, frame[z.v2].uint_val, z.v3)
internal-op Sub-Bytes
type ViVC
eval EvalSubBytes(z.c, bro_uint_t(z.v3), frame[z.v2].uint_val)
eval EvalSubBytes(z.c, zeek_uint_t(z.v3), frame[z.v2].uint_val)
internal-op Sub-Bytes
type ViiC
eval EvalSubBytes(z.c, bro_uint_t(z.v2), z.v3)
eval EvalSubBytes(z.c, zeek_uint_t(z.v2), z.v3)
internal-op To-Lower
@ -2167,4 +2167,4 @@ internal-op Files--Set-Reassembly-Buffer
op1-read
type VC
eval auto f = frame[z.v1].string_val->CheckString();
file_mgr->SetReassemblyBuffer(f, bro_uint_t(z.v2));
file_mgr->SetReassemblyBuffer(f, zeek_uint_t(z.v2));

View file

@ -502,8 +502,8 @@ const ZAMStmt ZAMCompiler::ValueSwitch(const SwitchStmt* sw, const NameExpr* v,
// Now fill out the corresponding jump table.
//
// We will only use one of these.
CaseMapI<bro_int_t> new_int_cases;
CaseMapI<bro_uint_t> new_uint_cases;
CaseMapI<zeek_int_t> new_int_cases;
CaseMapI<zeek_uint_t> new_uint_cases;
CaseMapI<double> new_double_cases;
CaseMapI<std::string> new_str_cases;

View file

@ -62,7 +62,7 @@ StringVal* ZAM_to_lower(const StringVal* sv)
return new StringVal(new String(1, lower_s, n));
}
StringVal* ZAM_sub_bytes(const StringVal* s, bro_uint_t start, bro_int_t n)
StringVal* ZAM_sub_bytes(const StringVal* s, zeek_uint_t start, zeek_int_t n)
{
if ( start > 0 )
--start; // make it 0-based

View file

@ -52,6 +52,6 @@ extern bool ZAM_error;
extern void ZAM_run_time_warning(const Location* loc, const char* msg);
extern StringVal* ZAM_to_lower(const StringVal* sv);
extern StringVal* ZAM_sub_bytes(const StringVal* s, bro_uint_t start, bro_int_t n);
extern StringVal* ZAM_sub_bytes(const StringVal* s, zeek_uint_t start, zeek_int_t n);
} // namespace zeek::detail

View file

@ -47,7 +47,7 @@ void report_ZOP_profile()
// assigned value was missing (which we can only tell for managed types),
// true otherwise.
static bool copy_vec_elem(VectorVal* vv, bro_uint_t ind, ZVal zv, const TypePtr& t)
static bool copy_vec_elem(VectorVal* vv, zeek_uint_t ind, ZVal zv, const TypePtr& t)
{
if ( vv->Size() <= ind )
vv->Resize(ind + 1);
@ -118,11 +118,11 @@ static void vec_exec(ZOp op, TypePtr t, VectorVal*& v1, const VectorVal* v2, con
VEC_COERCE(DI, TYPE_DOUBLE, double, AsInt(), false_func, "")
VEC_COERCE(DU, TYPE_DOUBLE, double, AsCount(), false_func, "")
VEC_COERCE(ID, TYPE_INT, bro_int_t, AsDouble(), double_to_int_would_overflow, "double to signed")
VEC_COERCE(IU, TYPE_INT, bro_int_t, AsCount(), count_to_int_would_overflow, "unsigned to signed")
VEC_COERCE(UD, TYPE_COUNT, bro_uint_t, AsDouble(), double_to_count_would_overflow,
VEC_COERCE(ID, TYPE_INT, zeek_int_t, AsDouble(), double_to_int_would_overflow, "double to signed")
VEC_COERCE(IU, TYPE_INT, zeek_int_t, AsCount(), count_to_int_would_overflow, "unsigned to signed")
VEC_COERCE(UD, TYPE_COUNT, zeek_uint_t, AsDouble(), double_to_count_would_overflow,
"double to unsigned")
VEC_COERCE(UI, TYPE_COUNT, bro_int_t, AsInt(), int_to_count_would_overflow, "signed to unsigned")
VEC_COERCE(UI, TYPE_COUNT, zeek_int_t, AsInt(), int_to_count_would_overflow, "signed to unsigned")
ZBody::ZBody(const char* _func_name, const ZAMCompiler* zc) : Stmt(STMT_ZAM)
{
@ -141,8 +141,8 @@ ZBody::ZBody(const char* _func_name, const ZAMCompiler* zc) : Stmt(STMT_ZAM)
globals = zc->Globals();
num_globals = globals.size();
int_cases = zc->GetCases<bro_int_t>();
uint_cases = zc->GetCases<bro_uint_t>();
int_cases = zc->GetCases<zeek_int_t>();
uint_cases = zc->GetCases<zeek_uint_t>();
double_cases = zc->GetCases<double>();
str_cases = zc->GetCases<std::string>();

View file

@ -111,8 +111,8 @@ private:
double* CPU_time = nullptr; // cumulative CPU time for the program
std::vector<double>* inst_CPU = nullptr; // per-instruction CPU time.
CaseMaps<bro_int_t> int_cases;
CaseMaps<bro_uint_t> uint_cases;
CaseMaps<zeek_int_t> int_cases;
CaseMaps<zeek_uint_t> uint_cases;
CaseMaps<double> double_cases;
CaseMaps<std::string> str_cases;
};

View file

@ -11,7 +11,7 @@ using std::string;
namespace zeek::detail
{
void ZInst::Dump(bro_uint_t inst_num, const FrameReMap* mappings) const
void ZInst::Dump(zeek_uint_t inst_num, const FrameReMap* mappings) const
{
// printf("v%d ", n);
@ -212,7 +212,7 @@ int ZInst::NumSlots() const
return -1;
}
string ZInst::VName(int n, bro_uint_t inst_num, const FrameReMap* mappings) const
string ZInst::VName(int n, zeek_uint_t inst_num, const FrameReMap* mappings) const
{
if ( n > NumFrameSlots() )
return "";
@ -223,7 +223,7 @@ string ZInst::VName(int n, bro_uint_t inst_num, const FrameReMap* mappings) cons
return "<special>";
// Find which identifier manifests at this instruction.
ASSERT(slot >= 0 && static_cast<bro_uint_t>(slot) < mappings->size());
ASSERT(slot >= 0 && static_cast<zeek_uint_t>(slot) < mappings->size());
auto& map = (*mappings)[slot];
@ -323,12 +323,12 @@ string ZInstI::VName(int n, const FrameMap* frame_ids, const FrameReMap* remappi
if ( remappings && live )
{ // Find which identifier manifests at this instruction.
ASSERT(slot >= 0 && static_cast<bro_uint_t>(slot) < remappings->size());
ASSERT(slot >= 0 && static_cast<zeek_uint_t>(slot) < remappings->size());
auto& map = (*remappings)[slot];
unsigned int i;
auto inst_num_u = static_cast<bro_uint_t>(inst_num);
auto inst_num_u = static_cast<zeek_uint_t>(inst_num);
for ( i = 0; i < map.id_start.size(); ++i )
{
// See discussion for ZInst::VName.

View file

@ -37,7 +37,7 @@ public:
// The ZAM instruction number where a given identifier starts its
// scope, parallel to "ids".
std::vector<bro_uint_t> id_start;
std::vector<zeek_uint_t> id_start;
// The current end of the frame slot's scope. Gets updated as
// new IDs are added to share the slot.
@ -69,7 +69,7 @@ public:
virtual ~ZInst() = default;
// Methods for printing out the instruction for debugging/maintenance.
void Dump(bro_uint_t inst_num, const FrameReMap* mappings) const;
void Dump(zeek_uint_t inst_num, const FrameReMap* mappings) const;
void Dump(const std::string& id1, const std::string& id2, const std::string& id3,
const std::string& id4) const;
@ -78,7 +78,7 @@ public:
// by its number within a larger set. "mappings" provides the
// mappings used to translate raw slots to the corresponding
// script variable(s).
std::string VName(int n, bro_uint_t inst_num, const FrameReMap* mappings) const;
std::string VName(int n, zeek_uint_t inst_num, const FrameReMap* mappings) const;
// Number of slots that refer to a frame element. These always
// come first, if we use additional slots.