Lines Matching refs:MP_STATE_MEM

78 #define ATB_GET_KIND(block) ((MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] >> BLOCK…
79 #define ATB_ANY_TO_FREE(block) do { MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] &=…
80 #define ATB_FREE_TO_HEAD(block) do { MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] |…
81 #define ATB_FREE_TO_TAIL(block) do { MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] |…
82 #define ATB_HEAD_TO_MARK(block) do { MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] |…
83 #define ATB_MARK_TO_HEAD(block) do { MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] &…
85 #define BLOCK_FROM_PTR(ptr) (((byte *)(ptr) - MP_STATE_MEM(gc_pool_start)) / BYTES_PER_BLOCK)
86 #define PTR_FROM_BLOCK(block) (((block) * BYTES_PER_BLOCK + (uintptr_t)MP_STATE_MEM(gc_pool_start)))
95 #define FTB_GET(block) ((MP_STATE_MEM(gc_finaliser_table_start)[(block) / BLOCKS_PER_FTB] >> ((bloc…
96 #define FTB_SET(block) do { MP_STATE_MEM(gc_finaliser_table_start)[(block) / BLOCKS_PER_FTB] |= (1 …
97 #define FTB_CLEAR(block) do { MP_STATE_MEM(gc_finaliser_table_start)[(block) / BLOCKS_PER_FTB] &= (…
101 #define GC_ENTER() mp_thread_mutex_lock(&MP_STATE_MEM(gc_mutex), 1)
102 #define GC_EXIT() mp_thread_mutex_unlock(&MP_STATE_MEM(gc_mutex))
121MP_STATE_MEM(gc_alloc_table_byte_len) = total_byte_len * MP_BITS_PER_BYTE / (MP_BITS_PER_BYTE + MP… in gc_init()
123MP_STATE_MEM(gc_alloc_table_byte_len) = total_byte_len / (1 + MP_BITS_PER_BYTE / 2 * BYTES_PER_BLO… in gc_init()
126 MP_STATE_MEM(gc_alloc_table_start) = (byte *)start; in gc_init()
129 …size_t gc_finaliser_table_byte_len = (MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB + BLO… in gc_init()
130MP_STATE_MEM(gc_finaliser_table_start) = MP_STATE_MEM(gc_alloc_table_start) + MP_STATE_MEM(gc_allo… in gc_init()
133 size_t gc_pool_block_len = MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; in gc_init()
134 MP_STATE_MEM(gc_pool_start) = (byte *)end - gc_pool_block_len * BYTES_PER_BLOCK; in gc_init()
135 MP_STATE_MEM(gc_pool_end) = end; in gc_init()
138 …assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_… in gc_init()
142 memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len)); in gc_init()
146 memset(MP_STATE_MEM(gc_finaliser_table_start), 0, gc_finaliser_table_byte_len); in gc_init()
150 MP_STATE_MEM(gc_last_free_atb_index) = 0; in gc_init()
153 MP_STATE_MEM(gc_lock_depth) = 0; in gc_init()
156 MP_STATE_MEM(gc_auto_collect_enabled) = 1; in gc_init()
160 MP_STATE_MEM(gc_alloc_threshold) = (size_t)-1; in gc_init()
161 MP_STATE_MEM(gc_alloc_amount) = 0; in gc_init()
165 mp_thread_mutex_init(&MP_STATE_MEM(gc_mutex)); in gc_init()
169 …" bytes, " UINT_FMT " blocks\n", MP_STATE_MEM(gc_alloc_table_start), MP_STATE_MEM(gc_alloc_table_b… in gc_init()
171 …liser table at %p, length " UINT_FMT " bytes, " UINT_FMT " blocks\n", MP_STATE_MEM(gc_finaliser_ta… in gc_init()
173 …DEBUG_printf(" pool at %p, length " UINT_FMT " bytes, " UINT_FMT " blocks\n", MP_STATE_MEM(gc_poo… in gc_init()
178 MP_STATE_MEM(gc_lock_depth)++; in gc_lock()
184 MP_STATE_MEM(gc_lock_depth)--; in gc_unlock()
189 return MP_STATE_MEM(gc_lock_depth) != 0; in gc_is_locked()
195 && ptr >= (void *)MP_STATE_MEM(gc_pool_start) /* must be above start of pool */ \
196 && ptr < (void *)MP_STATE_MEM(gc_pool_end) /* must be below end of pool */ \
233 MP_STATE_MEM(gc_stack)[sp++] = childblock; in gc_mark_subtree()
235 MP_STATE_MEM(gc_stack_overflow) = 1; in gc_mark_subtree()
247 block = MP_STATE_MEM(gc_stack)[--sp]; in gc_mark_subtree()
252 while (MP_STATE_MEM(gc_stack_overflow)) { in gc_deal_with_stack_overflow()
253 MP_STATE_MEM(gc_stack_overflow) = 0; in gc_deal_with_stack_overflow()
256 … for (size_t block = 0; block < MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; block++) { in gc_deal_with_stack_overflow()
267 MP_STATE_MEM(gc_collected) = 0; in gc_sweep()
271 … for (size_t block = 0; block < MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; block++) { in gc_sweep()
299 MP_STATE_MEM(gc_collected)++; in gc_sweep()
323 MP_STATE_MEM(gc_lock_depth)++; in gc_collect_start()
325 MP_STATE_MEM(gc_alloc_amount) = 0; in gc_collect_start()
327 MP_STATE_MEM(gc_stack_overflow) = 0; in gc_collect_start()
362 MP_STATE_MEM(gc_last_free_atb_index) = 0; in gc_collect_end()
363 MP_STATE_MEM(gc_lock_depth)--; in gc_collect_end()
369 MP_STATE_MEM(gc_lock_depth)++; in gc_sweep_all()
370 MP_STATE_MEM(gc_stack_overflow) = 0; in gc_sweep_all()
376 info->total = MP_STATE_MEM(gc_pool_end) - MP_STATE_MEM(gc_pool_start); in gc_info()
409 finish = (block == MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB); in gc_info()
451 if (MP_STATE_MEM(gc_lock_depth) > 0) { in gc_alloc()
460 int collected = !MP_STATE_MEM(gc_auto_collect_enabled); in gc_alloc()
463 if (!collected && MP_STATE_MEM(gc_alloc_amount) >= MP_STATE_MEM(gc_alloc_threshold)) { in gc_alloc()
475 … for (i = MP_STATE_MEM(gc_last_free_atb_index); i < MP_STATE_MEM(gc_alloc_table_byte_len); i++) { in gc_alloc()
476 byte a = MP_STATE_MEM(gc_alloc_table_start)[i]; in gc_alloc()
508 MP_STATE_MEM(gc_last_free_atb_index) = (i + 1) / BLOCKS_PER_ATB; in gc_alloc()
522 void *ret_ptr = (void *)(MP_STATE_MEM(gc_pool_start) + start_block * BYTES_PER_BLOCK); in gc_alloc()
526 MP_STATE_MEM(gc_alloc_amount) += n_blocks; in gc_alloc()
577 if (MP_STATE_MEM(gc_lock_depth) > 0) { in gc_free()
598 if (block / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) { in gc_free()
599 MP_STATE_MEM(gc_last_free_atb_index) = block / BLOCKS_PER_ATB; in gc_free()
681 if (MP_STATE_MEM(gc_lock_depth) > 0) { in gc_realloc()
702 size_t max_block = MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; in gc_realloc()
734 if ((block + new_blocks) / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) { in gc_realloc()
735 MP_STATE_MEM(gc_last_free_atb_index) = (block + new_blocks) / BLOCKS_PER_ATB; in gc_realloc()
815 mp_printf(&mp_plat_print, "GC memory layout; from %p:", MP_STATE_MEM(gc_pool_start)); in gc_dump_alloc_table()
817 for (size_t bl = 0; bl < MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; bl++) { in gc_dump_alloc_table()
823 …while (bl2 < MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB && ATB_GET_KIND(bl2) == AT_FRE… in gc_dump_alloc_table()
830 if (bl >= MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB) { in gc_dump_alloc_table()
874 void **ptr = (void **)(MP_STATE_MEM(gc_pool_start) + bl * BYTES_PER_BLOCK); in gc_dump_alloc_table()