clarifying comments, interface tightening

This commit is contained in:
Vern Paxson 2023-06-16 15:12:25 -07:00 committed by Arne Welzel
parent 1505fd4aa1
commit c0f3403714
5 changed files with 8 additions and 2 deletions

View file

@ -608,6 +608,9 @@ FuncPtr ScriptFunc::DoClone()
{ {
// ScriptFunc could hold a closure. In this case a clone of it must // ScriptFunc could hold a closure. In this case a clone of it must
// store a copy of this closure. // store a copy of this closure.
//
// We don't use make_intrusive<> directly because we're accessing
// a protected constructor.
auto other = IntrusivePtr{AdoptRef{}, new ScriptFunc()}; auto other = IntrusivePtr{AdoptRef{}, new ScriptFunc()};
CopyStateInto(other.get()); CopyStateInto(other.get());

View file

@ -273,6 +273,7 @@ protected:
/** /**
* Uses the given frame for captures, and generates the * Uses the given frame for captures, and generates the
* mapping from captured variables to offsets in the frame. * mapping from captured variables to offsets in the frame.
* Virtual so it can be modified for script optimization uses.
* *
* @param f the frame holding the values of capture variables * @param f the frame holding the values of capture variables
*/ */

View file

@ -81,6 +81,8 @@ public:
// if the Val is null or it's disabled. The cache is managed using // if the Val is null or it's disabled. The cache is managed using
// void*'s so that the value can be associated with either a CallExpr // void*'s so that the value can be associated with either a CallExpr
// (for interpreted execution) or a C++ function (for compiled-to-C++). // (for interpreted execution) or a C++ function (for compiled-to-C++).
//
// Lookup() returned value must be Ref()'d if you want to hang onto it.
bool Cache(const void* obj, Val* val); bool Cache(const void* obj, Val* val);
Val* Lookup(const void* obj); Val* Lookup(const void* obj);

View file

@ -38,7 +38,7 @@ extern void add_global(const IDPtr& id, TypePtr t, InitClass c, ExprPtr init,
extern StmtPtr add_local(IDPtr id, TypePtr t, InitClass c, ExprPtr init, extern StmtPtr add_local(IDPtr id, TypePtr t, InitClass c, ExprPtr init,
std::unique_ptr<std::vector<AttrPtr>> attr, DeclType dt); std::unique_ptr<std::vector<AttrPtr>> attr, DeclType dt);
extern ExprPtr add_and_assign_local(IDPtr id, ExprPtr init, ValPtr val = nullptr); extern ExprPtr add_and_assign_local(IDPtr id, ExprPtr init, ValPtr val);
extern void add_type(ID* id, TypePtr t, std::unique_ptr<std::vector<AttrPtr>> attr); extern void add_type(ID* id, TypePtr t, std::unique_ptr<std::vector<AttrPtr>> attr);

View file

@ -12,7 +12,7 @@
# The Gen-ZAM utility processes this file to generate numerous C++ inclusion # The Gen-ZAM utility processes this file to generate numerous C++ inclusion
# files that are then compiled into Zeek. These files span the range of (1) # files that are then compiled into Zeek. These files span the range of (1)
# hooks that enable run-time generation of ZAM code to execute ASTs (which # hooks that enable run-time generation of ZAM code to execute ASTs (which
# have first been transformed to "reduced" form, (2) specifications of the # have first been transformed to "reduced" form), (2) specifications of the
# properties of the different instructions, (3) code to evaluate (execute) # properties of the different instructions, (3) code to evaluate (execute)
# each instruction, and (4) macros (C++ #define's) to aid in writing that # each instruction, and (4) macros (C++ #define's) to aid in writing that
# code. See Gen-ZAM.h for a list of the different inclusion files. # code. See Gen-ZAM.h for a list of the different inclusion files.