Always record last instruction.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
383fe01943
commit
4dae0bcc9e
14
engine/vm.c
14
engine/vm.c
|
@ -906,6 +906,7 @@ PH7_PRIVATE sxi32 PH7_VmInit(
|
||||||
pVm->pEngine = &(*pEngine);
|
pVm->pEngine = &(*pEngine);
|
||||||
SyMemBackendInitFromParent(&pVm->sAllocator, &pEngine->sAllocator);
|
SyMemBackendInitFromParent(&pVm->sAllocator, &pEngine->sAllocator);
|
||||||
/* Instructions containers */
|
/* Instructions containers */
|
||||||
|
SySetInit(&pVm->aInstrSet, &pVm->sAllocator, sizeof(VmInstr));
|
||||||
SySetInit(&pVm->aByteCode, &pVm->sAllocator, sizeof(VmInstr));
|
SySetInit(&pVm->aByteCode, &pVm->sAllocator, sizeof(VmInstr));
|
||||||
SySetAlloc(&pVm->aByteCode, 0xFF);
|
SySetAlloc(&pVm->aByteCode, 0xFF);
|
||||||
pVm->pByteContainer = &pVm->aByteCode;
|
pVm->pByteContainer = &pVm->aByteCode;
|
||||||
|
@ -989,10 +990,9 @@ PH7_PRIVATE sxi32 PH7_VmInit(
|
||||||
SyStringInitFromBuf(&sBuiltin, PH7_BUILTIN_LIB, sizeof(PH7_BUILTIN_LIB) - 1);
|
SyStringInitFromBuf(&sBuiltin, PH7_BUILTIN_LIB, sizeof(PH7_BUILTIN_LIB) - 1);
|
||||||
/* Precompile the built-in library */
|
/* Precompile the built-in library */
|
||||||
VmEvalChunk(&(*pVm), 0, &sBuiltin, PH7_AERSCRIPT_CODE);
|
VmEvalChunk(&(*pVm), 0, &sBuiltin, PH7_AERSCRIPT_CODE);
|
||||||
/* Initialize instructions debug container */
|
|
||||||
if(bDebug) {
|
if(bDebug) {
|
||||||
|
/* Enable debugging */
|
||||||
pVm->bDebug = TRUE;
|
pVm->bDebug = TRUE;
|
||||||
SySetInit(&pVm->aInstrSet, &pVm->sAllocator, sizeof(VmInstr));
|
|
||||||
}
|
}
|
||||||
/* Reset the code generator */
|
/* Reset the code generator */
|
||||||
PH7_ResetCodeGenerator(&(*pVm), pEngine->xConf.xErr, pEngine->xConf.pErrData);
|
PH7_ResetCodeGenerator(&(*pVm), pEngine->xConf.xErr, pEngine->xConf.pErrData);
|
||||||
|
@ -2054,13 +2054,15 @@ static sxi32 VmByteCodeExec(
|
||||||
pc = 0;
|
pc = 0;
|
||||||
/* Execute as much as we can */
|
/* Execute as much as we can */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
if(!pVm->bDebug) {
|
||||||
|
/* Reset instructions set container */
|
||||||
|
SySetReset(&pVm->aInstrSet);
|
||||||
|
}
|
||||||
/* Fetch the instruction to execute */
|
/* Fetch the instruction to execute */
|
||||||
pInstr = &aInstr[pc];
|
pInstr = &aInstr[pc];
|
||||||
pInstr->bExec = TRUE;
|
pInstr->bExec = TRUE;
|
||||||
if(pVm->bDebug) {
|
/* Record executed instruction in global container */
|
||||||
/* Record executed instruction in debug container */
|
SySetPut(&pVm->aInstrSet, (void *)pInstr);
|
||||||
SySetPut(&pVm->aInstrSet, (void *)pInstr);
|
|
||||||
}
|
|
||||||
rc = SXRET_OK;
|
rc = SXRET_OK;
|
||||||
/*
|
/*
|
||||||
* What follows here is a massive switch statement where each case implements a
|
* What follows here is a massive switch statement where each case implements a
|
||||||
|
|
Loading…
Reference in New Issue