removed deprecated capture-by-reference closures

This commit is contained in:
Vern Paxson 2022-06-17 15:55:43 -07:00
parent 5ccba54335
commit 5a0a88526e
20 changed files with 59 additions and 1220 deletions

View file

@ -29,7 +29,7 @@ CPPLambdaFunc::CPPLambdaFunc(string _name, FuncTypePtr ft, CPPStmtPtr _l_body)
l_body = move(_l_body);
}
broker::expected<broker::data> CPPLambdaFunc::SerializeClosure() const
broker::expected<broker::data> CPPLambdaFunc::SerializeCaptures() const
{
auto vals = l_body->SerializeLambdaCaptures();

View file

@ -85,11 +85,9 @@ class CPPLambdaFunc : public ScriptFunc
public:
CPPLambdaFunc(std::string name, FuncTypePtr ft, CPPStmtPtr l_body);
bool HasCopySemantics() const override { return true; }
protected:
// Methods related to sending lambdas via Broker.
broker::expected<broker::data> SerializeClosure() const override;
broker::expected<broker::data> SerializeCaptures() const override;
void SetCaptures(Frame* f) override;
FuncPtr DoClone() override;

View file

@ -800,16 +800,9 @@ void ZAMCompiler::CheckSlotUse(int slot, const ZInstI* inst)
void ZAMCompiler::ExtendLifetime(int slot, const ZInstI* inst)
{
// When using old-style lambda closure semantics, a function that
// returns a lambda needs to stick around for calls to that lambda.
// We ensure that by extending its lifetime to the end of this
// function.
auto id = frame_denizens[slot];
auto& t = id->GetType();
if ( t->Tag() == TYPE_FUNC && t->Yield() && t->Yield()->Tag() == TYPE_FUNC )
inst = insts1.back();
if ( denizen_ending.count(slot) > 0 )
{
// End of denizen's lifetime already seen. Check for