diff options
| author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-12-09 17:30:55 +0200 |
|---|---|---|
| committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-12-09 17:32:16 +0200 |
| commit | a35d923cdf5a94ef9a29645f9dd461479dc819ce (patch) | |
| tree | 8d7967e9650651f37099880e9ee84df1bb2adf7c /py/map.c | |
| parent | 2b00181592b23e5ca97464791c1ffa56e9495489 (diff) | |
py/map: Allow to trace rehashing operations.
Diffstat (limited to 'py/map.c')
| -rw-r--r-- | py/map.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -33,6 +33,13 @@ #include "py/misc.h" #include "py/runtime.h" +#if MICROPY_DEBUG_VERBOSE // print debugging info +#define DEBUG_PRINT (1) +#else // don't print debugging info +#define DEBUG_PRINT (0) +#define DEBUG_printf(...) (void)0 +#endif + // Fixed empty map. Useful when need to call kw-receiving functions // without any keywords from C, etc. const mp_map_t mp_const_empty_map = { @@ -114,6 +121,7 @@ void mp_map_clear(mp_map_t *map) { STATIC void mp_map_rehash(mp_map_t *map) { size_t old_alloc = map->alloc; size_t new_alloc = get_hash_alloc_greater_or_equal_to(map->alloc + 1); + DEBUG_printf("mp_map_rehash(%p): " UINT_FMT " -> " UINT_FMT "\n", map, old_alloc, new_alloc); mp_map_elem_t *old_table = map->table; mp_map_elem_t *new_table = m_new0(mp_map_elem_t, new_alloc); // If we reach this point, table resizing succeeded, now we can edit the old map. |
