diff options
author | Colin Hogben <colin@infinnovation.co.uk> | 2016-04-18 23:09:25 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-04-19 09:22:40 +0100 |
commit | 8aa3cbf15312987410e2358c4ee93d8bb8cdf715 (patch) | |
tree | 96d0bc7d46a172c7db1596f01a0ff050c1594778 /lib/utils/pyexec.c | |
parent | 97f88eebb6e94ec2f6b91a49898e0fb08eb150ea (diff) |
lib/utils/pyexec: Condition-out GC calls from pyexec.
A port which uses lib/utils/pyexec.c but which does not enable garbage
collection should not need to implement the gc_collect function.
This patch also moves the gc_collect call to after printing the qstr
info. Since qstrs cannot be collected it should not make any difference
to the printed statistics.
Diffstat (limited to 'lib/utils/pyexec.c')
-rw-r--r-- | lib/utils/pyexec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index a9e058c1c..ddecb6a8d 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -110,7 +110,6 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind, if ((exec_flags & EXEC_FLAG_ALLOW_DEBUGGING) && repl_display_debugging_info) { mp_uint_t ticks = mp_hal_ticks_ms() - start; // TODO implement a function that does this properly printf("took " UINT_FMT " ms\n", ticks); - gc_collect(); // qstr info { mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; @@ -118,8 +117,11 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind, printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes); } - // GC info + #if MICROPY_ENABLE_GC + // run collection and print GC info + gc_collect(); gc_dump_info(); + #endif } if (exec_flags & EXEC_FLAG_PRINT_EOF) { |