py/gc: Use size_t instead of mp_uint_t to count things related to heap.
size_t is the correct type to use to count things related to the size of
the address space. Using size_t (instead of mp_uint_t) is important for
the efficiency of ports that configure mp_uint_t to larger than the
machine word size.
diff --git a/py/mpstate.h b/py/mpstate.h
index e9e3860..c7604e0 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -48,7 +48,7 @@
#endif
byte *gc_alloc_table_start;
- mp_uint_t gc_alloc_table_byte_len;
+ size_t gc_alloc_table_byte_len;
#if MICROPY_ENABLE_FINALISER
byte *gc_finaliser_table_start;
#endif
@@ -56,8 +56,8 @@
byte *gc_pool_end;
int gc_stack_overflow;
- mp_uint_t gc_stack[MICROPY_ALLOC_GC_STACK_SIZE];
- mp_uint_t *gc_sp;
+ size_t gc_stack[MICROPY_ALLOC_GC_STACK_SIZE];
+ size_t *gc_sp;
uint16_t gc_lock_depth;
// This variable controls auto garbage collection. If set to 0 then the
@@ -65,10 +65,10 @@
// you can still allocate/free memory and also explicitly call gc_collect.
uint16_t gc_auto_collect_enabled;
- mp_uint_t gc_last_free_atb_index;
+ size_t gc_last_free_atb_index;
#if MICROPY_PY_GC_COLLECT_RETVAL
- mp_uint_t gc_collected;
+ size_t gc_collected;
#endif
} mp_state_mem_t;