Commit graph

63 commits

Author SHA1 Message Date
Vern Paxson
441baaf2c1 added &no_ZAM_opt/&no_CPP_opt attributes and --no-opt-files/--no-opt-funcs for controlling skipping script optimization 2025-09-23 09:05:40 -07:00
Vern Paxson
973cc00c42 tracking of event groups for compilation to standalone-C++ 2025-09-17 14:28:13 -07:00
Tim Wojtulewicz
12356a6393 Remove unnecessary #includes in script_opt 2025-05-19 10:25:05 -07:00
Vern Paxson
960931ba5c support for record extensions when using -O gen-standalone-C++ 2025-01-14 11:12:10 +01: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
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
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
a328185a8f internal support for script optimization options for keeping asserts, not
consolidating event handlers
2024-12-03 10:35:35 -07:00
Vern Paxson
35e157a0ab skip optimization of functions with AST nodes unknown to script optimization 2024-11-29 16:12:05 -08:00
Arne Welzel
993cdd03e0 plugin: Add InitPreExecution()
Currently, plugins do not have a way to further inspect or even mutate
script functions after ZAM optimization ran. One use-case here is
zeek-perf-support [1]. This plugin wraps Stmt instances of functions,
events and hooks hooks with a small assembly stub to support JIT map
files [2] and for integration with perf tools.

This change introduces a new InitPreExecution() hook that runs after
ZAM optimization completed, just before the zeek_init() event is enqueued.

Additionally, remove the existing CPP_activation_hook. It doesn't seem
to be used. If it becomes necessary in the future, the new
InitPreExecution() hook can be leveraged instead.

[1] https://github.com/zeek/zeek-perf-support
[2] https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
2024-11-18 13:53:56 +01:00
Vern Paxson
e0e6c462ce "-O dump-final-ZAM" option similar to "dump-ZAM" only prints final version of functions 2024-09-27 13:24:30 -07:00
Arne Welzel
71e9c8d436 script_opt: Use Func::GetName() 2024-09-27 15:11:17 +02:00
Vern Paxson
1457099df3 "-O validate-ZAM" option to validate generated ZAM instructions 2024-08-16 11:18:58 +02:00
Vern Paxson
db22448270 internal option to suppress control-flow optimization 2024-08-16 11:18:58 +02:00
Vern Paxson
9cddf16800 rewrite of ZAM optimization of BiFs and script functions/idioms 2024-04-25 09:15:13 -07:00
Vern Paxson
dc376953fa framework for --enable-ZAM-profiling configuration
profiles go to zprof.log rather than stdout
2024-03-19 10:59:49 -07:00
Vern Paxson
740a087765 reworked AST optimizers analysis of side effects during aggregate operations & calls 2023-12-06 12:26:27 -08:00
Tim Wojtulewicz
ef5b169acd Add some uses of std::move in constructors and simple functions for pass-by-value arguments 2023-11-28 13:40:28 -07:00
Vern Paxson
3d21d80dac coalescing of event handlers (ZAM optimization) 2023-11-16 12:58:28 -08:00
Vern Paxson
4ec9a23ce6 retention of superseded AST elements to prevent pointer mis-aliasing 2023-11-10 11:06:16 +01:00
Vern Paxson
fadda05782 added "-O noinline" option to turn off ZAM inlining, to help with diagnosing optimization problems 2023-11-10 09:57:35 +01:00
Vern Paxson
1dc74eaa9c fixes for a number of ZAM optimization bugs 2023-11-10 09:56:59 +01:00
Benjamin Bannier
f5a76c1aed Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
2023-10-30 09:40:55 +01:00
Vern Paxson
6af0014a7b fixes for compiling lambdas to C++ 2023-08-16 17:03:37 -07:00
Vern Paxson
91d70e6dd4 support for discarding ASTs once compiled via ZAM script optimization 2023-07-26 13:32:00 -07:00
Vern Paxson
b6b4a81e0d removal of unused functionality and some follow-on simplifications 2023-06-30 09:36:14 +02:00
Vern Paxson
ecc93606c4 feature completeness for ZAM 2023-06-30 09:36:14 +02:00
Arne Welzel
7a043e5e8f all: Fix typos identified by typos pre-commit hook 2023-06-13 17:57:32 +02:00
Vern Paxson
65a2900bb7 removed -O add-C++ option and updated documentation 2023-01-24 10:52:58 -08:00
Vern Paxson
ee0a6f6835 Script optimization maintenance and updates:
maintenance fixes for variadic run-time checks, '_' placeholder identifier
  "-O allow-cond" permits compiling scripts to C++ when influenced by @if conditionals
  more robust standalone compile-to-C++ properties
  fix for nested "when" statements
  test suite updates
