Browse Source

Associate a filename with VM instructions.

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

+ 7
- 0
engine/vm.c View File

@ -306,11 +306,18 @@ PH7_PRIVATE sxi32 PH7_VmEmitInstr(
) {
VmInstr sInstr;
sxi32 rc;
/* Extract the processed script */
SyString *pFile = (SyString *)SySetPeek(&pVm->aFiles);
static const SyString sFileName = { "[MEMORY]", sizeof("[MEMORY]") - 1};
if(pFile == 0) {
pFile = (SyString *)&sFileName;
}
/* Fill the VM instruction */
sInstr.iOp = (sxu8)iOp;
sInstr.iP1 = iP1;
sInstr.iP2 = iP2;
sInstr.p3 = p3;
sInstr.pFile = pFile;
sInstr.iLine = 1;
if(pVm->sCodeGen.pEnd && pVm->sCodeGen.pEnd->nLine > 0) {
sInstr.iLine = pVm->sCodeGen.pEnd->nLine;


+ 6
- 5
include/ph7int.h View File

@ -1119,11 +1119,12 @@ struct ph7_class_instance {
*/
typedef struct VmInstr VmInstr;
struct VmInstr {
sxu8 iOp; /* Operation to preform */
sxi32 iP1; /* First operand */
sxu32 iP2; /* Second operand (Often the jump destination) */
sxu32 iLine; /* Line number */
void *p3; /* Third operand (Often Upper layer private data) */
sxu8 iOp; /* Operation to preform */
sxi32 iP1; /* First operand */
sxu32 iP2; /* Second operand (Often the jump destination) */
void *p3; /* Third operand (Often Upper layer private data) */
SyString *pFile; /* File name */
sxu32 iLine; /* Line number */
};
/* Each active class instance attribute is represented by an instance
* of the following structure.


Loading…
Cancel
Save