[python] Forbid inlining on gc_collect to avoid missing some roots

This commit is contained in:
Émilie Feral
2020-05-13 15:57:17 +02:00
committed by LeaNumworks
parent 055f8bf1bd
commit 3f5487ca90

View File

@@ -248,7 +248,10 @@ KDColor MicroPython::ColorParser::ParseColor(mp_obj_t input, ColorMode ColorMode
mp_raise_TypeError("Color couldn't be parsed");
}
void gc_collect(void) {
/* Forbid inlining to ensure regs to be at the top of the stack. Otherwise,
* LTO inlining can make regs lower on the stack than some just-allocated
* pointers. */
__attribute__((noinline)) void gc_collect(void) {
void * python_stack_top = MP_STATE_THREAD(stack_top);
assert(python_stack_top != NULL);