Cleanup OP_LOAD instruction.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
517dffcbc1
commit
f9b518138e
31
engine/vm.c
31
engine/vm.c
|
@ -2464,10 +2464,10 @@ static sxi32 VmByteCodeExec(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* LOAD: * P2 P3
|
* LOAD: * * P3
|
||||||
*
|
*
|
||||||
* Load a variable where it's name is taken from the top of the stack or
|
* Load a variable where it's name is taken from the top of the stack or
|
||||||
* from the P3 operand. If P2 is set, it will create a new variable.
|
* from the P3 operand.
|
||||||
*/
|
*/
|
||||||
case PH7_OP_LOAD: {
|
case PH7_OP_LOAD: {
|
||||||
ph7_value *pObj;
|
ph7_value *pObj;
|
||||||
|
@ -2491,37 +2491,10 @@ static sxi32 VmByteCodeExec(
|
||||||
}
|
}
|
||||||
/* Extract the requested memory object */
|
/* Extract the requested memory object */
|
||||||
pObj = VmExtractMemObj(&(*pVm), &sName, pInstr->p3 ? FALSE : TRUE, FALSE);
|
pObj = VmExtractMemObj(&(*pVm), &sName, pInstr->p3 ? FALSE : TRUE, FALSE);
|
||||||
if(pInstr->iP2) {
|
|
||||||
if(pObj) {
|
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
|
||||||
"Redeclaration of ‘$%z’ variable", &sName);
|
|
||||||
}
|
|
||||||
if(!pInstr->p3) {
|
|
||||||
PH7_MemObjRelease(pTos);
|
|
||||||
} else {
|
|
||||||
pObj = VmExtractMemObj(&(*pVm), &sName, FALSE, TRUE);
|
|
||||||
if(pInstr->iP2 & MEMOBJ_MIXED && (pInstr->iP2 & MEMOBJ_HASHMAP) == 0) {
|
|
||||||
pObj->iFlags = MEMOBJ_MIXED | MEMOBJ_VOID;
|
|
||||||
} else {
|
|
||||||
if(pInstr->iP2 & MEMOBJ_HASHMAP) {
|
|
||||||
ph7_hashmap *pMap;
|
|
||||||
pMap = PH7_NewHashmap(&(*pVm), 0, 0);
|
|
||||||
if(pMap == 0) {
|
|
||||||
PH7_VmMemoryError(&(*pVm));
|
|
||||||
}
|
|
||||||
pObj->x.pOther = pMap;
|
|
||||||
}
|
|
||||||
MemObjSetType(pObj, pInstr->iP2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pTos->nIdx = SXU32_HIGH; /* Mark as constant */
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
if(pObj == 0) {
|
if(pObj == 0) {
|
||||||
/* Fatal error */
|
/* Fatal error */
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Variable '$%z' undeclared (first use in this method/closure)", &sName);
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Variable '$%z' undeclared (first use in this method/closure)", &sName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* Load variable contents */
|
/* Load variable contents */
|
||||||
PH7_MemObjLoad(pObj, pTos);
|
PH7_MemObjLoad(pObj, pTos);
|
||||||
pTos->nIdx = pObj->nIdx;
|
pTos->nIdx = pObj->nIdx;
|
||||||
|
|
Loading…
Reference in New Issue