Commit graph

252 commits

Author SHA1 Message Date
Vern Paxson
9fe7d8581f make externally available the expression used for initializating a record field 2024-04-25 09:15:12 -07:00
Vern Paxson
91cab9931d ZAM optimizations for record creation
includes reworking of managing "auxiliary" information for ZAM instructions
2024-01-25 20:49:12 +01:00
Vern Paxson
f7b739a47d fixes for initializations of "-O gen-C++" script compilations 2024-01-15 15:03:56 +01:00
Arne Welzel
be0a22fec2 TableType: Convert table_hash unique_ptr
Cannot remove the destructor as otherwise the compiler attempts to create
its implementation in Type.h where CompositeHash isn't a complete type
yet and std::unique_ptr's delete fails to be instantiated.
2023-12-16 17:33:48 +01:00
Vern Paxson
a11ee9038b streamlining of constructing script-level tables 2023-12-16 17:33:46 +01:00
Arne Welzel
e68194f2df TableType: Simplify and inline Is...Index tests 2023-11-21 11:15:58 +01:00
Arne Welzel
c8bab6a0ec IndexType: Add IsPatternIndex(), like IsSubNetIndex() 2023-11-21 10:34:16 +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
Arne Welzel
8109bbc52f Var/Func: Render function parameters using comma, not semicolon
A bit larger follow-up to what Tim pointed out: Function prototype descriptions
previously used semicolons to separate parameters.

Switch to use commas when a RecordType is used as function parameter.
Use existing "func_args" naming for consistency.
2023-10-04 17:42:30 +02:00
Vern Paxson
8f92e0d39b ZAM fixes for record creation and table indexing potentially having side-effects 2023-09-27 11:38:21 -07:00
Arne Welzel
384e7e6b25 Fix deferred record initialization
Put RecordFieldInit instances into creation_inits during parsing and
determine their deferrability in an InitPostScript step. Any
RecordFieldInits can be deferred are moved into deferred_inits.

Closes #3260
2023-09-12 12:21:31 +02:00
Vern Paxson
cb15e0d4f1 Address PR review feedback on zam-feature-complete
* insert_or_assign usage
  * master -> primary
  * FunctionIngredientsPtr
  * FuncType::Capture deprecations
  * no new ScriptFunc constructor
2023-06-30 09:59:10 +02:00
Vern Paxson
b6464814c9 the "Capture" struct is now a class 2023-06-30 09:36:14 +02:00
Tim Wojtulewicz
4229af6820 Remove deprecations tagged for v6.1 2023-06-14 10:07:22 -07:00
Arne Welzel
89c828ac14 Merge remote-tracking branch 'origin/topic/vern/record-optimizations.Apr23B'
* origin/topic/vern/record-optimizations.Apr23B:
  different fix for MSVC compiler issues
  more general approach for addressing MSVC compiler issues with IntrusivePtr
  restored RecordType::Create, now marked as deprecated tidying of namespaces and private class members simplification of flagging record field initializations that should be skipped address peculiar MSVC compilation complaint for IntrusivePtr's
  clarifications and tidying for record field initializations
  optimize record construction by deferring initializations of aggregates
  compile-scripts-to-C++ speedups by switching to raw record access
  logging speedup by switching to raw record access
  remove redundant record coercions

Removed the `#if 0` hunk during merging: Probably could have gone with a
doctest instead.
2023-04-19 11:59:56 +02:00
Vern Paxson
11dc4c8ce9 different fix for MSVC compiler issues 2023-04-18 17:12:52 -07:00
Vern Paxson
c19eba62d6 restored RecordType::Create, now marked as deprecated
tidying of namespaces and private class members
simplification of flagging record field initializations that should be skipped
address peculiar MSVC compilation complaint for IntrusivePtr's
2023-04-18 09:41:45 -07:00
Vern Paxson
ee358affda clarifications and tidying for record field initializations 2023-04-15 20:12:49 -07:00
Arne Welzel
a0540f96a1 Revert "Type: Add TypeManager->TypeList() and use for ListVal()"
This reverts commit 24c606b4df.

This commit introduced a memory leak ListVal::Append() modifying
the cached TYPE_ANY type list.
2023-04-14 09:49:05 +02:00
Tim Wojtulewicz
fcf7af259c GH-2920: Don't warn on uninitialized container options 2023-04-13 09:05:17 -07:00
Vern Paxson
0787c130d0 optimize record construction by deferring initializations of aggregates 2023-04-10 11:44:11 -07:00
Arne Welzel
24c606b4df Type: Add TypeManager->TypeList() and use for ListVal()
It turns out that for every ListVal we construct, we also allocate
and construct a new TypeList instance, even though they are all the
same. Pre-create and cache the type instances in a new TypeManager.

