Lines Matching refs:th

46 static void bpool(kmp_info_t *th, void *buffer, bufsize len);
47 static void *bget(kmp_info_t *th, bufsize size);
48 static void *bgetz(kmp_info_t *th, bufsize size);
49 static void *bgetr(kmp_info_t *th, void *buffer, bufsize newsize);
50 static void brel(kmp_info_t *th, void *buf);
51 static void bectl(kmp_info_t *th, bget_compact_t compact,
227 static void set_thr_data(kmp_info_t *th) { in set_thr_data() argument
231 data = (thr_data_t *)((!th->th.th_local.bget_data) in set_thr_data()
233 : th->th.th_local.bget_data); in set_thr_data()
242 th->th.th_local.bget_data = data; in set_thr_data()
243 th->th.th_local.bget_list = 0; in set_thr_data()
246 __kmp_init_lock(&th->th.th_local.bget_lock); in set_thr_data()
248 __kmp_init_bootstrap_lock(&th->th.th_local.bget_lock); in set_thr_data()
253 static thr_data_t *get_thr_data(kmp_info_t *th) { in get_thr_data() argument
256 data = (thr_data_t *)th->th.th_local.bget_data; in get_thr_data()
264 static void __kmp_bget_dequeue(kmp_info_t *th) { in __kmp_bget_dequeue() argument
265 void *p = TCR_SYNC_PTR(th->th.th_local.bget_list); in __kmp_bget_dequeue()
270 volatile void *old_value = TCR_SYNC_PTR(th->th.th_local.bget_list); in __kmp_bget_dequeue()
271 while (!KMP_COMPARE_AND_STORE_PTR(&th->th.th_local.bget_list, in __kmp_bget_dequeue()
274 old_value = TCR_SYNC_PTR(th->th.th_local.bget_list); in __kmp_bget_dequeue()
280 __kmp_acquire_lock(&th->th.th_local.bget_lock, __kmp_gtid_from_thread(th)); in __kmp_bget_dequeue()
282 __kmp_acquire_bootstrap_lock(&th->th.th_local.bget_lock); in __kmp_bget_dequeue()
285 p = (void *)th->th.th_local.bget_list; in __kmp_bget_dequeue()
286 th->th.th_local.bget_list = 0; in __kmp_bget_dequeue()
289 __kmp_release_lock(&th->th.th_local.bget_lock, __kmp_gtid_from_thread(th)); in __kmp_bget_dequeue()
291 __kmp_release_bootstrap_lock(&th->th.th_local.bget_lock); in __kmp_bget_dequeue()
302 (kmp_uintptr_t)th); // clear possible mark in __kmp_bget_dequeue()
307 brel(th, buf); in __kmp_bget_dequeue()
313 static void __kmp_bget_enqueue(kmp_info_t *th, void *buf in __kmp_bget_enqueue() argument
323 (kmp_uintptr_t)th); // clear possible mark in __kmp_bget_enqueue()
328 __kmp_gtid_from_thread(th))); in __kmp_bget_enqueue()
332 volatile void *old_value = TCR_PTR(th->th.th_local.bget_list); in __kmp_bget_enqueue()
337 while (!KMP_COMPARE_AND_STORE_PTR(&th->th.th_local.bget_list, in __kmp_bget_enqueue()
340 old_value = TCR_PTR(th->th.th_local.bget_list); in __kmp_bget_enqueue()
348 __kmp_acquire_lock(&th->th.th_local.bget_lock, rel_gtid); in __kmp_bget_enqueue()
350 __kmp_acquire_bootstrap_lock(&th->th.th_local.bget_lock); in __kmp_bget_enqueue()
353 b->ql.flink = BFH(th->th.th_local.bget_list); in __kmp_bget_enqueue()
354 th->th.th_local.bget_list = (void *)buf; in __kmp_bget_enqueue()
357 __kmp_release_lock(&th->th.th_local.bget_lock, rel_gtid); in __kmp_bget_enqueue()
359 __kmp_release_bootstrap_lock(&th->th.th_local.bget_lock); in __kmp_bget_enqueue()
395 static void bcheck(kmp_info_t *th, bufsize *max_free, bufsize *total_free) { in bcheck() argument
396 thr_data_t *thr = get_thr_data(th); in bcheck()
425 static void *bget(kmp_info_t *th, bufsize requested_size) { in bget() argument
426 thr_data_t *thr = get_thr_data(th); in bget()
439 __kmp_bget_dequeue(th); /* Release any queued buffers */ in bget()
515 th); // not an allocated address (do not mark it) in bget()
548 TCW_PTR(ba->bb.bthr, th); // not an allocated address (do not mark) in bget()
595 TCW_PTR(bdh->bh.bb.bthr, th); // don't mark buffer as allocated, in bget()
620 bpool(th, newpool, thr->exp_incr); in bget()
622 th, requested_size); /* This can't, I say, can't get into a loop. */ in bget()
637 static void *bgetz(kmp_info_t *th, bufsize size) { in bgetz() argument
638 char *buf = (char *)bget(th, size); in bgetz()
667 static void *bgetr(kmp_info_t *th, void *buf, bufsize size) { in bgetr() argument
672 nbuf = bget(th, size); in bgetr()
695 brel(th, buf); in bgetr()
701 static void brel(kmp_info_t *th, void *buf) { in brel() argument
702 thr_data_t *thr = get_thr_data(th); in brel()
734 if (bth != th) { in brel()
739 __kmp_gtid_from_thread(th) in brel()
865 static void bectl(kmp_info_t *th, bget_compact_t compact, in bectl() argument
868 thr_data_t *thr = get_thr_data(th); in bectl()
877 static void bpool(kmp_info_t *th, void *buf, bufsize len) { in bpool() argument
879 thr_data_t *thr = get_thr_data(th); in bpool()
883 __kmp_bget_dequeue(th); /* Release any queued buffers */ in bpool()
920 (kmp_info_t *)((kmp_uintptr_t)th | in bpool()
939 static void bfreed(kmp_info_t *th) { in bfreed() argument
941 int gtid = __kmp_gtid_from_thread(th); in bfreed()
942 thr_data_t *thr = get_thr_data(th); in bfreed()
992 void __kmp_initialize_bget(kmp_info_t *th) { in __kmp_initialize_bget() argument
993 KMP_DEBUG_ASSERT(SizeQuant >= sizeof(void *) && (th != 0)); in __kmp_initialize_bget()
995 set_thr_data(th); in __kmp_initialize_bget()
997 bectl(th, (bget_compact_t)0, (bget_acquire_t)malloc, (bget_release_t)free, in __kmp_initialize_bget()
1001 void __kmp_finalize_bget(kmp_info_t *th) { in __kmp_finalize_bget() argument
1005 KMP_DEBUG_ASSERT(th != 0); in __kmp_finalize_bget()
1008 thr = (thr_data_t *)th->th.th_local.bget_data; in __kmp_finalize_bget()
1037 if (th->th.th_local.bget_data != NULL) { in __kmp_finalize_bget()
1038 __kmp_free(th->th.th_local.bget_data); in __kmp_finalize_bget()
1039 th->th.th_local.bget_data = NULL; in __kmp_finalize_bget()
1075 kmp_info_t *th = __kmp_get_thread(); in kmpc_get_poolstat() local
1078 __kmp_bget_dequeue(th); /* Release any queued buffers */ in kmpc_get_poolstat()
1080 bcheck(th, &a, &b); in kmpc_get_poolstat()
1087 kmp_info_t *th = __kmp_get_thread(); in kmpc_poolprint() local
1089 __kmp_bget_dequeue(th); /* Release any queued buffers */ in kmpc_poolprint()
1091 bfreed(th); in kmpc_poolprint()
1177 kmp_info_t *th = __kmp_get_thread(); in kmpc_free() local
1178 __kmp_bget_dequeue(th); /* Release any queued buffers */ in kmpc_free()
1181 brel(th, *((void **)ptr - 1)); in kmpc_free()
1185 void *___kmp_thread_malloc(kmp_info_t *th, size_t size KMP_SRC_LOC_DECL) { in ___kmp_thread_malloc() argument
1187 KE_TRACE(30, ("-> __kmp_thread_malloc( %p, %d ) called from %s:%d\n", th, in ___kmp_thread_malloc()
1189 ptr = bget(th, (bufsize)size); in ___kmp_thread_malloc()
1194 void *___kmp_thread_calloc(kmp_info_t *th, size_t nelem, in ___kmp_thread_calloc() argument
1197 KE_TRACE(30, ("-> __kmp_thread_calloc( %p, %d, %d ) called from %s:%d\n", th, in ___kmp_thread_calloc()
1199 ptr = bgetz(th, (bufsize)(nelem * elsize)); in ___kmp_thread_calloc()
1204 void *___kmp_thread_realloc(kmp_info_t *th, void *ptr, in ___kmp_thread_realloc() argument
1206 KE_TRACE(30, ("-> __kmp_thread_realloc( %p, %p, %d ) called from %s:%d\n", th, in ___kmp_thread_realloc()
1208 ptr = bgetr(th, ptr, (bufsize)size); in ___kmp_thread_realloc()
1213 void ___kmp_thread_free(kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL) { in ___kmp_thread_free() argument
1214 KE_TRACE(30, ("-> __kmp_thread_free( %p, %p ) called from %s:%d\n", th, in ___kmp_thread_free()
1217 __kmp_bget_dequeue(th); /* Release any queued buffers */ in ___kmp_thread_free()
1218 brel(th, ptr); in ___kmp_thread_free()
1429 __kmp_threads[gtid]->th.th_def_allocator = allocator; in __kmpc_set_default_allocator()
1433 return __kmp_threads[gtid]->th.th_def_allocator; in __kmpc_get_default_allocator()
1454 allocator = __kmp_threads[gtid]->th.th_def_allocator; in __kmpc_alloc()
1591 allocator = __kmp_threads[gtid]->th.th_def_allocator; in __kmpc_calloc()
1924 ptr = this_thr->th.th_free_lists[index].th_free_list_self; in ___kmp_fast_allocate()
1927 this_thr->th.th_free_lists[index].th_free_list_self = *((void **)ptr); in ___kmp_fast_allocate()
1934 ptr = TCR_SYNC_PTR(this_thr->th.th_free_lists[index].th_free_list_sync); in ___kmp_fast_allocate()
1940 &this_thr->th.th_free_lists[index].th_free_list_sync, ptr, nullptr)) { in ___kmp_fast_allocate()
1942 ptr = TCR_SYNC_PTR(this_thr->th.th_free_lists[index].th_free_list_sync); in ___kmp_fast_allocate()
1946 this_thr->th.th_free_lists[index].th_free_list_self = *((void **)ptr); in ___kmp_fast_allocate()
2020 *((void **)ptr) = this_thr->th.th_free_lists[index].th_free_list_self; in ___kmp_fast_free()
2021 this_thr->th.th_free_lists[index].th_free_list_self = ptr; in ___kmp_fast_free()
2023 void *head = this_thr->th.th_free_lists[index].th_free_list_other; in ___kmp_fast_free()
2026 this_thr->th.th_free_lists[index].th_free_list_other = ptr; in ___kmp_fast_free()
2041 this_thr->th.th_free_lists[index].th_free_list_other = ptr; in ___kmp_fast_free()
2062 old_ptr = TCR_PTR(q_th->th.th_free_lists[index].th_free_list_sync); in ___kmp_fast_free()
2068 &q_th->th.th_free_lists[index].th_free_list_sync, old_ptr, head)) { in ___kmp_fast_free()
2070 old_ptr = TCR_PTR(q_th->th.th_free_lists[index].th_free_list_sync); in ___kmp_fast_free()
2075 this_thr->th.th_free_lists[index].th_free_list_other = ptr; in ___kmp_fast_free()
2099 memset(this_thr->th.th_free_lists, 0, NUM_LISTS * sizeof(kmp_free_list_t)); in __kmp_initialize_fast_memory()
2104 void __kmp_free_fast_memory(kmp_info_t *th) { in __kmp_free_fast_memory() argument
2107 thr_data_t *thr = get_thr_data(th); in __kmp_free_fast_memory()
2111 5, ("__kmp_free_fast_memory: Called T#%d\n", __kmp_gtid_from_thread(th))); in __kmp_free_fast_memory()
2113 __kmp_bget_dequeue(th); // Release any queued buffers in __kmp_free_fast_memory()
2130 lst, next, th, __kmp_gtid_from_thread(th))); in __kmp_free_fast_memory()
2141 5, ("__kmp_free_fast_memory: Freed T#%d\n", __kmp_gtid_from_thread(th))); in __kmp_free_fast_memory()