add OP_NOP

This commit is contained in:
Yuichi Nishiwaki 2014-02-04 16:20:17 +09:00
parent c3b45c6d16
commit 7837a30d53
3 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@ extern "C" {
#endif #endif
enum pic_opcode { enum pic_opcode {
OP_NOP,
OP_POP, OP_POP,
OP_PUSHNIL, OP_PUSHNIL,
OP_PUSHTRUE, OP_PUSHTRUE,

View File

@ -1493,6 +1493,9 @@ print_code(pic_state *pic, struct pic_code c)
printf("[%2d] ", c.insn); printf("[%2d] ", c.insn);
switch (c.insn) { switch (c.insn) {
case OP_NOP:
puts("OP_NOP");
break;
case OP_POP: case OP_POP:
puts("OP_POP"); puts("OP_POP");
break; break;

View File

@ -387,7 +387,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
#if PIC_DIRECT_THREADED_VM #if PIC_DIRECT_THREADED_VM
static void *oplabels[] = { 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_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_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, &&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; goto L_CALL;
VM_LOOP { VM_LOOP {
CASE(OP_NOP) {
NEXT;
}
CASE(OP_POP) { CASE(OP_POP) {
POPN(1); POPN(1);
NEXT; NEXT;