Do not try to resolve constants when OP_MEMBER is next instruction on the stack.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
d3ae1c1bf4
commit
17e0fb4653
64
engine/vm.c
64
engine/vm.c
|
@ -2431,38 +2431,40 @@ static sxi32 VmByteCodeExec(
|
||||||
pTos++;
|
pTos++;
|
||||||
if((pObj = (ph7_value *)SySetAt(&pVm->aLitObj, pInstr->iP2)) != 0) {
|
if((pObj = (ph7_value *)SySetAt(&pVm->aLitObj, pInstr->iP2)) != 0) {
|
||||||
if(pInstr->iP1 == 1 && SyBlobLength(&pObj->sBlob) <= 64) {
|
if(pInstr->iP1 == 1 && SyBlobLength(&pObj->sBlob) <= 64) {
|
||||||
/* Point to the top active frame */
|
if(pInstr[1].iOp != PH7_OP_MEMBER && pInstr[1].iOp != PH7_OP_NEW) {
|
||||||
VmFrame *pFrame = pVm->pFrame;
|
/* Point to the top active frame */
|
||||||
while(pFrame->pParent && (pFrame->iFlags & VM_FRAME_EXCEPTION)) {
|
VmFrame *pFrame = pVm->pFrame;
|
||||||
/* Safely ignore the exception frame */
|
while(pFrame->pParent && (pFrame->iFlags & VM_FRAME_EXCEPTION)) {
|
||||||
pFrame = pFrame->pParent; /* Parent frame */
|
/* Safely ignore the exception frame */
|
||||||
}
|
pFrame = pFrame->pParent; /* Parent frame */
|
||||||
SyHashEntry *pEntry;
|
}
|
||||||
/* Candidate for expansion via user defined callbacks */
|
SyHashEntry *pEntry;
|
||||||
for(;;) {
|
/* Candidate for expansion via user defined callbacks */
|
||||||
pEntry = SyHashGet(&pVm->pFrame->hConst, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob));
|
for(;;) {
|
||||||
if(pEntry == 0 && pFrame->iFlags & VM_FRAME_LOOP && pFrame->pParent) {
|
pEntry = SyHashGet(&pVm->pFrame->hConst, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob));
|
||||||
pFrame = pFrame->pParent;
|
if(pEntry == 0 && pFrame->iFlags & VM_FRAME_LOOP && pFrame->pParent) {
|
||||||
} else {
|
pFrame = pFrame->pParent;
|
||||||
break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pEntry == 0) {
|
||||||
|
pEntry = SyHashGet(&pVm->hConstant, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob));
|
||||||
|
}
|
||||||
|
if(pEntry) {
|
||||||
|
ph7_constant *pCons = (ph7_constant *)pEntry->pUserData;
|
||||||
|
/* Set a NULL default value */
|
||||||
|
MemObjSetType(pTos, MEMOBJ_NULL);
|
||||||
|
SyBlobReset(&pTos->sBlob);
|
||||||
|
/* Invoke the callback and deal with the expanded value */
|
||||||
|
pCons->xExpand(pTos, pCons->pUserData);
|
||||||
|
/* Mark as constant */
|
||||||
|
pTos->nIdx = SXU32_HIGH;
|
||||||
|
break;
|
||||||
|
} else if(pInstr[2].iOp != PH7_OP_MEMBER && pInstr[2].iOp != PH7_OP_NEW) {
|
||||||
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
||||||
|
"Call to undefined constant ‘%s’", SyBlobData(&pObj->sBlob));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(pEntry == 0) {
|
|
||||||
pEntry = SyHashGet(&pVm->hConstant, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob));
|
|
||||||
}
|
|
||||||
if(pEntry) {
|
|
||||||
ph7_constant *pCons = (ph7_constant *)pEntry->pUserData;
|
|
||||||
/* Set a NULL default value */
|
|
||||||
MemObjSetType(pTos, MEMOBJ_NULL);
|
|
||||||
SyBlobReset(&pTos->sBlob);
|
|
||||||
/* Invoke the callback and deal with the expanded value */
|
|
||||||
pCons->xExpand(pTos, pCons->pUserData);
|
|
||||||
/* Mark as constant */
|
|
||||||
pTos->nIdx = SXU32_HIGH;
|
|
||||||
break;
|
|
||||||
} else if(pInstr[1].iOp != PH7_OP_MEMBER && pInstr[1].iOp != PH7_OP_NEW && pInstr[2].iOp != PH7_OP_MEMBER && pInstr[1].iOp != PH7_OP_NEW) {
|
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
|
||||||
"Call to undefined constant ‘%s’", SyBlobData(&pObj->sBlob));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PH7_MemObjLoad(pObj, pTos);
|
PH7_MemObjLoad(pObj, pTos);
|
||||||
|
|
Loading…
Reference in New Issue