summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/showbc.c14
-rw-r--r--py/vm.c4
2 files changed, 6 insertions, 12 deletions
diff --git a/py/showbc.c b/py/showbc.c
index ba7c309b31..9a7ff9e3be 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -206,25 +206,15 @@ void mp_show_byte_code(const byte *ip, int len) {
printf("POP_JUMP_IF_FALSE " UINT_FMT, ip + unum - ip_start);
break;
- /*
case MP_BC_JUMP_IF_TRUE_OR_POP:
DECODE_SLABEL;
- if (rt_is_true(*sp)) {
- ip += unum;
- } else {
- sp++;
- }
+ printf("JUMP_IF_TRUE_OR_POP " UINT_FMT, ip + unum - ip_start);
break;
case MP_BC_JUMP_IF_FALSE_OR_POP:
DECODE_SLABEL;
- if (rt_is_true(*sp)) {
- sp++;
- } else {
- ip += unum;
- }
+ printf("JUMP_IF_FALSE_OR_POP " UINT_FMT, ip + unum - ip_start);
break;
- */
case MP_BC_SETUP_EXCEPT:
DECODE_ULABEL; // except labels are always forward
diff --git a/py/vm.c b/py/vm.c
index db219e4870..750c7431b7 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -25,6 +25,8 @@
#define SET_TOP(val) *sp = (val)
mp_obj_t mp_execute_byte_code(const byte *code, const mp_obj_t *args, uint n_args, uint n_state) {
+ n_state += 1; // XXX there is a bug somewhere which doesn't count enough state... (conwaylife and mandel have the bug)
+
// allocate state for locals and stack
mp_obj_t temp_state[10];
mp_obj_t *state = &temp_state[0];
@@ -86,6 +88,8 @@ bool mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out, mp_ob
machine_uint_t *volatile exc_sp = &exc_stack[0] - 1; // stack grows up, exc_sp points to top of stack
const byte *volatile save_ip = ip; // this is so we can access ip in the exception handler without making ip volatile (which means the compiler can't keep it in a register in the main loop)
+ // TODO if an exception occurs, do fast[0,1,2] become invalid??
+
// outer exception handling loop
for (;;) {
if (nlr_push(&nlr) == 0) {