From 4af6b52876f42714cd157ac8204cdada34d100e8 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Sun, 2 Apr 2023 11:35:15 -0700 Subject: [PATCH] introduced notion of light-weight Frame clones --- src/Frame.cc | 11 +++++++++++ src/Frame.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Frame.cc b/src/Frame.cc index 44fb4697f7..87ba277427 100644 --- a/src/Frame.cc +++ b/src/Frame.cc @@ -120,6 +120,17 @@ Frame* Frame::Clone() const return other; } +Frame* Frame::LightClone() const + { + Frame* other = new Frame(0, function, func_args); + + other->call = call; + other->assoc = assoc; + other->trigger = trigger; + + return other; + } + static bool val_is_func(const ValPtr& v, ScriptFunc* func) { if ( v->GetType()->Tag() != TYPE_FUNC ) diff --git a/src/Frame.h b/src/Frame.h index d403b2ddad..77a5e89a30 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -157,6 +157,14 @@ public: */ Frame* Clone() const; + /** + * Creates a copy of the frame that doesn't include its values, + * just its trigger context. + * + * @return a partial copy of this frame. + */ + Frame* LightClone() const; + /** * Serializes the frame in support of copy semantics for lambdas: *