Commit graph

72 commits

Author SHA1 Message Date
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Vern Paxson
6a0bee1108 support for Frame's having call locations even if no associated CallExpr 2021-05-30 17:43:17 -07:00
Vern Paxson
8d2bb28f03 setting the stage for implementation of lambdas in compiled-to-C++ code 2021-05-05 16:55:04 -07:00
Vern Paxson
8f2637decb new function for getting the location, if any, associated with the current call 2021-03-24 09:36:21 -07:00
Tim Wojtulewicz
0618be792f Remove all of the random single-file deprecations
These are the changes that don't require a ton of changes to other files outside
of the original removal.
2021-01-27 10:52:40 -07:00
Jon Siwek
0a7e5e67a2 Tweak vector append/move logic of Frame::SerializeCopyFrame()
No functional difference, just simplification.
2021-01-11 16:09:48 -08:00
Jon Siwek
b08112b2e7 Switch FuncType capture-list storage to optional<vector<Capture>>
May help clarify overall mem-mgmt/ownership semantics.
2021-01-11 15:57:58 -08:00
Jon Siwek
614fade0a4 Merge branch 'master' into topic/vern/lambda-copy-semantics 2021-01-11 11:48:45 -08:00
Vern Paxson
80f7d36582 support for transmitting of capture-semantics closures via Broker, while keeping deprecated functionality 2021-01-04 14:29:07 -08:00
Vern Paxson
e531b2a7ca minor simplifications in using type names, and unordered sets rather than vectors 2021-01-04 14:25:50 -08:00
Vern Paxson
8f4b616d65 changes to Frames to support access to captured-by-copy-semantics variables 2021-01-04 14:17:56 -08:00
Vern Paxson
c8be7ec795 no semantic changes: corrected & reflowed some comments, plus a whitespace tweak 2021-01-04 13:38:36 -08:00
Vern Paxson
c42586af2c inlining of Zeek script functions 2020-11-19 16:16:59 -08:00
Tim Wojtulewicz
96d9115360 GH-1079: Use full paths starting with zeek/ when including files 2020-11-12 12:15:26 -07:00
Tim Wojtulewicz
fe0c22c789 Base: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the common and base classes.
2020-08-24 12:07:00 -07:00
Tim Wojtulewicz
01ce18894b Rename types in ZeekList.h to be consistent with the style guide 2020-08-20 16:11:47 -07:00
Tim Wojtulewicz
f1cfd5aa2b Move bro_broker code to zeek::Broker namespace 2020-08-20 15:55:17 -07:00
Tim Wojtulewicz
bfab224d7c Move Reporter to zeek namespace 2020-07-31 16:22:41 -04:00
Jon Siwek
eb826bd337 GH-734: Improve handling of lambdas that escape enclosing frame 2020-07-14 22:38:43 -07:00
Tim Wojtulewicz
a2bc42dd93 Move Func up to zeek namespace, rename BroFunc to ScriptFunc 2020-07-02 16:15:01 -07:00
Tim Wojtulewicz
40ecede4ea Move Location to zeek::detail and BroObj to zeek 2020-06-30 21:12:26 -07:00
Tim Wojtulewicz
937a462e70 Move Frame and Scope to zeek::detail namespace 2020-06-30 20:51:53 -07:00
Tim Wojtulewicz
64332ca22c Move all Val classes to the zeek namespaces 2020-06-30 20:48:09 -07:00
Tim Wojtulewicz
ec9eff0bd5 Use type aliases for IntrusivePtr definitions 2020-06-30 20:37:30 -07:00
Tim Wojtulewicz
9364e6a5b7 Move IntrusivePtr and utility methods to the zeek namespace 2020-06-30 20:19:12 -07:00
Tim Wojtulewicz
137e416a03 Rename BroType to Type 2020-06-10 14:27:36 -07:00
Tim Wojtulewicz
ed13972924 Move Type types to zeek namespace 2020-06-09 17:20:45 -07:00
Tim Wojtulewicz
54233ce596 Move Trigger into the zeek::detail namespace 2020-06-03 15:16:19 -07:00
Tim Wojtulewicz
0d623d003c Move ID to the zeek::detail namespace 2020-06-03 15:16:19 -07:00
Jon Siwek
198d604dde Store weak ref boolean along with Frame element Vals 2020-05-23 09:19:50 -07:00
Jon Siwek
9f4eca081f Deprecate Frame::GetElement(ID*), replace with GetElementByID() 2020-05-23 09:08:45 -07:00
Jon Siwek
e9e2e388f8 Switch Frame::SetElement() to use IntrusivePtr 2020-05-23 08:52:15 -07:00
Jon Siwek
1c617c4f7a Store IntrusivePtrs in Frame 2020-05-22 23:43:03 -07:00
Jon Siwek
1eb723fc9d Deprecate Val::Type(), replace with GetType() 2020-05-14 17:23:20 -07:00
Johanna Amann
876c803d75 Merge remote-tracking branch 'origin/topic/timw/776-using-statements'
* origin/topic/timw/776-using-statements:
  Remove 'using namespace std' from SerialTypes.h
  Remove other using statements from headers
  GH-776: Remove using statements added by PR 770

Includes small fixes in files that changed since the merge request was
made.

