From 3c658a4e755a75e495303957208486e583ddb270 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 24 Aug 2014 16:28:17 +0100 Subject: py: Fix bug where GC collected native/viper/asm function data. Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820. --- stmhal/help.c | 1 - stmhal/mpconfigport.h | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'stmhal') diff --git a/stmhal/help.c b/stmhal/help.c index 598b6f4e3..fe143441d 100644 --- a/stmhal/help.c +++ b/stmhal/help.c @@ -119,5 +119,4 @@ STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) { return mp_const_none; } - MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help); diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index f51ba0d62..5ace34ff1 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -64,9 +64,9 @@ void disable_irq(void); #define MICROPY_END_ATOMIC_SECTION() enable_irq() // extra built in names to add to the global namespace -extern const struct _mp_obj_fun_native_t mp_builtin_help_obj; -extern const struct _mp_obj_fun_native_t mp_builtin_input_obj; -extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_help_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj; #define MICROPY_PORT_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ @@ -92,6 +92,8 @@ extern const struct _mp_obj_module_t time_module; #define BYTES_PER_WORD (4) +#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) + #define UINT_FMT "%u" #define INT_FMT "%d" -- cgit v1.2.3