diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-07 23:38:50 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-07 23:38:50 +0000 |
commit | 3b51b3e90f1d513031ad2c6b6a2a0d5d391f753d (patch) | |
tree | 6903d1a13bdc49860c325e531e81582beb6063bf /stmhal/modpyb.c | |
parent | 7a0636e80aea2ce1af03c890e024dabcdffcdf78 (diff) | |
download | micropython-3b51b3e90f1d513031ad2c6b6a2a0d5d391f753d.tar.gz micropython-3b51b3e90f1d513031ad2c6b6a2a0d5d391f753d.zip |
stmhal: Collect all root pointers together in 1 place.
A GC in stmhal port now only scans true root pointers, not entire BSS.
This reduces base GC time from 1700ms to 900ms.
Diffstat (limited to 'stmhal/modpyb.c')
-rw-r--r-- | stmhal/modpyb.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index 91b9464713..64712ad300 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -29,6 +29,7 @@ #include "stm32f4xx_hal.h" +#include "py/mpstate.h" #include "py/nlr.h" #include "py/obj.h" #include "py/gc.h" @@ -475,16 +476,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_have_cdc_obj, pyb_have_cdc); /// Get or set the UART object that the REPL is repeated on. STATIC mp_obj_t pyb_repl_uart(mp_uint_t n_args, const mp_obj_t *args) { if (n_args == 0) { - if (pyb_stdio_uart == NULL) { + if (MP_STATE_PORT(pyb_stdio_uart) == NULL) { return mp_const_none; } else { - return pyb_stdio_uart; + return MP_STATE_PORT(pyb_stdio_uart); } } else { if (args[0] == mp_const_none) { - pyb_stdio_uart = NULL; + MP_STATE_PORT(pyb_stdio_uart) = NULL; } else if (mp_obj_get_type(args[0]) == &pyb_uart_type) { - pyb_stdio_uart = args[0]; + MP_STATE_PORT(pyb_stdio_uart) = args[0]; } else { nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "need a UART object")); } |