UID, ..: un-inline methods to reduce header dependencies

Only 1% build time speedup, but still, it declutters the headers a bit.

Before this patch:

 2565.17user 141.83system 2:25.46elapsed 1860%CPU (0avgtext+0avgdata 1489076maxresident)k
 72576inputs+9130920outputs (1667major+49400430minor)pagefaults 0swaps

After this patch:

 2537.19user 142.94system 2:26.90elapsed 1824%CPU (0avgtext+0avgdata 1434268maxresident)k
 16240inputs+8887152outputs (1931major+48728888minor)pagefaults 0swaps
This commit is contained in:
Max Kellermann 2020-02-02 16:29:27 +01:00
parent 0db61f3094
commit 6a815b4b06
38 changed files with 348 additions and 211 deletions

View file

@ -7,7 +7,6 @@
#include "BroList.h"
#include "Timer.h"
#include "Type.h"
#include "Val.h"
#include "EventHandler.h"
#include "TraverseTypes.h"
@ -119,10 +118,10 @@ public:
int IsConst() const { return tag == EXPR_CONST; }
// True if the expression is in error (to alleviate error propagation).
int IsError() const { return type && type->Tag() == TYPE_ERROR; }
int IsError() const;
// Mark expression as in error.
void SetError() { SetType(error_type()); }
void SetError();
void SetError(const char* msg);
// Returns the expression's constant value, or complains
@ -130,16 +129,10 @@ public:
inline Val* ExprVal() const;
// True if the expression is a constant zero, false otherwise.
int IsZero() const
{
return IsConst() && ExprVal()->IsZero();
}
int IsZero() const;
// True if the expression is a constant one, false otherwise.
int IsOne() const
{
return IsConst() && ExprVal()->IsOne();
}
int IsOne() const;
// True if the expression supports the "add" or "delete" operations,
// false otherwise.
@ -605,7 +598,7 @@ public:
// If val is given, evaluating this expression will always yield the val
// yet still perform the assignment. Used for triggers.
AssignExpr(Expr* op1, Expr* op2, int is_init, Val* val = 0, attr_list* attrs = 0);
~AssignExpr() override { Unref(val); }
~AssignExpr() override;
Val* Eval(Frame* f) const override;
void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override;