From ffb8f27d6b81afb2a4c3fa6c8a7c0c6e3d76ba58 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Sat, 3 Aug 2024 13:26:11 +0100 Subject: [PATCH] some final fixups --- src/Type.cc | 3 +++ src/ZVal.h | 1 + src/script_opt/ZAM/Driver.cc | 2 -- src/script_opt/ZAM/OPs/internal.op | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Type.cc b/src/Type.cc index 48729d7936..9750ba2559 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -614,6 +614,9 @@ SetType::~SetType() = default; #pragma GCC diagnostic ignored "-Wdeprecated-declarations" FuncType::Capture::Capture(detail::IDPtr _id, bool _deep_copy) : id(std::move(_id)), deep_copy(_deep_copy) { is_managed = id ? ZVal::IsManagedType(id->GetType()) : false; + if ( ! is_managed ) + // For non-managed types, deep copying isn't applicable. + deep_copy = false; } #pragma GCC diagnostic pop diff --git a/src/ZVal.h b/src/ZVal.h index 0efc1765da..1223c67b39 100644 --- a/src/ZVal.h +++ b/src/ZVal.h @@ -62,6 +62,7 @@ union ZVal { ZVal(const TypePtr& t); // Construct directly. + ZVal(bool v) { int_val = v; } ZVal(zeek_int_t v) { int_val = v; } ZVal(zeek_uint_t v) { uint_val = v; } ZVal(double v) { double_val = v; } diff --git a/src/script_opt/ZAM/Driver.cc b/src/script_opt/ZAM/Driver.cc index 8a38f8104d..2c43932755 100644 --- a/src/script_opt/ZAM/Driver.cc +++ b/src/script_opt/ZAM/Driver.cc @@ -219,8 +219,6 @@ void ZAMCompiler::ResolveHookBreaks() { // Rewrite the breaks. for ( auto& b : breaks[0] ) { auto& i = insts1[b.stmt_num]; - // Preserve the auxiliary information (control-flow types - // in particular). auto aux = i->aux; *i = ZInstI(OP_HOOK_BREAK_X); i->aux = aux; diff --git a/src/script_opt/ZAM/OPs/internal.op b/src/script_opt/ZAM/OPs/internal.op index 55418d595d..dd29579ee6 100644 --- a/src/script_opt/ZAM/OPs/internal.op +++ b/src/script_opt/ZAM/OPs/internal.op @@ -21,6 +21,8 @@ assign-val v eval auto& v = Z_FRAME->GetElement($1); internal-assignment-op Load-Global +# We don't use GlobalVal() for the assignment because we want to leverage +# the bookkeeping that assign-val gives us in terms of memory management. class Vg assign-val v eval auto& v = GlobalID($1)->GetVal();