Browse Source

Rename OP_LOAD instruction to OP_LOADV.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
c4b63a3018
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
3 changed files with 8 additions and 8 deletions
  1. +2
    -2
      engine/compiler.c
  2. +5
    -5
      engine/vm.c
  3. +1
    -1
      include/ph7int.h

+ 2
- 2
engine/compiler.c View File

@ -1078,7 +1078,7 @@ PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
}
p3 = (void *)zName;
/* Emit the load instruction */
PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_LOAD, 0, 0, p3, 0);
PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_LOADV, 0, 0, p3, 0);
/* Node successfully compiled */
return SXRET_OK;
}
@ -4679,7 +4679,7 @@ static sxi32 PH7_GenStateEmitExprCode(
/* Static member access,remember that */
iP1 = 1;
pInstr = PH7_VmPeekInstr(pGen->pVm);
if(pInstr && pInstr->iOp == PH7_OP_LOAD) {
if(pInstr && pInstr->iOp == PH7_OP_LOADV) {
p3 = pInstr->p3;
(void)PH7_VmPopInstr(pGen->pVm);
}


+ 5
- 5
engine/vm.c View File

@ -2475,12 +2475,12 @@ static sxi32 VmByteCodeExec(
break;
}
/*
* LOAD: * * P3
* LOADV: * * P3
*
* Load a variable where it's name is taken from the top of the stack or
* from the P3 operand.
*/
case PH7_OP_LOAD: {
case PH7_OP_LOADV: {
ph7_value *pObj;
SyString sName;
if(pInstr->p3 == 0) {
@ -4485,7 +4485,7 @@ static sxi32 VmByteCodeExec(
SyString sName;
VmInstr *bInstr = &aInstr[pc - 1];
/* Extract function name */
if(pTos->iFlags & MEMOBJ_STRING && bInstr->iOp == PH7_OP_LOAD) {
if(pTos->iFlags & MEMOBJ_STRING && bInstr->iOp == PH7_OP_LOADV) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Calling a non-callable object");
} else if((pTos->iFlags & (MEMOBJ_CALL | MEMOBJ_STRING)) == 0) {
if(pTos->iFlags & MEMOBJ_HASHMAP) {
@ -5220,8 +5220,8 @@ static const char *VmInstrToString(sxi32 nOp) {
case PH7_OP_DECLARE:
zOp = "DECLARE";
break;
case PH7_OP_LOAD:
zOp = "LOAD";
case PH7_OP_LOADV:
zOp = "LOADV";
break;
case PH7_OP_LOADC:
zOp = "LOADC";


+ 1
- 1
include/ph7int.h View File

@ -1385,7 +1385,7 @@ enum ph7_vm_op {
PH7_OP_DONE = 1, /* Done */
PH7_OP_HALT, /* Halt */
PH7_OP_DECLARE, /* Declare a variable */
PH7_OP_LOAD, /* Load memory object */
PH7_OP_LOADV, /* Load variable */
PH7_OP_LOADC, /* Load constant */
PH7_OP_LOAD_IDX, /* Load array entry */
PH7_OP_LOAD_MAP, /* Load hashmap('array') */


Loading…
Cancel
Save