The following script runs ~10% faster for me after this change.

    global tbl: table[string] of string;
    global i = 0;
    while ( ++i < 10000000 )
        tbl["a"] = "a";
2023-03-30 21:15:46 +02:00
Tim Wojtulewicz
3b0e8ee6f1 Fix a bunch of missing class member initializations 2023-01-27 13:03:18 -07:00
Vern Paxson
732faa998f provide deprecated version of merge_type_list() 2022-11-28 10:00:11 -08:00
Vern Paxson
c4973706e0 keep merge_types() externally available; address reviewing suggestion 2022-11-23 11:32:27 -08:00
Vern Paxson
47152e38c4 change vector constructors to require direct type equivalence for non-arithmetics 2022-11-21 15:32:46 -08:00
Tim Wojtulewicz
2739275b88 Merge remote-tracking branch 'jsoref/spelling-src'
* jsoref/spelling-src:
  Spelling src
2022-11-11 12:49:15 -07: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
Tim Wojtulewicz
859588d710 Add a couple of mising assignment operators to match copy constructors 2022-11-03 09:21:18 -07:00
Vern Paxson
96668ca0d3 fixes for compiling "standalone" C++ scripts 2022-09-24 14:56:42 -07:00
Tim Wojtulewicz
b41a4bf06d GH-1628: Return an error for duplicate record field names 2022-07-21 11:53:47 -07:00
Tim Wojtulewicz
f624c18383 Deprecate bro_int_t and bro_uint_t 2022-07-12 12:01:23 -07:00
Tim Wojtulewicz
70e63d4749 Remove deprecated MemoryAllocation() methods and related code 2022-06-30 18:56:52 +00:00
Vern Paxson
a0fc8ca5e4 broader support for AST traversal, including Attr and Attributes objects 2022-05-26 17:38:34 -07:00
Vern Paxson
d75d1715a9 make DoDescribe protected for a tidier interface
mark use of DESC_PORTABLE as deprecated
2022-05-03 13:41:39 -07:00
Vern Paxson
cbb18207dc when printing a description of a type, use its name if available 2022-04-28 18:23:02 -07:00
Vern Paxson
4d2115ffd3 catch empty constructors used for type inference
suppress repeated error messages
2022-03-31 19:30:00 -07:00
Vern Paxson
96f52b0e11 rework type inference due to switch from separate initializers to expressions 2022-03-23 15:36:35 -07:00
Matthew Luckie
11f8729997 remove deprecated union and timer types, addressing #1898 2022-02-19 19:17:51 +13:00
Vern Paxson
e22d279fdf option for internal use to mark a function type as allowing non-expression returns 2022-01-07 11:50:40 -08:00
Tim Wojtulewicz
6f61463a48 Add early bail-outs to same_type() 2021-12-10 19:49:51 +00:00
Vern Paxson
14abfc6831 removing unused SubNetType class 2021-11-07 16:56:57 -08:00
Tim Wojtulewicz
64748edab1 Replace most uses of typedef with using for type aliasing 2021-10-11 14:51:10 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Tim Wojtulewicz
a7fd34375f GH-572: Mark MemoryAllocation() and related methods deprecated 2021-06-28 11:07:58 -07:00
Vern Paxson
d524318154 faster construction of records by factoring static decisions into RecordType's 2021-05-30 18:25:15 -07:00
Vern Paxson
a16a25efbd fixed / removed out-of-date comments, tidied check_and_promote_args() interface 2021-05-30 17:25:40 -07:00
Vern Paxson
1ede6a8424 accessors / friends needed for compiling-to-C++ 2021-05-05 16:50:54 -07:00
Jon Siwek
01f6264c87 GH-1503: Improve &expire_func compatibility type-checking
Previously, incompatible &expire_funcs could mistakenly be used, such as
when using that attribute on the unspecified table()/set()
initializations/assignments, resulting in invalid function calls that
eventually crash Zeek.
2021-04-12 16:27:50 -07:00
Jon Siwek
cd8f19328a Merge remote-tracking branch 'origin/topic/neverlord/gh-1408'
- Minor adjustments to header includes, whitespace, and a
  compiler warning fix during merge

* origin/topic/neverlord/gh-1408:
  Add new Timer class to the telemetry API
  Fix build with latest VectorVal API
  Update baselines
  Prefix telemetry BIFs with __
  Expose telemetry API to scripting land
  Add handle types for histogram metrics
  Move duplicated code to detail header
  Adhere to Zeek coding style
  Apply suggestions from code review
  Add telemetry Manager to Zeek setup / teardown
  Add missing whitespaces for Zeek coding style
  Add gauge metric types
  Add scaffold for new metrics API with counters
2021-04-05 14:21:44 -07:00