Browse Source

Add execution marker to each instruction.

release/v0.1
Rafal Kupiec 3 years ago
parent
commit
838842fa02
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 7 additions and 0 deletions
  1. +6
    -0
      engine/vm.c
  2. +1
    -0
      include/ph7int.h

+ 6
- 0
engine/vm.c View File

@ -317,6 +317,7 @@ PH7_PRIVATE sxi32 PH7_VmEmitInstr(
sInstr.iP1 = iP1;
sInstr.iP2 = iP2;
sInstr.p3 = p3;
sInstr.bExec = FALSE;
sInstr.pFile = pFile;
sInstr.iLine = 1;
if(pVm->sCodeGen.pEnd && pVm->sCodeGen.pEnd->nLine > 0) {
@ -2056,6 +2057,7 @@ static sxi32 VmByteCodeExec(
for(;;) {
/* Fetch the instruction to execute */
pInstr = &aInstr[pc];
pInstr->bExec = TRUE;
if(pVm->bDebug) {
/* Record executed instruction in debug container */
SySetPut(&pVm->aInstrSet, (void *)pInstr);
@ -7151,6 +7153,7 @@ PH7_PRIVATE sxi32 PH7_VmCallClassMethod(
aInstr[0].iP1 = nArg; /* Total number of given arguments */
aInstr[0].iP2 = iEntry;
aInstr[0].p3 = 0;
aInstr[0].bExec = FALSE;
aInstr[0].iLine = 1;
aInstr[0].pFile = (SyString *)&sFileName;
/* Emit the DONE instruction */
@ -7158,6 +7161,7 @@ PH7_PRIVATE sxi32 PH7_VmCallClassMethod(
aInstr[1].iP1 = 1; /* Extract method return value */
aInstr[1].iP2 = 0;
aInstr[1].p3 = 0;
aInstr[1].bExec = FALSE;
aInstr[1].iLine = 1;
aInstr[1].pFile = (SyString *)&sFileName;
/* Execute the method body (if available) */
@ -7271,6 +7275,7 @@ PH7_PRIVATE sxi32 PH7_VmCallUserFunction(
aInstr[0].iP1 = nArg; /* Total number of given arguments */
aInstr[0].iP2 = 0;
aInstr[0].p3 = 0;
aInstr[0].bExec = FALSE;
aInstr[0].iLine = 1;
aInstr[0].pFile = (SyString *)&sFileName;
/* Emit the DONE instruction */
@ -7278,6 +7283,7 @@ PH7_PRIVATE sxi32 PH7_VmCallUserFunction(
aInstr[1].iP1 = 1; /* Extract function return value if available */
aInstr[1].iP2 = 0;
aInstr[1].p3 = 0;
aInstr[1].bExec = FALSE;
aInstr[1].iLine = 1;
aInstr[1].pFile = (SyString *)&sFileName;
/* Execute the function body (if available) */


+ 1
- 0
include/ph7int.h View File

@ -1123,6 +1123,7 @@ struct VmInstr {
sxi32 iP1; /* First operand */
sxu32 iP2; /* Second operand (Often the jump destination) */
void *p3; /* Third operand (Often Upper layer private data) */
sxbool bExec; /* Whether the instruction has been already executed or not */
SyString *pFile; /* File name */
sxu32 iLine; /* Line number */
};


Loading…
Cancel
Save