add OP_NOP

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

View File

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

View File

@ -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;

View File

@ -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;