This commit is contained in:
parent
9a56751879
commit
e4ab5974fa
@ -778,7 +778,7 @@ static sxi32 GenStateCompileString(ph7_gen_state *pGen) {
|
|||||||
}/*for(;;)*/
|
}/*for(;;)*/
|
||||||
if(iCons > 1) {
|
if(iCons > 1) {
|
||||||
/* Concatenate all compiled constants */
|
/* Concatenate all compiled constants */
|
||||||
PH7_VmEmitInstr(pGen->pVm, PH7_OP_CAT, iCons, 0, 0, 0);
|
PH7_VmEmitInstr(pGen->pVm, PH7_OP_ADD, iCons, 1, 0, 0);
|
||||||
}
|
}
|
||||||
/* Node successfully compiled */
|
/* Node successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
|
11
engine/vm.c
11
engine/vm.c
@ -3394,19 +3394,24 @@ static sxi32 VmByteCodeExec(
|
|||||||
VmPopOperand(&pTos, 1);
|
VmPopOperand(&pTos, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* OP_ADD * * *
|
/* OP_ADD P1 P2 *
|
||||||
*
|
*
|
||||||
* Pop the top two elements from the stack, add them together,
|
* Pop the top two elements from the stack, add them together,
|
||||||
* and push the result back onto the stack.
|
* and push the result back onto the stack.
|
||||||
*/
|
*/
|
||||||
case PH7_OP_ADD: {
|
case PH7_OP_ADD: {
|
||||||
ph7_value *pNos = &pTos[-1];
|
ph7_value *pNos;
|
||||||
|
if(pInstr->iP1 < 1) {
|
||||||
|
pNos = &pTos[-1];
|
||||||
|
} else {
|
||||||
|
pNos = &pTos[-pInstr->iP1 + 1];
|
||||||
|
}
|
||||||
#ifdef UNTRUST
|
#ifdef UNTRUST
|
||||||
if(pNos < pStack) {
|
if(pNos < pStack) {
|
||||||
goto Abort;
|
goto Abort;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(pNos->iFlags & MEMOBJ_STRING || pTos->iFlags & MEMOBJ_STRING) {
|
if(pInstr->iP2 || pNos->iFlags & MEMOBJ_STRING || pTos->iFlags & MEMOBJ_STRING) {
|
||||||
/* Perform the string addition */
|
/* Perform the string addition */
|
||||||
ph7_value *pCur;
|
ph7_value *pCur;
|
||||||
if((pNos->iFlags & MEMOBJ_STRING) == 0) {
|
if((pNos->iFlags & MEMOBJ_STRING) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user