aboutsummaryrefslogtreecommitdiff
path: root/py/showbc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-10-22 23:45:37 +0100
committerDamien George <damien.p.george@gmail.com>2015-11-13 12:49:18 +0000
commit3a3db4dcf0400cffef860f61a84979cb1f7a7541 (patch)
treecfdcb6931cb120f2f993e10e7db6dc14f40b1ded /py/showbc.c
parent9b7f583b0ca37ee87e5fb82e2d65fcd96a609b2f (diff)
py: Put all bytecode state (arg count, etc) in bytecode.
Diffstat (limited to 'py/showbc.c')
-rw-r--r--py/showbc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/py/showbc.c b/py/showbc.c
index 87e7c6af4..538eddc40 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -54,18 +54,22 @@
const byte *mp_showbc_code_start;
-void mp_bytecode_print(const void *descr, mp_uint_t n_total_args, const byte *ip, mp_uint_t len) {
+void mp_bytecode_print(const void *descr, const byte *ip, mp_uint_t len) {
mp_showbc_code_start = ip;
- // get state size and exception stack size
+ // get bytecode parameters
mp_uint_t n_state = mp_decode_uint(&ip);
mp_uint_t n_exc_stack = mp_decode_uint(&ip);
+ /*mp_uint_t scope_flags =*/ ip++;
+ mp_uint_t n_pos_args = *ip++;
+ mp_uint_t n_kwonly_args = *ip++;
+ /*mp_uint_t n_def_pos_args =*/ ip++;
ip = MP_ALIGN(ip, sizeof(mp_uint_t));
// get and skip arg names
const mp_obj_t *arg_names = (const mp_obj_t*)ip;
- ip += n_total_args * sizeof(mp_uint_t);
+ ip += (n_pos_args + n_kwonly_args) * sizeof(mp_uint_t);
const byte *code_info = ip;
mp_uint_t code_info_size = mp_decode_uint(&code_info);
@@ -88,7 +92,7 @@ void mp_bytecode_print(const void *descr, mp_uint_t n_total_args, const byte *ip
// bytecode prelude: arg names (as qstr objects)
printf("arg names:");
- for (mp_uint_t i = 0; i < n_total_args; i++) {
+ for (mp_uint_t i = 0; i < n_pos_args + n_kwonly_args; i++) {
printf(" %s", qstr_str(MP_OBJ_QSTR_VALUE(arg_names[i])));
}
printf("\n");