diff --git a/src/Func.cc b/src/Func.cc index fa08d81709..a5bee5f6e7 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -608,6 +608,9 @@ FuncPtr ScriptFunc::DoClone() { // ScriptFunc could hold a closure. In this case a clone of it must // 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()}; CopyStateInto(other.get()); diff --git a/src/Func.h b/src/Func.h index 14aad967aa..185db5977f 100644 --- a/src/Func.h +++ b/src/Func.h @@ -273,6 +273,7 @@ protected: /** * Uses the given frame for captures, and generates the * 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 */ diff --git a/src/Trigger.h b/src/Trigger.h index 71362ed511..2de6a4686b 100644 --- a/src/Trigger.h +++ b/src/Trigger.h @@ -81,6 +81,8 @@ public: // 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 // (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); Val* Lookup(const void* obj); diff --git a/src/Var.h b/src/Var.h index 51a6543202..29cd2ce604 100644 --- a/src/Var.h +++ b/src/Var.h @@ -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, std::unique_ptr> 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> attr); diff --git a/src/script_opt/ZAM/Ops.in b/src/script_opt/ZAM/Ops.in index 89bfccdc35..7350622cbb 100644 --- a/src/script_opt/ZAM/Ops.in +++ b/src/script_opt/ZAM/Ops.in @@ -12,7 +12,7 @@ # 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) # 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) # 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.