Further optimisations.
All checks were successful
The build was successful.

This commit is contained in:
Rafal Kupiec 2019-04-03 13:57:29 +02:00
parent 5eeceb6927
commit 01c210984e
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -636,15 +636,15 @@ static sxi32 VmMountUserClass(
if(pMemObj == 0 || pResult == 0) { if(pMemObj == 0 || pResult == 0) {
PH7_VmMemoryError(&(*pVm)); PH7_VmMemoryError(&(*pVm));
} }
MemObjSetType(pMemObj, pAttr->nType);
if(SySetUsed(&pAttr->aByteCode) > 0) { if(SySetUsed(&pAttr->aByteCode) > 0) {
/* Initialize attribute default value (any complex expression) */ /* Initialize attribute default value (any complex expression) */
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult); VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
}
MemObjSetType(pMemObj, pAttr->nType);
rc = PH7_MemObjSafeStore(pResult, pMemObj); rc = PH7_MemObjSafeStore(pResult, pMemObj);
if(rc != SXRET_OK) { if(rc != SXRET_OK) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName); PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
} }
}
/* Free up memory */ /* Free up memory */
PH7_MemObjRelease(pResult); PH7_MemObjRelease(pResult);
/* Record attribute index */ /* Record attribute index */
@ -704,15 +704,15 @@ PH7_PRIVATE sxi32 PH7_VmCreateClassInstanceFrame(
SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr); SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr);
return SXERR_MEM; return SXERR_MEM;
} }
MemObjSetType(pMemObj, pAttr->nType);
if(SySetUsed(&pAttr->aByteCode) > 0) { if(SySetUsed(&pAttr->aByteCode) > 0) {
/* Initialize attribute default value (any complex expression) */ /* Initialize attribute default value (any complex expression) */
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult); VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
}
MemObjSetType(pMemObj, pAttr->nType);
rc = PH7_MemObjSafeStore(pResult, pMemObj); rc = PH7_MemObjSafeStore(pResult, pMemObj);
if(rc != SXRET_OK) { if(rc != SXRET_OK) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName); PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
} }
}
/* Free up memory */ /* Free up memory */
PH7_MemObjRelease(pResult); PH7_MemObjRelease(pResult);
/* Record attribute index */ /* Record attribute index */