Test and temporary version of compiler emiting PH7_OP_CLASS_INIT instruction.
However it works on ph7_class and thus passes whole class into the VM, what causes memory overhead, as finally we have to find this class on the VM's stack. Instead, we could pass some ph7_class_info structure containing a name of class to look for and information about its inheritances.
This commit is contained in:
@@ -41,6 +41,8 @@ PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName, sxu32
|
||||
SyHashInit(&pClass->hAttr, &pVm->sAllocator, 0, 0);
|
||||
SyHashInit(&pClass->hDerived, &pVm->sAllocator, 0, 0);
|
||||
SySetInit(&pClass->aInterface, &pVm->sAllocator, sizeof(ph7_class *));
|
||||
SySetInit(&pClass->sExtends, &pVm->sAllocator, sizeof(SyString));
|
||||
SySetInit(&pClass->sImplements, &pVm->sAllocator, sizeof(SyString));
|
||||
pClass->nLine = nLine;
|
||||
/* All done */
|
||||
return pClass;
|
||||
|
Reference in New Issue
Block a user