Commit graph

69 commits

Author SHA1 Message Date
Vern Paxson
550c7eb0a7 Fixes for -O gen-standalone-C++ for tracking BiFs, lambdas, attribute types, and independent globals 2025-09-24 17:34:35 -07:00
Vern Paxson
18d435ac12 fix for tracking identifiers and aggregates when compiling to standalone-C++ 2025-09-15 13:57:35 -07:00
Tim Wojtulewicz
26ea7cc655 Clang-tidy fixes for recent IDPtr changes 2025-09-03 15:34:29 -07:00
Vern Paxson
693aa244f9 shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 11:19:31 -07:00
Tim Wojtulewicz
b592b6c998 Use .contains() instead of .find() or .count() 2025-09-02 16:42:52 +00:00
Tim Wojtulewicz
a1d121e5aa Use std::string/string_view versions of starts_with/ends_with where appropriate
The util:: versions of these methods remain as a thin wrapper around them so
they can be used with const char* arguments. Otherwise callers have to manually
make string_view objects from the input.
s Please enter the commit message for your changes. Lines starting
2025-07-17 09:08:54 -07:00
Vern Paxson
5c63133226 isolate Location specifics to private class variables to enforce correct line number ordering 2025-07-08 10:39:28 +02:00
Tim Wojtulewicz
a3078f3132 Fix clang-tidy modernize-use-emplace findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
cb8c35748a Fix clang-tidy performance-unnecessary-copy-initialization warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
b8e28abb97 Fix clang-tidy performance-for-range-copy warnings 2025-05-30 08:12:29 -07: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
Vern Paxson
62f891dcba modified AST profiling to mark (and fully skip) non-optimizable functions 2024-12-06 16:17:44 -08: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
adf3648554 fixes (to avoid collisions) for AST profiling's function hash computations 2024-09-27 13:24:35 -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
Arne Welzel
71e9c8d436 script_opt: Use Func::GetName() 2024-09-27 15:11:17 +02:00
Arne Welzel
9d1d4e28b3 ScriptOpt: Ensure global statements have non-null scope
The ProfileFunc() logic assumed that GetScope() returned a non-nullptr.
This holds except for the synthetic global statements function.

Fix the latter and add an assert, also add a name to the type so it's
easier to recognize in a debugger what's going on, otherwise the name
is "".

This was found by UBSAN due to it seeing the ->OrderedVars() call on a
nullptr. Elsewhere, num_params == 0 shielded from that access and so
didn't lead to crashes.
2024-08-16 13:59:24 +02:00
Vern Paxson
2477213619 simpler and more robust identification of function parameters for AST profiling 2024-08-16 11:19:02 +02:00
Vern Paxson
857df9f063 support for more in-depth AST profiling 2024-08-16 11:18:57 +02:00
Vern Paxson
d2c6208421 allow profiling without updating of hash values 2024-08-16 11:18:57 +02:00
Vern Paxson
4b719ef45a script optimization for record operations sourced (in part) from other records 2024-06-24 09:38:37 +02:00
Vern Paxson
37c1f6641c script optimization support for "add" and "delete" being expressions 2024-05-29 12:40:06 -07:00
Vern Paxson
8c4c224c93 fix for ZAM profiling potentially accessing freed memory 2024-04-25 09:15:12 -07:00
Vern Paxson
c29db63fdd ZAM execution changes to support richer profiling 2024-03-19 10:59:49 -07:00
Vern Paxson
037f76e384 refined ZAM function profiling to include (correct) statement line number blocks 2024-03-19 10:59:49 -07:00
Vern Paxson
74d36eb759 script optimization support for clearing tables/vectors using "delete" 2024-03-08 19:09:46 +01:00
Vern Paxson
896238c173 streamlining of some script optimization APIs 2024-01-15 15:03:56 +01:00
Vern Paxson
dd91790f1e script optimization tracking of functions called by event engine or indirectly 2023-12-12 09:45:19 +01:00
Vern Paxson
6e0ce17c22 revert problems with profiling attributes introduced by recent script-opt PR 2023-12-12 09:45:19 +01:00
Vern Paxson
740a087765 reworked AST optimizers analysis of side effects during aggregate operations & calls 2023-12-06 12:26:27 -08: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
110ba7a0a1 AST profiling enhnacements in support of script optimization for lambdas/whens 2023-06-30 09:36:14 +02:00
Vern Paxson
0c434ca4f8 changed function_ingredients struct to FunctionIngredients class with accessors 2023-04-02 11:34:16 -07:00
Vern Paxson
65a2900bb7 removed -O add-C++ option and updated documentation 2023-01-24 10:52:58 -08:00
Josh Soref
cd201aa24e Spelling src
These are non-functional changes.

