Reorder fields in some classes for more compact memory layout

This commit is contained in:
Tim Wojtulewicz 2021-07-13 19:12:21 +00:00 committed by Tim Wojtulewicz
parent f849f024e5
commit 9b15db25f6
11 changed files with 22 additions and 24 deletions

View file

@ -159,6 +159,7 @@ protected:
char* dir; // directory in which cache_name resides
bool did_init;
int asyncs_pending;
RecordTypePtr dm_rec;
@ -236,8 +237,6 @@ protected:
typedef std::priority_queue<AsyncRequest*, std::vector<AsyncRequest*>, AsyncRequestCompare> TimeoutQueue;
TimeoutQueue asyncs_timeouts;
int asyncs_pending;
unsigned long num_requests;
unsigned long successful;
unsigned long failed;

View file

@ -200,18 +200,17 @@ protected:
bool is_short;
bool want_quotes;
bool want_determinism;
bool do_flush;
bool include_stats;
int indent_with_spaces;
int indent_level;
using escape_set = std::set<std::string>;
escape_set escape_sequences; // additional sequences of chars to escape
File* f; // or the file we're using.
int indent_level;
bool do_flush;
bool include_stats;
std::set<const Type*> encountered_types;
};

View file

@ -28,8 +28,8 @@ class [[deprecated("Remove in v5.1. Use the standard-library-compatible version
public:
IterCookie(Dictionary* d) : d(d) {}
bool robust = false;
Dictionary* d = nullptr;
bool robust = false;
// Index for the next valid entry. -1 is the default, meaning we haven't started
// iterating yet.

View file

@ -76,7 +76,7 @@ const char* expr_name(BroExprTag t)
return expr_names[int(t)];
}
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(nullptr), paren(false)
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), paren(false), type(nullptr)
{
SetLocationInfo(&start_location, &end_location);
}

View file

@ -411,8 +411,8 @@ protected:
[[noreturn]] void RuntimeErrorWithCallStack(const std::string& msg) const;
BroExprTag tag;
TypePtr type;
bool paren;
TypePtr type;
// The original expression from which this statement was
// derived, if any. Used as an aid for generating meaningful
@ -907,10 +907,10 @@ protected:
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);
bool is_init;
bool is_temp = false; // Optimization related
ValPtr val; // optional
// Optimization-related:
bool is_temp = false;
};
class IndexSliceAssignExpr final : public AssignExpr {

View file

@ -67,6 +67,7 @@ public:
protected:
int sym; // if SYM_CCL, then use ccl
int id; // number that uniquely identifies this state
CCL* ccl; // if nil, then use sym
int accept;
@ -74,8 +75,6 @@ protected:
// to avoid reference-counting loops.
bool first_trans_is_back_ref;
int id; // number that uniquely identifies this state
NFA_state_list xtions;
NFA_state_list* epsclosure;
NFA_State* mark;

View file

@ -153,8 +153,8 @@ private:
friend inline void Ref(Obj* o);
friend inline void Unref(Obj* o);
bool notify_plugins = false;
int ref_cnt = 1;
bool notify_plugins = false;
// If non-zero, do not print runtime errors. Useful for
// speculative evaluation.

View file

@ -915,12 +915,13 @@ public:
R_INIT_VECTOR, // field requires a new vector
} init_type;
bool def_coerce = false; // whether coercion's required
// For R_INIT_DIRECT/R_INIT_DIRECT_MANAGED:
ZVal direct_init;
detail::ExprPtr def_expr;
TypePtr def_type;
bool def_coerce = false; // whether coercion's required
RecordTypePtr r_type; // for R_INIT_RECORD
TableTypePtr t_type; // for R_INIT_TABLE

View file

@ -121,12 +121,12 @@ protected:
std::shared_ptr<ProfileFunc> pf;
int priority;
// Whether to skip optimizing this function.
bool skip = false;
// If we're saving this function in a file, this is the name
// of the file to use.
std::string save_file;
// Whether to skip optimizing this function.
bool skip = false;
};

View file

@ -118,14 +118,14 @@ public:
* The node's role within the cluster. E.g. manager, logger, worker.
*/
BifEnum::Supervisor::ClusterRole role;
/**
* The host/IP at which the cluster node is listening for connections.
*/
std::string host;
/**
* The TCP port number at which the cluster node listens for connections.
*/
int port;
/**
* The host/IP at which the cluster node is listening for connections.
*/
std::string host;
/**
* The interface name from which the node read/analyze packets.
* Typically used by worker nodes.
@ -324,10 +324,10 @@ private:
Config config;
pid_t stem_pid;
int last_signal = -1;
std::unique_ptr<detail::PipePair> stem_pipe;
detail::LineBufferedPipe stem_stdout;
detail::LineBufferedPipe stem_stderr;
int last_signal = -1;
detail::Flare signal_flare;
NodeMap nodes;
std::string msg_buffer;

View file

@ -204,8 +204,8 @@ private:
bool killed; // Set to true once forcefully killed.
// For implementing Fmt().
uint32_t buf_len;
char* buf;
unsigned int buf_len;
// For implementating Strerror().
char* strerr_buffer;