add OP_NOP
This commit is contained in:
parent
c3b45c6d16
commit
7837a30d53
|
@ -10,6 +10,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
enum pic_opcode {
|
||||
OP_NOP,
|
||||
OP_POP,
|
||||
OP_PUSHNIL,
|
||||
OP_PUSHTRUE,
|
||||
|
|
|
@ -1493,6 +1493,9 @@ print_code(pic_state *pic, struct pic_code c)
|
|||
|
||||
printf("[%2d] ", c.insn);
|
||||
switch (c.insn) {
|
||||
case OP_NOP:
|
||||
puts("OP_NOP");
|
||||
break;
|
||||
case OP_POP:
|
||||
puts("OP_POP");
|
||||
break;
|
||||
|
|
5
src/vm.c
5
src/vm.c
|
@ -387,7 +387,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
|
||||
#if PIC_DIRECT_THREADED_VM
|
||||
static void *oplabels[] = {
|
||||
&&L_OP_POP, &&L_OP_PUSHNIL, &&L_OP_PUSHTRUE, &&L_OP_PUSHFALSE,
|
||||
&&L_OP_NOP, &&L_OP_POP, &&L_OP_PUSHNIL, &&L_OP_PUSHTRUE, &&L_OP_PUSHFALSE,
|
||||
&&L_OP_PUSHINT, &&L_OP_PUSHCHAR, &&L_OP_PUSHCONST,
|
||||
&&L_OP_GREF, &&L_OP_GSET, &&L_OP_LREF, &&L_OP_LSET, &&L_OP_CREF, &&L_OP_CSET,
|
||||
&&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_NOT, &&L_OP_CALL, &&L_OP_TAILCALL, &&L_OP_RET,
|
||||
|
@ -443,6 +443,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
goto L_CALL;
|
||||
|
||||
VM_LOOP {
|
||||
CASE(OP_NOP) {
|
||||
NEXT;
|
||||
}
|
||||
CASE(OP_POP) {
|
||||
POPN(1);
|
||||
NEXT;
|
||||
|
|
Loading…
Reference in New Issue