* accounting
* activation
* actual
* added
* addresult
* aggregable
* aligned
* alternatively
* ambiguous
* analysis
* analyzer
* anticlimactic
* apparently
* application
* appropriate
* arithmetic
* assignment
* assigns
* associated
* authentication
* authoritative
* barrier
* boundary
* broccoli
* buffering
* caching
* called
* canonicalized
* capturing
* certificates
* ciphersuite
* columns
* communication
* comparison
* comparisons
* compilation
* component
* concatenating
* concatenation
* connection
* convenience
* correctly
* corresponding
* could
* counting
* data
* declared
* decryption
* defining
* dependent
* deprecated
* detached
* dictionary
* directional
* directly
* directory
* discarding
* disconnecting
* distinguishes
* documentation
* elsewhere
* emitted
* empty
* endianness
* endpoint
* enumerator
* essentially
* evaluated
* everything
* exactly
* execute
* explicit
* expressions
* facilitates
* fiddling
* filesystem
* flag
* flagged
* for
* fragments
* guarantee
* guaranteed
* happen
* happening
* hemisphere
* identifier
* identifies
* identify
* implementation
* implemented
* implementing
* including
* inconsistency
* indeterminate
* indices
* individual
* information
* initial
* initialization
* initialize
* initialized
* initializes
* instantiate
* instantiated
* instantiates
* interface
* internal
* interpreted
* interpreter
* into
* it
* iterators
* length
* likely
* log
* longer
* mainly
* mark
* maximum
* message
* minimum
* module
* must
* name
* namespace
* necessary
* nonexistent
* not
* notifications
* notifier
* number
* objects
* occurred
* operations
* original
* otherwise
* output
* overridden
* override
* overriding
* overwriting
* ownership
* parameters
* particular
* payload
* persistent
* potential
* precision
* preexisting
* preservation
* preserved
* primarily
* probably
* procedure
* proceed
* process
* processed
* processes
* processing
* propagate
* propagated
* prototype
* provides
* publishing
* purposes
* queue
* reached
* reason
* reassem
* reassemble
* reassembler
* recommend
* record
* reduction
* reference
* regularly
* representation
* request
* reserved
* retrieve
* returning
* separate
* should
* shouldn't
* significant
* signing
* simplified
* simultaneously
* single
* somebody
* sources
* specific
* specification
* specified
* specifies
* specify
* statement
* subdirectories
* succeeded
* successful
* successfully
* supplied
* synchronization
* tag
* temporarily
* terminating
* that
* the
* transmitted
* true
* truncated
* try
* understand
* unescaped
* unforwarding
* unknown
* unknowndata
* unspecified
* update
* usually
* which
* wildcard

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-09 12:08:15 -05:00
Vern Paxson
5c21240daf fixes for initializing scripts compiled to C++ 2022-09-29 15:09:37 -07:00
Vern Paxson
9ada7ac4e7 tracking of when statements/expressions occur in a "when" context 2022-05-12 13:45:45 -07:00
Matthew Luckie
11f8729997 remove deprecated union and timer types, addressing #1898 2022-02-19 19:17:51 +13:00
Tim Wojtulewicz
3d9d6e953b Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda:
  explicitly provide the frame for evaluating a "when" timeout expression
  attempt to make "when" btest deterministic
  tests for new "when" semantics/errors
  update existing test suite usage of "when" statements to include captures
  update uses of "when" in base scripts to include captures
  captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*"
  logic (other than in profiling) for assignments that yield separate values
  option for internal use to mark a function type as allowing non-expression returns
  removed some now-obsolete profiling functionality
  minor commenting clarifications
2022-01-14 14:41:42 -07:00
Vern Paxson
f895008c34 captures for "when" statements
update Triggers to IntrusivePtr's and simpler AST traversal
introduce IDSet type, migrate associated "ID*" types to "const ID*"
2022-01-07 14:50:35 -08:00
Vern Paxson
6cb5ea6835 removed some now-obsolete profiling functionality 2022-01-07 11:50:01 -08:00
Vern Paxson
a09c5e6bde fix: don't treat pseudo-identifiers in type cases as local variables 2021-12-23 11:37:17 -08:00
Vern Paxson
a10fafe398 tweak to keep clang-format happy 2021-12-12 12:43:30 -08:00
Vern Paxson
2f7137999f restored support for incremental compilation of scripts to C++ 2021-12-12 12:36:45 -08:00
Vern Paxson
4ea5785908 fixed for profiling missing some profile elements 2021-12-12 12:33:06 -08:00
Vern Paxson
9069e744f9 replace --optimize-only with --optimize-funcs and --optimize-files 2021-12-10 12:45:27 -08:00
Vern Paxson
f865897cac AST profiles track the associated function/body/expression 2021-11-24 15:18:40 -08:00
Tim Wojtulewicz
4423574d26 clang-format: Set IndentCaseBlocks to false 2021-09-27 10:49:48 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00