Implement explicit value and reference captures for closures
Build / AerScript (push) Successful in 40s

This commit is contained in:
2026-10-26 00:05:05 +01:00
parent 85f59a2998
commit 4fe0f4dcd9
4 changed files with 219 additions and 32 deletions
+3
View File
@@ -1318,11 +1318,13 @@ struct VmRefObj {
SySet aReference; /* Table of references to this memory object */
SySet aArrEntries; /* Foreign hashmap entries [i.e: array(&$a) ] */
sxu32 nIdx; /* Referenced object index */
sxu32 nCapture; /* Closure owners: keep contents and index alive */
sxi32 iFlags; /* Configuration flags */
VmRefObj *pNextCollide, *pPrevCollide; /* Collision link */
VmRefObj *pNext, *pPrev; /* List of all referenced objects */
};
#define VM_REF_IDX_KEEP 0x001 /* Do not restore the memory object to the free list */
#define VM_REF_CAPTURE_RETIRED 0x002 /* Storage owner has left while captured */
/*
* Output control buffer entry.
* Refer to the implementation of [ob_start()] for more information.
@@ -1804,6 +1806,7 @@ PH7_PRIVATE ph7_class_instance *PH7_NewClassInstance(ph7_vm *pVm, ph7_class *pCl
PH7_PRIVATE ph7_class_instance *PH7_CloneClassInstance(ph7_class_instance *pSrc);
PH7_PRIVATE sxi32 PH7_ClassInstanceCmp(ph7_class_instance *pLeft, ph7_class_instance *pRight, int bStrict, int iNest);
PH7_PRIVATE void PH7_ClassInstanceUnref(ph7_class_instance *pThis);
PH7_PRIVATE sxi32 PH7_ClassInstanceFinalize(ph7_class_instance *pThis);
PH7_PRIVATE sxi32 PH7_ClassInstanceDump(SyBlob *pOut, ph7_class_instance *pThis, int ShowType, int nTab, int nDepth);
PH7_PRIVATE sxi32 PH7_ClassInstanceCallMagicMethod(ph7_vm *pVm, ph7_class *pClass, ph7_class_instance *pThis, const char *zMethod,
sxu32 nByte, const SyString *pAttrName);