Commit graph

213 commits

Author SHA1 Message Date
Vern Paxson
f48f3af79a -O gen-C++ support for pattern vector comparisons 2025-03-07 09:55:15 -08:00
Vern Paxson
9f5fba7003 -O gen-C++ support for type expressions 2025-03-07 09:21:09 -08:00
Vern Paxson
a3b54b69a1 fixes for -O gen-standalone-C++ generation of lambdas 2025-01-14 17:02:12 -08:00
Vern Paxson
960931ba5c support for record extensions when using -O gen-standalone-C++ 2025-01-14 11:12:10 +01:00
Vern Paxson
3d58732cb3 fixes for initializing globals when using -O gen-standalone-C++ 2025-01-01 13:26:58 -08:00
Vern Paxson
0a813a53c7 -O gen-standalone-C++ fixes for recent more aggressive AST profiling 2024-12-12 14:27:12 -08:00
Tim Wojtulewicz
6e75417032 Merge remote-tracking branch 'origin/topic/vern/CPP-streamlining'
* origin/topic/vern/CPP-streamlining:
  BTest baseline updates for compile-to-C++
  mark ZAM regression BTests as not suitable for compile-to-C++
  fix for -O gen-C++ maintenance helper to skip BTest intermediary files
  introduced simplified initialization for non-standalone -O gen-C++ code tied -O gen-standalone-C++ to use of --optimize-files
  streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile
  when reporting available/unavailble C++ script bodies, flag those that are skipped
  modified AST profiling to mark (and fully skip) non-optimizable functions
  modified merge_types() to skip work if given identical types, which also preserves type names (useful for -O gen-C++)
2024-12-09 12:16:00 -07:00
Benjamin Bannier
97c0df29d4 Bump clang-format pre-commit hooks
This brings in slightly better formatting around uniform initialization,
and comments after blocks not surrounded by `{ .. }`.
2024-12-09 16:12:36 +01:00
Arne Welzel
0ebcd9608f Merge remote-tracking branch 'origin/topic/vern/script-opt-uncompilable-AST'
* origin/topic/vern/script-opt-uncompilable-AST:
  ScriptOpt: Fail compilation if known exprs/stmts is outdated
  skip optimization of functions with AST nodes unknown to script optimization
2024-12-09 14:04:01 +01:00
Vern Paxson
de98f1c36c fix for -O gen-C++ maintenance helper to skip BTest intermediary files 2024-12-06 16:26:48 -08:00
Vern Paxson
2e69a8870a introduced simplified initialization for non-standalone -O gen-C++ code
tied -O gen-standalone-C++ to use of --optimize-files
2024-12-06 16:25:22 -08:00
Vern Paxson
612d99e751 streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile 2024-12-06 16:23:32 -08:00
Vern Paxson
908e8a3a27 ZAM support for keeping "assert" statements 2024-12-03 10:37:38 -07:00
Vern Paxson
35e157a0ab skip optimization of functions with AST nodes unknown to script optimization 2024-11-29 16:12:05 -08:00
Vern Paxson
519fec2592 switched CPPCompile::Canonicalize() to take std::string instead of const char* 2024-11-04 08:22:37 -08:00
Arne Welzel
821218e7b2 Merge remote-tracking branch 'origin/topic/vern/CPP-when-capture-naming'
* origin/topic/vern/CPP-when-capture-naming:
  fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
  Simplified & made more robust maintenance helper script for "-O gen-C++" testing
  "-a cpp" baseline updates to reflect recent BTest changes
2024-10-29 13:50:56 +01:00
Vern Paxson
744628f115 factored CPP source's main header into collection of per-source-file headers 2024-10-18 17:37:33 -07:00
Vern Paxson
a2495d028e renamed script optimization Attrs.h header to prepare for factoring large Compile.h 2024-10-18 17:37:33 -07:00
Vern Paxson
1f1200e5e8 fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
Previously there was logic for doing this, but it was ineffectual
	due to the order in which canonicalization was done. This problem
	manifested non-deterministically depending on order-of-generation
	of "when" lambdas, which is why previous testing didn't catch it.
