Home | History | Annotate | Download | only in rtl

Lines Matching defs:thr

58 void AllocatorThreadStart(ThreadState *thr) {
59 allocator()->InitCache(&thr->alloc_cache);
60 internal_allocator()->InitCache(&thr->internal_alloc_cache);
63 void AllocatorThreadFinish(ThreadState *thr) {
64 allocator()->DestroyCache(&thr->alloc_cache);
65 internal_allocator()->DestroyCache(&thr->internal_alloc_cache);
72 static void SignalUnsafeCall(ThreadState *thr, uptr pc) {
73 if (!thr->in_signal_handler || !flags()->report_signal_unsafe)
76 stack.ObtainCurrent(thr, pc);
81 OutputReport(thr, rep);
85 void *user_alloc(ThreadState *thr, uptr pc, uptr sz, uptr align) {
88 void *p = allocator()->Allocate(&thr->alloc_cache, sz, align);
92 OnUserAlloc(thr, pc, (uptr)p, sz, true);
93 SignalUnsafeCall(thr, pc);
97 void user_free(ThreadState *thr, uptr pc, void *p) {
99 OnUserFree(thr, pc, (uptr)p, true);
100 allocator()->Deallocate(&thr->alloc_cache, p);
101 SignalUnsafeCall(thr, pc);
104 void OnUserAlloc(ThreadState *thr, uptr pc, uptr p, uptr sz, bool write) {
105 DPrintf("#%d: alloc(%zu) = %p\n", thr->tid, sz, p);
106 ctx->metamap.AllocBlock(thr, pc, p, sz);
107 if (write && thr->ignore_reads_and_writes == 0)
108 MemoryRangeImitateWrite(thr, pc, (uptr)p, sz);
110 MemoryResetRange(thr, pc, (uptr)p, sz);
113 void OnUserFree(ThreadState *thr, uptr pc, uptr p, bool write) {
115 uptr sz = ctx->metamap.FreeBlock(thr, pc, p);
116 DPrintf("#%d: free(%p, %zu)\n", thr->tid, p, sz);
117 if (write && thr->ignore_reads_and_writes == 0)
118 MemoryRangeFreed(thr, pc, (uptr)p, sz);
121 void *user_realloc(ThreadState *thr, uptr pc, void *p, uptr sz) {
126 p2 = user_alloc(thr, pc, sz);
135 user_free(thr, pc, p);
147 ThreadState *thr = cur_thread();
148 if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)
155 ThreadState *thr = cur_thread();
156 if (ctx == 0 || !ctx->initialized || thr->ignore_interceptors)
163 ThreadState *thr = cur_thread();
165 if (thr->nomalloc) {
166 thr->nomalloc = 0; // CHECK calls internal_malloc().
169 return InternalAlloc(sz, &thr->internal_alloc_cache);
173 ThreadState *thr = cur_thread();
174 if (thr->nomalloc) {
175 thr->nomalloc = 0; // CHECK calls internal_malloc().
178 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);