Associate a filename with VM instructions.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-08-27 06:45:53 +02:00
parent f552c54992
commit 3f7bac2d85
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 13 additions and 5 deletions

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;

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.