diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/obj.c | 2 | ||||
-rw-r--r-- | py/objfun.c | 2 | ||||
-rw-r--r-- | py/runtime.c | 2 | ||||
-rw-r--r-- | py/stackctrl.c | 12 | ||||
-rw-r--r-- | py/stackctrl.h | 14 |
5 files changed, 16 insertions, 16 deletions
@@ -61,7 +61,7 @@ void printf_wrapper(void *env, const char *fmt, ...) { void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { // There can be data structures nested too deep, or just recursive - STACK_CHECK(); + MP_STACK_CHECK(); #if !NDEBUG if (o_in == NULL) { print(env, "(nil)"); diff --git a/py/objfun.c b/py/objfun.c index f75e9142a2..74e959f9d3 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -356,7 +356,7 @@ continue2:; STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { - STACK_CHECK(); + MP_STACK_CHECK(); DEBUG_printf("Input n_args: %d, n_kw: %d\n", n_args, n_kw); DEBUG_printf("Input pos args: "); diff --git a/py/runtime.c b/py/runtime.c index f08ff9ff40..5490bcbac5 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -70,7 +70,7 @@ const mp_obj_module_t mp_module___main__ = { }; void mp_init(void) { - stack_ctrl_init(); + mp_stack_ctrl_init(); // call port specific initialization if any #ifdef MICROPY_PORT_INIT_FUNC diff --git a/py/stackctrl.c b/py/stackctrl.c index aef9bad9e9..724d54a1be 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -35,12 +35,12 @@ // Stack top at the start of program char *stack_top; -void stack_ctrl_init() { +void mp_stack_ctrl_init() { volatile int stack_dummy; stack_top = (char*)&stack_dummy; } -uint stack_usage() { +uint mp_stack_usage() { // Assumes descending stack volatile int stack_dummy; return stack_top - (char*)&stack_dummy; @@ -48,14 +48,14 @@ uint stack_usage() { #if MICROPY_STACK_CHECK -uint stack_limit = 10240; +static uint stack_limit = 10240; -void stack_set_limit(uint limit) { +void mp_stack_set_limit(uint limit) { stack_limit = limit; } -void stack_check() { - if (stack_usage() >= stack_limit) { +void mp_stack_check() { + if (mp_stack_usage() >= stack_limit) { nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "maximum recursion depth exceeded")); } } diff --git a/py/stackctrl.h b/py/stackctrl.h index a9a8d2e2d8..92de882bfa 100644 --- a/py/stackctrl.h +++ b/py/stackctrl.h @@ -24,18 +24,18 @@ * THE SOFTWARE. */ -void stack_ctrl_init(); -uint stack_usage(); +void mp_stack_ctrl_init(); +uint mp_stack_usage(); #if MICROPY_STACK_CHECK -void stack_set_limit(uint limit); -void stack_check(); -#define STACK_CHECK() stack_check() +void mp_stack_set_limit(uint limit); +void mp_stack_check(); +#define MP_STACK_CHECK() mp_stack_check() #else -#define stack_set_limit(limit) -#define STACK_CHECK() +#define mp_stack_set_limit(limit) +#define MP_STACK_CHECK() #endif |