Also includes a few small indentation fixes.
2020-04-09 13:31:07 -07:00
Johanna Amann
a3a38f0849 Merge remote-tracking branch 'origin/topic/timw/nullptr'
* origin/topic/timw/nullptr:
  The remaining nulls
  plugin/probabilistic/zeekygen: Replace nulls with nullptr
  file_analysis: Replace nulls with nullptr
  analyzer: Replace nulls with nullptr
  iosource/threading/input/logging: Replace nulls with nullptr
2020-04-09 08:59:53 -07:00
Jon Siwek
5fe2a57356 Merge remote-tracking branch 'origin/topic/timw/structure-packing'
During merge, changed a bit of how Frame OffsetMap
assignments/contruction were handled to keep parity with old version.

* origin/topic/timw/structure-packing:
  Lazy-initalize some of the fields in Frame to reduce the size of all Frames when they're not used
  Set InternalHashTag to a uint16_t so CompositeHash doesn't have a gap in it.
  Mark constants in List constexpr so they don't actually take up space in created objects
  Reorder some class variables to fill in gaps in structure packing
2020-04-08 13:57:44 -07:00
Tim Wojtulewicz
0a47588d0b The remaining nulls 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
d53c1454c0 Remove 'using namespace std' from SerialTypes.h
This unfortunately cuases a ton of flow-down changes because a lot of other
code was depending on that definition existing. This has a fairly large chance
to break builds of external plugins, considering how many internal ones it broke.
2020-04-07 15:59:59 -07:00
Tim Wojtulewicz
f5865b6b97 Lazy-initalize some of the fields in Frame to reduce the size of all Frames when they're not used 2020-04-06 15:32:39 -07:00
Jon Siwek
4e1ac4e124 Use vector<IntrusivePtr<Val>> for Func::Call and Event queuing args
This change may break BIFs that use @ARGS@, @ARG@, or @ARGC@ since their
types have changed.
2020-03-24 16:50:18 -07:00
Jon Siwek
b62727a7fa Merge branch 'intrusive_ptr' of https://github.com/MaxKellermann/zeek
* 'intrusive_ptr' of https://github.com/MaxKellermann/zeek: (32 commits)
  Scope: store IntrusivePtr in `local`
  Scope: pass IntrusivePtr to AddInit()
  DNS_Mgr: use class IntrusivePtr
  Scope: use class IntrusivePtr
  Attr: use class IntrusivePtr
  Expr: check_and_promote_expr() returns IntrusivePtr
  Frame: use class IntrusivePtr
  Val: RecordVal::LookupWithDefault() returns IntrusivePtr
  Type: RecordType::FieldDefault() returns IntrusivePtr
  Val: TableVal::Delete() returns IntrusivePtr
  Type: base_type() returns IntrusivePtr
  Type: init_type() returns IntrusivePtr
  Type: merge_types() returns IntrusivePtr
  Type: use class IntrusivePtr in VectorType
  Type: use class IntrusivePtr in EnumType
  Type: use class IntrusivePtr in FileType
  Type: use class IntrusivePtr in TypeDecl
  Type: make TypeDecl `final` and the dtor non-`virtual`
  Type: use class IntrusivePtr in TypeType
  Type: use class IntrusivePtr in FuncType
  ...
2020-03-17 22:51:46 -07:00
Max Kellermann
78e736621c Frame: use class IntrusivePtr 2020-03-06 09:12:03 +01:00
Max Kellermann
ba35ebec4c Type: return IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
08128b244f IntrusivePtr: rename detach() to release()
Follow the C++ standard library conventions (here: `std::unique_ptr`).
2020-02-20 08:58:21 +01:00
Max Kellermann
c6ffec02fc broker: include cleanup 2020-02-13 10:12:03 +01:00
Tim Wojtulewicz
5a237d3a3f Use const-references in lots of places (preformance-unnecessary-value-param) 2020-02-11 14:11:18 -08:00
Max Kellermann
6a815b4b06 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
2020-02-04 20:51:02 +01:00
Max Kellermann
0db61f3094 include cleanup
The Zeek code base has very inconsistent #includes.  Many sources
included a few headers, and those headers included other headers, and
in the end, nearly everything is included everywhere, so missing
#includes were never noticed.  Another side effect was a lot of header
bloat which slows down the build.

First step to fix it: in each source file, its own header should be
included first to verify that each header's includes are correct, and
none is missing.

After adding the missing #includes, I replaced lots of #includes
inside headers with class forward declarations.  In most headers,
object pointers are never referenced, so declaring the function
prototypes with forward-declared classes is just fine.

This patch speeds up the build by 19%, because each compilation unit
gets smaller.  Here are the "time" numbers for a fresh build (with a
warm page cache but without ccache):

Before this patch:

 3144.94user 161.63system 3:02.87elapsed 1808%CPU (0avgtext+0avgdata 2168608maxresident)k
 760inputs+12008400outputs (1511major+57747204minor)pagefaults 0swaps

After this patch:

 2565.17user 141.83system 2:25.46elapsed 1860%CPU (0avgtext+0avgdata 1489076maxresident)k
 72576inputs+9130920outputs (1667major+49400430minor)pagefaults 0swaps
2020-02-04 20:51:02 +01:00
Tim Wojtulewicz
a159d075cf Add Trigger manager for managing triggers created by things like 'when' statements
- Adds new trigger namespace
- Adds trigger::Manager class as a new IOSource for keeping track of triggers and integrating them into the loop. Previously the loop relied on the event manager Drain() method to process all triggers on every loop, but now that the loop actively waits for events to occur, triggers would not fire when they needed to. Adding them as part of the loop ensures they're checked.
2020-01-31 10:13:09 -07:00