enable more reset delay slots

This commit is contained in:
daan 2019-11-11 17:06:16 -08:00
parent 5e6754f3f7
commit a0958b2da6
5 changed files with 66 additions and 32 deletions

View file

@ -100,8 +100,8 @@ static mi_tld_t tld_main = {
0, false,
&_mi_heap_main,
{ { NULL, NULL }, {NULL ,NULL}, 0, 0, 0, 0, 0, 0, NULL, tld_main_stats, tld_main_os }, // segments
{ 0, tld_main_stats, {{0,NULL,0}} }, // os
{ MI_STATS_NULL } // stats
{ 0, NULL, tld_main_stats }, // os
{ MI_STATS_NULL } // stats
};
mi_heap_t _mi_heap_main = {
@ -192,6 +192,7 @@ uintptr_t _mi_random_init(uintptr_t seed /* can be zero */) {
typedef struct mi_thread_data_s {
mi_heap_t heap; // must come first due to cast in `_mi_heap_done`
mi_tld_t tld;
mi_delay_slots_t reset_delay;
} mi_thread_data_t;
// Initialize the thread local default heap, called from `mi_thread_init`
@ -211,6 +212,7 @@ static bool _mi_heap_init(void) {
}
mi_tld_t* tld = &td->tld;
mi_heap_t* heap = &td->heap;
mi_delay_slots_t* reset_delay = &td->reset_delay;
memcpy(heap, &_mi_heap_empty, sizeof(*heap));
heap->thread_id = _mi_thread_id();
heap->random = _mi_random_init(heap->thread_id);
@ -221,6 +223,9 @@ static bool _mi_heap_init(void) {
tld->segments.stats = &tld->stats;
tld->segments.os = &tld->os;
tld->os.stats = &tld->stats;
tld->os.reset_delay = reset_delay;
memset(reset_delay, 0, sizeof(*reset_delay));
reset_delay->capacity = MI_RESET_DELAY_SLOTS;
_mi_heap_default = heap;
}
return false;