mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
ZAM support for lambdas
This commit is contained in:
parent
0a40aec4a6
commit
7d5760ac74
11 changed files with 272 additions and 37 deletions
|
@ -149,6 +149,9 @@ const ZAMStmt ZAMCompiler::AddInst(const ZInstI& inst, bool suppress_non_local)
|
|||
if ( suppress_non_local )
|
||||
return ZAMStmt(top_main_inst);
|
||||
|
||||
// Ensure we haven't confused ourselves about any pending stores.
|
||||
ASSERT(pending_global_store == -1 || pending_capture_store == -1);
|
||||
|
||||
if ( pending_global_store >= 0 )
|
||||
{
|
||||
auto gs = pending_global_store;
|
||||
|
@ -161,6 +164,27 @@ const ZAMStmt ZAMCompiler::AddInst(const ZInstI& inst, bool suppress_non_local)
|
|||
return AddInst(store_inst);
|
||||
}
|
||||
|
||||
if ( pending_capture_store >= 0 )
|
||||
{
|
||||
auto cs = pending_capture_store;
|
||||
pending_capture_store = -1;
|
||||
|
||||
auto& cv = *func->GetType()->AsFuncType()->GetCaptures();
|
||||
auto& c_id = cv[cs].Id();
|
||||
|
||||
ZOp op;
|
||||
|
||||
if ( ZVal::IsManagedType(c_id->GetType()) )
|
||||
op = OP_STORE_MANAGED_CAPTURE_VV;
|
||||
else
|
||||
op = OP_STORE_CAPTURE_VV;
|
||||
|
||||
auto store_inst = ZInstI(op, RawSlot(c_id.get()), cs);
|
||||
store_inst.op_type = OP_VV_I2;
|
||||
|
||||
return AddInst(store_inst);
|
||||
}
|
||||
|
||||
return ZAMStmt(top_main_inst);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue