diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-29 01:26:02 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-29 01:26:02 +0000 |
commit | c47fd2da8ec705a3c6f51d1a09b7bf4a180a01ff (patch) | |
tree | 8304956bd360b2bda7a6f5ee8e9443111da183dd /py/showbc.c | |
parent | bcc9298e5bd2049bbee8c1d00482d2695b8e0b70 (diff) | |
parent | 1d7553311c70810a6fea2d72b04403b93711389c (diff) | |
download | micropython-c47fd2da8ec705a3c6f51d1a09b7bf4a180a01ff.tar.gz micropython-c47fd2da8ec705a3c6f51d1a09b7bf4a180a01ff.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/showbc.c')
-rw-r--r-- | py/showbc.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/py/showbc.c b/py/showbc.c index eb743bd29e..12bd901185 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -30,7 +30,16 @@ void mp_byte_code_print(const byte *ip, int len) { machine_uint_t code_info_size = ip[0] | (ip[1] << 8) | (ip[2] << 16) | (ip[3] << 24); ip += code_info_size; - // decode prelude + // bytecode prelude: state size and exception stack size; 16 bit uints + { + uint n_state = ip[0] | (ip[1] << 8); + uint n_exc_stack = ip[2] | (ip[3] << 8); + ip += 4; + printf("(N_STATE %u)\n", n_state); + printf("(N_EXC_STACK %u)\n", n_exc_stack); + } + + // bytecode prelude: initialise closed over variables { uint n_local = *ip++; printf("(NUM_LOCAL %u)\n", n_local); @@ -244,6 +253,15 @@ void mp_byte_code_print(const byte *ip, int len) { printf("SETUP_LOOP " UINT_FMT, ip + unum - ip_start); break; + case MP_BC_SETUP_WITH: + DECODE_ULABEL; // loop-like labels are always forward + printf("SETUP_WITH " UINT_FMT, ip + unum - ip_start); + break; + + case MP_BC_WITH_CLEANUP: + printf("WITH_CLEANUP"); + break; + case MP_BC_UNWIND_JUMP: DECODE_SLABEL; printf("UNWIND_JUMP " UINT_FMT " %d", ip + unum - ip_start, *ip); |