Home | History | Annotate | Download | only in rtl

Lines Matching defs:thr

70 void AllocatorThreadStart(ThreadState *thr) {
71 allocator()->InitCache(&thr->alloc_cache);
72 internal_allocator()->InitCache(&thr->internal_alloc_cache);
75 void AllocatorThreadFinish(ThreadState *thr) {
76 allocator()->DestroyCache(&thr->alloc_cache);
77 internal_allocator()->DestroyCache(&thr->internal_alloc_cache);
84 static void SignalUnsafeCall(ThreadState *thr, uptr pc) {
85 if (atomic_load_relaxed(&thr->in_signal_handler) == 0 ||
89 ObtainCurrentStack(thr, pc, &stack);
95 OutputReport(thr, rep);
98 void *user_alloc(ThreadState *thr, uptr pc, uptr sz, uptr align, bool signal) {
101 void *p = allocator()->Allocate(&thr->alloc_cache, sz, align);
105 OnUserAlloc(thr, pc, (uptr)p, sz, true);
107 SignalUnsafeCall(thr, pc);
111 void *user_calloc(ThreadState *thr, uptr pc, uptr size, uptr n) {
114 void *p = user_alloc(thr, pc, n * size);
120 void user_free(ThreadState *thr, uptr pc, void *p, bool signal) {
122 OnUserFree(thr, pc, (uptr)p, true);
123 allocator()->Deallocate(&thr->alloc_cache, p);
125 SignalUnsafeCall(thr, pc);
128 void OnUserAlloc(ThreadState *thr, uptr pc, uptr p, uptr sz, bool write) {
129 DPrintf("#%d: alloc(%zu) = %p\n", thr->tid, sz, p);
130 ctx->metamap.AllocBlock(thr, pc, p, sz);
131 if (write && thr->ignore_reads_and_writes == 0)
132 MemoryRangeImitateWrite(thr, pc, (uptr)p, sz);
134 MemoryResetRange(thr, pc, (uptr)p, sz);
137 void OnUserFree(ThreadState *thr, uptr pc, uptr p, bool write) {
139 uptr sz = ctx->metamap.FreeBlock(thr, pc, p);
140 DPrintf("#%d: free(%p, %zu)\n", thr->tid, p, sz);
141 if (write && thr->ignore_reads_and_writes == 0)
142 MemoryRangeFreed(thr, pc, (uptr)p, sz);
145 void *user_realloc(ThreadState *thr, uptr pc, void *p, uptr sz) {
150 p2 = user_alloc(thr, pc, sz);
159 user_free(thr, pc, p);
171 ThreadState *thr = cur_thread();
172 if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)
178 ThreadState *thr = cur_thread();
179 if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)
185 ThreadState *thr = cur_thread();
186 if (thr->nomalloc) {
187 thr->nomalloc = 0; // CHECK calls internal_malloc().
190 return InternalAlloc(sz, &thr->internal_alloc_cache);
194 ThreadState *thr = cur_thread();
195 if (thr->nomalloc) {
196 thr->nomalloc = 0; // CHECK calls internal_malloc().
199 InternalFree(p, &thr->internal_alloc_cache);
240 ThreadState *thr = cur_thread();
241 allocator()->SwallowCache(&thr->alloc_cache);
242 internal_allocator()->SwallowCache(&thr->internal_alloc_cache);
243 ctx->metamap.OnThreadIdle(thr);