Rename LFB/LFE operators.
The build was successful.
Detalles
The build was successful.
Detalles
Este commit está contenido en:
padre
f323e3cb57
commit
f3972a9ca2
|
@ -1381,8 +1381,8 @@ static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
|
|||
} else {
|
||||
sxu32 nInstrIdx = 0;
|
||||
if(!pLoop->bPostContinue) {
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
}
|
||||
PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_JMP, 0, pLoop->nFirstInstr, 0, &nInstrIdx);
|
||||
if(pLoop->bPostContinue) {
|
||||
|
@ -1421,8 +1421,8 @@ static sxi32 PH7_CompileBreak(ph7_gen_state *pGen) {
|
|||
PH7_GenCompileError(pGen, E_ERROR, pGen->pIn->nLine, "A 'break' statement may only be used within a loop or switch");
|
||||
} else {
|
||||
sxu32 nInstrIdx;
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
rc = PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMP, 0, 0, 0, &nInstrIdx);
|
||||
if(rc == SXRET_OK) {
|
||||
/* Fix the jump later when the jump destination is resolved */
|
||||
|
@ -1548,7 +1548,7 @@ static sxi32 PH7_CompileGoto(ph7_gen_state *pGen)
|
|||
sJump.pFunc = 0;
|
||||
}
|
||||
/* Make sure there will not stay any loop frame opened (i.e. goto inside a loop) */
|
||||
PH7_VmEmitInstr(pGen->pVm, sJump.nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
PH7_VmEmitInstr(pGen->pVm, sJump.nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
/* Emit the unconditional jump */
|
||||
if(SXRET_OK == PH7_VmEmitInstr(pGen->pVm, sJump.nLine, PH7_OP_JMP, 0, 0, 0, &sJump.nInstrIdx)) {
|
||||
SySetPut(&pGen->aGoto, (const void *)&sJump);
|
||||
|
@ -1700,15 +1700,15 @@ static sxi32 PH7_CompileWhile(ph7_gen_state *pGen) {
|
|||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPZ, 0, 0, 0, &nFalseJump);
|
||||
/* Save the instruction index so we can fix it later when the jump destination is resolved */
|
||||
PH7_GenStateNewJumpFixup(pWhileBlock, PH7_OP_JMPZ, nFalseJump);
|
||||
/* Emit the OP_JMPLFB instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFB, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_START instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_START, 0, 0, 0, 0);
|
||||
/* Compile the loop body */
|
||||
rc = PH7_CompileBlock(&(*pGen));
|
||||
if(rc == SXERR_ABORT) {
|
||||
return SXERR_ABORT;
|
||||
}
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
/* Emit the unconditional jump to the start of the loop */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMP, 0, pWhileBlock->nFirstInstr, 0, 0);
|
||||
/* Fix all jumps now the destination is resolved */
|
||||
|
@ -1755,8 +1755,8 @@ static sxi32 PH7_CompileDoWhile(ph7_gen_state *pGen) {
|
|||
}
|
||||
/* Deffer 'continue;' jumps until we compile the block */
|
||||
pDoBlock->bPostContinue = TRUE;
|
||||
/* Emit the OP_JMPLFB instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFB, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_START instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_START, 0, 0, 0, 0);
|
||||
rc = PH7_CompileBlock(&(*pGen));
|
||||
if(rc == SXERR_ABORT) {
|
||||
return SXERR_ABORT;
|
||||
|
@ -1814,8 +1814,8 @@ static sxi32 PH7_CompileDoWhile(ph7_gen_state *pGen) {
|
|||
}
|
||||
pGen->pIn = &pEnd[1];
|
||||
pGen->pEnd = pTmp;
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
/* Emit the true jump to the beginning of the loop */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPNZ, 0, pDoBlock->nFirstInstr, 0, 0);
|
||||
/* Fix all jumps now the destination is resolved */
|
||||
|
@ -1918,8 +1918,8 @@ static sxi32 PH7_CompileFor(ph7_gen_state *pGen) {
|
|||
PH7_GenCompileError(pGen, E_ERROR, pGen->pIn->nLine,
|
||||
"for: Expected ';' after conditionals expressions");
|
||||
}
|
||||
/* Emit the OP_JMPLFB instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFB, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_START instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_START, 0, 0, 0, 0);
|
||||
/* Jump the trailing ';' */
|
||||
pGen->pIn++;
|
||||
/* Save the post condition stream */
|
||||
|
@ -1968,8 +1968,8 @@ static sxi32 PH7_CompileFor(ph7_gen_state *pGen) {
|
|||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_POP, 1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
/* Emit the unconditional jump to the start of the loop */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMP, 0, pForBlock->nFirstInstr, 0, 0);
|
||||
/* Fix all jumps now the destination is resolved */
|
||||
|
@ -2158,8 +2158,8 @@ static sxi32 PH7_CompileForeach(ph7_gen_state *pGen) {
|
|||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_FOREACH_STEP, 0, 0, pInfo, &nFalseJump);
|
||||
/* Save the instruction index so we can fix it later when the jump destination is resolved */
|
||||
PH7_GenStateNewJumpFixup(pForeachBlock, PH7_OP_FOREACH_STEP, nFalseJump);
|
||||
/* Emit the OP_JMPLFB instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFB, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_START instruction to enter a loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_START, 0, 0, 0, 0);
|
||||
/* Compile the loop body */
|
||||
pGen->pIn = &pEnd[1];
|
||||
pGen->pEnd = pTmp;
|
||||
|
@ -2168,8 +2168,8 @@ static sxi32 PH7_CompileForeach(ph7_gen_state *pGen) {
|
|||
/* Don't worry about freeing memory, everything will be released shortly */
|
||||
return SXERR_ABORT;
|
||||
}
|
||||
/* Emit the OP_JMPLFE instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMPLFE, 0, 0, 0, 0);
|
||||
/* Emit the OP_LF_STOP instruction to leave the loop frame */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_LF_STOP, 0, 0, 0, 0);
|
||||
/* Emit the unconditional jump to the start of the loop */
|
||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_JMP, 0, pForeachBlock->nFirstInstr, 0, 0);
|
||||
/* Fix all jumps now the destination is resolved */
|
||||
|
|
16
engine/vm.c
16
engine/vm.c
|
@ -2120,11 +2120,11 @@ static sxi32 VmByteCodeExec(
|
|||
}
|
||||
break;
|
||||
/*
|
||||
* JMPLFB: * * *
|
||||
* LF_START: * * *
|
||||
*
|
||||
* Creates and enters the jump loop frame on the beginning of each iteration.
|
||||
*/
|
||||
case PH7_OP_JMPLFB: {
|
||||
case PH7_OP_LF_START: {
|
||||
VmFrame *pFrame = 0;
|
||||
/* Enter the jump loop frame */
|
||||
rc = VmEnterFrame(&(*pVm), pVm->pFrame->pUserData, pVm->pFrame->pThis, &pFrame);
|
||||
|
@ -2135,10 +2135,12 @@ static sxi32 VmByteCodeExec(
|
|||
break;
|
||||
}
|
||||
/*
|
||||
* LF_STOP: * * *
|
||||
*
|
||||
* Leaves and destroys the jump loop frame at the end of each iteration
|
||||
* as well as on 'break' and 'continue' instructions.
|
||||
*/
|
||||
case PH7_OP_JMPLFE: {
|
||||
case PH7_OP_LF_STOP: {
|
||||
/* Leave the jump loop frame */
|
||||
if(pVm->pFrame->iFlags & VM_FRAME_LOOP) {
|
||||
VmLeaveFrame(&(*pVm));
|
||||
|
@ -5215,11 +5217,11 @@ static const char *VmInstrToString(sxi32 nOp) {
|
|||
case PH7_OP_JMPNZ:
|
||||
zOp = "JMPNZ";
|
||||
break;
|
||||
case PH7_OP_JMPLFB:
|
||||
zOp = "JMPLFB";
|
||||
case PH7_OP_LF_START:
|
||||
zOp = "LF_START";
|
||||
break;
|
||||
case PH7_OP_JMPLFE:
|
||||
zOp = "JMPLFE";
|
||||
case PH7_OP_LF_STOP:
|
||||
zOp = "LF_STOP";
|
||||
break;
|
||||
case PH7_OP_POP:
|
||||
zOp = "POP";
|
||||
|
|
|
@ -1393,8 +1393,8 @@ enum ph7_vm_op {
|
|||
PH7_OP_JMP, /* Unconditional jump */
|
||||
PH7_OP_JMPZ, /* Jump on zero (FALSE jump) */
|
||||
PH7_OP_JMPNZ, /* Jump on non-zero (TRUE jump) */
|
||||
PH7_OP_JMPLFB, /* Jump loop frame begin */
|
||||
PH7_OP_JMPLFE, /* Jump loop frame end */
|
||||
PH7_OP_LF_START, /* Loop frame start */
|
||||
PH7_OP_LF_STOP, /* Loop frame stop */
|
||||
PH7_OP_POP, /* Stack POP */
|
||||
PH7_OP_CVT_INT, /* Integer cast */
|
||||
PH7_OP_CVT_STR, /* String cast */
|
||||
|
|
Cargando…
Referencia en una nueva incidencia