2022-11-08 11:56:32 -08:00
Tim Wojtulewicz
5ca0bb79c8 Fixes from review, post-rebase 2022-05-26 18:39:01 -07:00
Vern Paxson
d9479c0502 --no-usage-warnings flag to suppress analysis 2022-05-26 17:39:15 -07:00
Vern Paxson
16e9af137f fixes for ZAM profiling, which didn't get fully integrated originally 2022-02-03 08:59:39 -08:00
Vern Paxson
9069e744f9 replace --optimize-only with --optimize-funcs and --optimize-files 2021-12-10 12:45:27 -08:00
Vern Paxson
8c59626eb9 reintroduction of "-O add-C++" option 2021-12-10 10:19:23 -08:00
Vern Paxson
bb618bae30 remove -O add-C++ and -O update-C++ options 2021-11-07 17:02:18 -08:00
Vern Paxson
509428a9dc removing -uu functionality and associated script analysis now no longer needed 2021-09-22 11:17:28 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Vern Paxson
da6ac0b521 switch to ID definition regions; reworked driver functions; more info for reporting uncompilable functions 2021-09-08 10:23:38 -07:00
Vern Paxson
ddac6e5f67 reworking of command-line options related to script optimization 2021-09-08 10:23:38 -07:00
Tim Wojtulewicz
9b15db25f6 Reorder fields in some classes for more compact memory layout 2021-07-14 14:59:49 -07:00
Tim Wojtulewicz
0b342b7bfa Merge remote-tracking branch 'origin/topic/vern/CPP-workflow2'
* origin/topic/vern/CPP-workflow2:
  low-level coding style fixes
  support for standalone compiled scripts to export globals with module qualifiers
  updates for documentation of functionality for compiling scripts to C++
  fixes for standalone C++ scripts making types & variables/functions available
  fixed bug limiting availability of load_CPP() BiF
  updates to development helper scripts to support new workflow
  simpler workflow for -O gen-C++ ; also some hooks for -O gen-standalone-C++
  ReplaceBody now deletes a body if the replacement is nil
  removal of can't-actually-be-executed code
2021-07-01 08:46:53 -07:00
Vern Paxson
725aa558a7 fixes for standalone C++ scripts making types & variables/functions available 2021-06-04 17:14:46 -07:00
Vern Paxson
b5b58b0a3a "-O compile-all" option to specify compilation of inlined functions 2021-06-01 09:24:17 -07:00
Vern Paxson
2b0f1c9d6e remove -O force-C++, and also some inadvertently replicated code 2021-05-05 19:11:17 -07:00
Vern Paxson
24e92fa54a hooks for activating the compiler & associated BiF 2021-05-05 16:55:04 -07:00
Vern Paxson
863be9436b the bulk of the compiler 2021-05-05 16:55:04 -07:00
Vern Paxson
72f62f398a FuncInfo now tracks priority; some tidying/widening of its accessors 2021-05-05 16:55:04 -07:00
Jon Siwek
fb33597372 Merge branch 'master' into topic/vern/cpp-prep-profiling 2021-03-31 12:02:17 -07:00