2024-10-11 08:16:59 -07:00
Vern Paxson
e18ab5be95 Simplified & made more robust maintenance helper script for "-O gen-C++" testing 2024-10-11 08:14:23 -07:00
Vern Paxson
32d254bd47 tweak to -O gen-C++ maintenance script to avoid treating plugins as BTests 2024-09-27 13:25:00 -07:00
Vern Paxson
5c38f7637d -O gen-C++ fix for run-time warnings for "when" lambdas 2024-09-27 13:23:06 -07:00
Vern Paxson
d1c31927c4 fix to -O gen-C++ for recent AST profiling changes for identifying function parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
2b64e3b05e fix to -O gen-C++ for dealing with "hidden" parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
8025ee74ef tweak to prevent an incorrect warning for scripts compiled to C++ 2024-09-27 13:23:06 -07:00
Vern Paxson
c165e05b83 remove unnecessary header include 2024-09-27 13:23:06 -07:00
Arne Welzel
71e9c8d436 script_opt: Use Func::GetName() 2024-09-27 15:11:17 +02:00
Benjamin Bannier
db42b2cfe5 Bump clang-format
This patch contains a bump of the configured clang-format version from
17.0.3 to 18.1.8 and automatically generated C++ source updates. The
main difference we are seeing from this is fixes for previously
incomplete reformats.
2024-09-02 16:46:59 +02:00
Arne Welzel
5e36709905 Func: Add SetCapturesVec()
Add an API to directly set captures_vec for use by C++ compilation. The
current code keys off or asserts on ZAM stmts, making it difficult to
leverage captures_vec in other contexts.
2024-08-15 10:10:00 +02:00
Vern Paxson
207b82ae4b robustness improvements for -O gen-C++ generation of lambdas / "when"s 2024-08-13 14:45:33 -07:00
Vern Paxson
0ca2f9a8b2 speedups for compilation of initializers in -O gen-C++ generated code 2024-08-13 14:43:17 -07:00
Vern Paxson
6daf9d5b88 fixes for -O gen-C++ generation of floating point constants 2024-08-13 14:42:25 -07:00
Vern Paxson
a93a69ba62 -O gen-C++ fix for dealing with use of more than one module qualifier 2024-08-13 14:41:51 -07:00
Vern Paxson
77c34787f3 header tweaks to provide gen-C++ script optimization with more flexibility 2024-08-13 14:37:06 -07:00
Vern Paxson
769a3d958a some minor tidying of -O gen-C++ sources 2024-08-13 14:29:26 -07:00
Tim Wojtulewicz
e2b03681d1 Remove EventRegistry::Used and EventRegistry::SetUsed 2024-08-07 11:58:21 -07:00
Vern Paxson
37c1f6641c script optimization support for "add" and "delete" being expressions 2024-05-29 12:40:06 -07:00
Vern Paxson
7c8c83efc4 factor script optimization Expr AST nodes out of main AST header 2024-04-25 09:15:13 -07:00
Vern Paxson
4e253aae0a optimize generation of "-O gen-C++" code for table/vector size operations 2024-04-25 09:15:12 -07:00
Vern Paxson
74d36eb759 script optimization support for clearing tables/vectors using "delete" 2024-03-08 19:09:46 +01:00
Vern Paxson
54877e9dec fixed bug where appending an empty vector to a vector-of-vector's had no effect 2024-03-08 19:09:43 +01:00
Vern Paxson
9e32443504 minor updates and fixes for script optimization maintenance 2024-02-04 07:57:45 -08:00
Vern Paxson
f7b739a47d fixes for initializations of "-O gen-C++" script compilations 2024-01-15 15:03:56 +01:00
Tim Wojtulewicz
df65b668b7 CPP-gen: Don't emit extra braces if only one element 2024-01-08 13:26:57 -07:00
Vern Paxson
e2646f9752 fix for -O C++ lambda functions reporting errors/warnings 2023-12-12 09:45:19 +01:00
Vern Paxson
f573036099 script optimization fixes for pattern tables 2023-12-12 09:45:19 +01:00
Vern Paxson
709d410fcd regularized (some) types of pointers used in script optimization 2023-12-12 09:45:19 +01:00
Vern Paxson
a824bb1e4b some very minor tidying of script optimization code/documentation 2023-12-12 09:45:19 +01:00
Dominik Charousset
a69928d977 Integrate review feedback 2023-12-04 15:23:56 +01:00
Dominik Charousset
647fdf7737 Add facade types to avoid using raw Broker types
By avoiding to use `broker::data` directly, we gain a degree of freedom
that allows us to swap out `broker::data` for something else (e.g.,
`broker::variant`) in the future. Furthermore, it also helps us to keep
Broker types "local" to the Broker manager and gives us a nicer
interface.

Also replaces uses of `broker::expected` with `std::optional`. While an
`expected `can carry additional information as to why a value is not
present, nothing in Zeek ever cared about that. Hence, using
`std::optional` removes an unnecessary dependency on a Broker detail
while also being more efficient (no extra heap allocation when no value
is present).
2023-12-04 15:23:28 +01:00