mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
AST profiling enhnacements in support of script optimization for lambdas/whens
This commit is contained in:
parent
46983cfb2f
commit
110ba7a0a1
3 changed files with 63 additions and 32 deletions
|
@ -100,6 +100,8 @@ public:
|
|||
const IDSet& Globals() const { return globals; }
|
||||
const IDSet& AllGlobals() const { return all_globals; }
|
||||
const IDSet& Locals() const { return locals; }
|
||||
const IDSet& Captures() const { return captures; }
|
||||
const auto& CapturesOffsets() const { return captures_offsets; }
|
||||
const IDSet& WhenLocals() const { return when_locals; }
|
||||
const IDSet& Params() const { return params; }
|
||||
const std::unordered_map<const ID*, int>& Assignees() const { return assignees; }
|
||||
|
@ -208,6 +210,9 @@ protected:
|
|||
// If we're profiling a lambda function, this holds the captures.
|
||||
IDSet captures;
|
||||
|
||||
// This maps capture identifiers to their offsets.
|
||||
std::map<const ID*, int> captures_offsets;
|
||||
|
||||
// Constants seen in the function.
|
||||
std::vector<const ConstExpr*> constants;
|
||||
|
||||
|
@ -224,7 +229,8 @@ protected:
|
|||
// The same, but in a deterministic order, with duplicates removed.
|
||||
std::vector<const Type*> ordered_types;
|
||||
|
||||
// Script functions that this script calls.
|
||||
// Script functions that this script calls. Includes calls made
|
||||
// by lambdas and when bodies, as the goal is to identify recursion.
|
||||
std::unordered_set<ScriptFunc*> script_calls;
|
||||
|
||||
// Same for BiF's, though for them we record the corresponding global
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue