Norimasa Okamoto
/
pymite
python-on-a-chip online compiler
- http://pymbed.appspot.com/
- https://code.google.com/p/python-on-a-chip/
- http://www.youtube.com/watch?v=Oyqc2bFRW9I
- https://bitbucket.org/va009039/pymbed/
more info: python-on-a-chip
Diff: vm/interp.c
- Revision:
- 1:28afb064a41c
- Parent:
- 0:65f1469d6bfb
--- a/vm/interp.c Sat Mar 02 11:54:20 2013 +0000 +++ b/vm/interp.c Sun Mar 10 10:13:36 2013 +0000 @@ -166,11 +166,21 @@ TOS = pobj2; continue; +#ifdef HAVE_PYTHON27 + case LIST_APPEND: + t16 = GET_ARG(); + C_ASSERT(t16 >= 2); + retval = list_append((*(PM_SP - t16)), TOS); + PM_SP--; + continue; + +#else /* HAVE_PYTHON27 */ case LIST_APPEND: /* list_append will raise a TypeError if TOS1 is not a list */ retval = list_append(TOS1, TOS); PM_SP -= 2; continue; +#endif /* HAVE_PYTHON27 */ case BINARY_POWER: case INPLACE_POWER: @@ -1561,7 +1571,50 @@ t16 = GET_ARG(); PM_IP += t16; continue; + +#ifdef HAVE_PYTHON27 + case JUMP_IF_FALSE_OR_POP: + t16 = GET_ARG(); + if (obj_isFalse(TOS)) + { + PM_IP = PM_FP->fo_func->f_co->co_codeaddr + t16; + } + else + { + --PM_SP; + } + continue; + case JUMP_IF_TRUE_OR_POP: + t16 = GET_ARG(); + if (!obj_isFalse(TOS)) + { + PM_IP = PM_FP->fo_func->f_co->co_codeaddr + t16; + } + else + { + --PM_SP; + } + continue; + + case POP_JUMP_IF_FALSE: + t16 = GET_ARG(); + if (obj_isFalse(TOS)) + { + PM_IP = PM_FP->fo_func->f_co->co_codeaddr + t16; + } + --PM_SP; + continue; + + case POP_JUMP_IF_TRUE: + t16 = GET_ARG(); + if (!obj_isFalse(TOS)) + { + PM_IP = PM_FP->fo_func->f_co->co_codeaddr + t16; + } + --PM_SP; + continue; +#else /* HAVE_PYTHON27 */ case JUMP_IF_FALSE: t16 = GET_ARG(); if (obj_isFalse(TOS)) @@ -1577,6 +1630,7 @@ PM_IP += t16; } continue; +#endif /* HAVE_PYTHON27 */ case JUMP_ABSOLUTE: case CONTINUE_LOOP: @@ -2154,6 +2208,10 @@ default: +#ifdef HAVE_PYTHON27 + printf("SystemError unimplemented opcode %02x\n", bc); + C_ASSERT(0); +#endif /* SystemError, unknown or unimplemented opcode */ PM_RAISE(retval, PM_RET_EX_SYS); break;