diff --git a/engine/compiler.c b/engine/compiler.c index 317c487..575148c 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -1879,8 +1879,6 @@ static sxi32 PH7_CompileFor(ph7_gen_state *pGen) { pTmp = pGen->pEnd; pGen->pEnd = pEnd; sxu32 nKey = (sxu32)(SX_PTR_TO_INT(pGen->pIn->pUserData)); - /* Emit the OP_CF_START instruction to enter a context frame */ - PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_CF_START, 0, 0, 0, 0); if(nKey & (PH7_KEYWORD_AUTO | PH7_KEYWORD_TYPEDEF)) { /* Compile variable */ PH7_CompileVar(&(*pGen)); @@ -1982,8 +1980,6 @@ static sxi32 PH7_CompileFor(ph7_gen_state *pGen) { PH7_GenStateFixJumps(pForBlock, -1, PH7_VmInstrLength(pGen->pVm)); /* Release the loop block */ PH7_GenStateLeaveBlock(pGen, 0); - /* Emit the OP_CF_STOP instruction to leave the context frame */ - PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_CF_STOP, 0, 0, 0, 0); /* Statement successfully compiled */ return SXRET_OK; } diff --git a/engine/debug.c b/engine/debug.c index bf2aeb0..f4ba43f 100644 --- a/engine/debug.c +++ b/engine/debug.c @@ -19,7 +19,7 @@ PH7_PRIVATE sxi32 VmExtractDebugTrace(ph7_vm *pVm, SySet *pDebugTrace) { /* Backup current frame */ VmFrame *oFrame = pVm->pFrame; while(pVm->pFrame) { - if(pVm->pFrame->iFlags & (VM_FRAME_ACTIVE | VM_FRAME_CONTEXT)) { + if(pVm->pFrame->iFlags & VM_FRAME_ACTIVE) { /* Iterate through all frames */ ph7_vm_func *pFunc; pFunc = (ph7_vm_func *)pVm->pFrame->pUserData; @@ -116,12 +116,6 @@ static const char *VmInstrToString(sxi32 nOp) { case PH7_OP_JMPNZ: zOp = "JMPNZ"; break; - case PH7_OP_CF_START: - zOp = "CF_START"; - break; - case PH7_OP_CF_STOP: - zOp = "CF_STOP"; - break; case PH7_OP_LF_START: zOp = "LF_START"; break; diff --git a/engine/vm.c b/engine/vm.c index 76e0dbc..e3f84c2 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -1394,7 +1394,7 @@ static ph7_value *VmExtractMemObj( } break; } - if(pFrame->pParent && pFrame->iFlags & (VM_FRAME_CONTEXT | VM_FRAME_LOOP | VM_FRAME_EXCEPTION | VM_FRAME_CATCH | VM_FRAME_FINALLY)) { + if(pFrame->pParent && pFrame->iFlags & (VM_FRAME_LOOP | VM_FRAME_EXCEPTION | VM_FRAME_CATCH | VM_FRAME_FINALLY)) { pFrame = pFrame->pParent; } else { break; @@ -1908,14 +1908,14 @@ static sxi32 VmByteCodeExec( VmLeaveFrame(&(*pVm)); } } else if(pVm->pFrame->iFlags & VM_FRAME_LOOP) { - while(pVm->pFrame->pParent && (pVm->pFrame->iFlags & (VM_FRAME_ACTIVE | VM_FRAME_CONTEXT)) == 0) { + while(pVm->pFrame->pParent && (pVm->pFrame->iFlags & VM_FRAME_ACTIVE) == 0) { VmLeaveFrame(&(*pVm)); } } if(pResult) { /* Execution result */ PH7_MemObjStore(pTos, pResult); - if(!pInstr->iP2 && pVm->pFrame->iFlags & (VM_FRAME_ACTIVE | VM_FRAME_CONTEXT)) { + if(!pInstr->iP2 && pVm->pFrame->iFlags & VM_FRAME_ACTIVE) { ph7_vm_func *pFunc = (ph7_vm_func *)pVm->pFrame->pUserData; if(pFunc->nType) { if((pFunc->nType & MEMOBJ_MIXED) == 0) { @@ -2027,33 +2027,6 @@ static sxi32 VmByteCodeExec( VmPopOperand(&pTos, 1); } break; - /* - * CF_START: * * * - * - * Creates and enters the active context frame. - */ - case PH7_OP_CF_START: { - VmFrame *pFrame = 0; - /* Enter the context frame */ - rc = VmEnterFrame(&(*pVm), pVm->pFrame->pUserData, pVm->pFrame->pThis, &pFrame); - if(rc != SXRET_OK) { - PH7_VmMemoryError(&(*pVm)); - } - pFrame->iFlags = VM_FRAME_CONTEXT; - break; - } - /* - * CF_STOP: * * * - * - * Leaves and destroys the active context frame. - */ - case PH7_OP_CF_STOP: { - /* Leave the context frame */ - if(pVm->pFrame->iFlags & VM_FRAME_CONTEXT) { - VmLeaveFrame(&(*pVm)); - } - break; - } /* * LF_START: * * * * @@ -2347,7 +2320,7 @@ static sxi32 VmByteCodeExec( /* Candidate for expansion via user defined callbacks */ for(;;) { pEntry = SyHashGet(&pFrame->hConst, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob)); - if(pEntry == 0 && pFrame->iFlags & (VM_FRAME_CONTEXT | VM_FRAME_LOOP) && pFrame->pParent) { + if(pEntry == 0 && pFrame->iFlags & VM_FRAME_LOOP && pFrame->pParent) { pFrame = pFrame->pParent; } else { break; diff --git a/include/ph7int.h b/include/ph7int.h index e0282ce..b1f7b31 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1249,12 +1249,11 @@ struct VmFrame { sxu32 iExceptionJump; /* Exception jump destination */ }; #define VM_FRAME_ACTIVE 0x01 /* Active call frame */ -#define VM_FRAME_CONTEXT 0x02 /* Active context frame */ -#define VM_FRAME_LOOP 0x04 /* Active loop frame */ -#define VM_FRAME_EXCEPTION 0x08 /* Special Exception frame */ -#define VM_FRAME_THROW 0x10 /* An exception was thrown */ -#define VM_FRAME_CATCH 0x20 /* Catch frame */ -#define VM_FRAME_FINALLY 0x40 /* Finally frame */ +#define VM_FRAME_LOOP 0x02 /* Active loop frame */ +#define VM_FRAME_EXCEPTION 0x04 /* Special Exception frame */ +#define VM_FRAME_THROW 0x08 /* An exception was thrown */ +#define VM_FRAME_CATCH 0x10 /* Catch frame */ +#define VM_FRAME_FINALLY 0x20 /* Finally frame */ /* * When a debug stacktrace is extracted from Virtual Machine, all information about * calls (file, line, class, method, arguments) are stored in this structure. @@ -1389,8 +1388,6 @@ 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_CF_START, /* Context frame start */ - PH7_OP_CF_STOP, /* Context frame stop */ PH7_OP_LF_START, /* Loop frame start */ PH7_OP_LF_STOP, /* Loop frame stop */ PH7_OP_POP, /* Stack POP */ diff --git a/tests/base32_test.aer b/tests/base32_test.aer index f407a77..a461348 100644 --- a/tests/base32_test.aer +++ b/tests/base32_test.aer @@ -23,7 +23,7 @@ class Base32 { } string[] $fiveBitBinaryArray = str_split($binaryString, 5); string $base32 = ''; - int $i = 0; + $i = 0; while($i < sizeof($fiveBitBinaryArray)) { $base32 += Base32::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5,'0'), 2, 10)]; $i++; @@ -50,7 +50,7 @@ class Base32 { $input = str_replace('=','', $input); char[] $aInput = str_split($input); string $binaryString = ''; - for(int $i = 0; $i < sizeof($aInput); $i = $i + 8) { + for($i = 0; $i < sizeof($aInput); $i = $i + 8) { string $x = ''; if(!in_array($input[$i], Base32::$map)) return '';