Lines Matching refs:thr

27   , thr()  in ThreadContext()
49 ThreadState *thr; member
54 thr = 0; in OnCreated()
58 args->thr->fast_state.IncrementEpoch(); in OnCreated()
60 TraceAddEvent(args->thr, args->thr->fast_state, EventTypeMop, 0); in OnCreated()
61 ReleaseImpl(args->thr, 0, &sync); in OnCreated()
62 creation_stack_id = CurrentStackId(args->thr, args->pc); in OnCreated()
64 StatInc(args->thr, StatThreadMaxTid); in OnCreated()
79 ThreadState *thr; member
88 thr = args->thr; in OnStarted()
93 new(thr) ThreadState(ctx, tid, unique_id, epoch0, reuse_count, in OnStarted()
96 thr->shadow_stack = &ThreadTrace(thr->tid)->shadow_stack[0]; in OnStarted()
97 thr->shadow_stack_pos = thr->shadow_stack; in OnStarted()
98 thr->shadow_stack_end = thr->shadow_stack + kShadowStackSize; in OnStarted()
102 thr->shadow_stack = (uptr*)internal_alloc(MBlockShadowStack, in OnStarted()
104 thr->shadow_stack_pos = thr->shadow_stack; in OnStarted()
105 thr->shadow_stack_end = thr->shadow_stack + kInitStackSize; in OnStarted()
108 AllocatorThreadStart(thr); in OnStarted()
111 thr->dd_pt = ctx->dd->CreatePhysicalThread(); in OnStarted()
112 thr->dd_lt = ctx->dd->CreateLogicalThread(unique_id); in OnStarted()
114 thr->fast_state.SetHistorySize(flags()->history_size); in OnStarted()
117 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0); in OnStarted()
119 thr->fast_synch_epoch = epoch0; in OnStarted()
120 AcquireImpl(thr, 0, &sync); in OnStarted()
121 StatInc(thr, StatSyncAcquire); in OnStarted()
122 sync.Reset(&thr->clock_cache); in OnStarted()
123 thr->is_inited = true; in OnStarted()
132 thr->fast_state.IncrementEpoch(); in OnFinished()
134 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0); in OnFinished()
135 ReleaseImpl(thr, 0, &sync); in OnFinished()
137 epoch1 = thr->fast_state.epoch(); in OnFinished()
140 ctx->dd->DestroyPhysicalThread(thr->dd_pt); in OnFinished()
141 ctx->dd->DestroyLogicalThread(thr->dd_lt); in OnFinished()
143 ctx->clock_alloc.FlushCache(&thr->clock_cache); in OnFinished()
144 ctx->metamap.OnThreadIdle(thr); in OnFinished()
146 AllocatorThreadFinish(thr); in OnFinished()
148 thr->~ThreadState(); in OnFinished()
150 StatAggregate(ctx->stat, thr->stat); in OnFinished()
152 thr = 0; in OnFinished()
195 static void ThreadCheckIgnore(ThreadState *thr) { in ThreadCheckIgnore() argument
198 if (thr->ignore_reads_and_writes) in ThreadCheckIgnore()
199 ReportIgnoresEnabled(thr->tctx, &thr->mop_ignore_set); in ThreadCheckIgnore()
200 if (thr->ignore_sync) in ThreadCheckIgnore()
201 ReportIgnoresEnabled(thr->tctx, &thr->sync_ignore_set); in ThreadCheckIgnore()
204 static void ThreadCheckIgnore(ThreadState *thr) {} in ThreadCheckIgnore() argument
207 void ThreadFinalize(ThreadState *thr) { in ThreadFinalize() argument
208 ThreadCheckIgnore(thr); in ThreadFinalize()
220 OutputReport(thr, rep); in ThreadFinalize()
225 int ThreadCount(ThreadState *thr) { in ThreadCount() argument
231 int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) { in ThreadCreate() argument
232 StatInc(thr, StatThreadCreate); in ThreadCreate()
233 OnCreatedArgs args = { thr, pc }; in ThreadCreate()
234 int tid = ctx->thread_registry->CreateThread(uid, detached, thr->tid, &args); in ThreadCreate()
235 DPrintf("#%d: ThreadCreate tid=%d uid=%zu\n", thr->tid, tid, uid); in ThreadCreate()
236 StatSet(thr, StatThreadMaxAlive, ctx->thread_registry->GetMaxAliveThreads()); in ThreadCreate()
240 void ThreadStart(ThreadState *thr, int tid, uptr os_id) { in ThreadStart() argument
250 MemoryRangeImitateWrite(thr, /*pc=*/ 1, stk_addr, stk_size); in ThreadStart()
254 const uptr thr_beg = (uptr)thr; in ThreadStart()
255 const uptr thr_end = (uptr)thr + sizeof(*thr); in ThreadStart()
261 MemoryRangeImitateWrite(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr); in ThreadStart()
262 MemoryRangeImitateWrite(thr, /*pc=*/ 2, in ThreadStart()
269 OnStartedArgs args = { thr, stk_addr, stk_size, tls_addr, tls_size }; in ThreadStart()
273 thr->tctx = (ThreadContext*)tr->GetThreadLocked(tid); in ThreadStart()
278 thr->ignore_interceptors++; in ThreadStart()
279 ThreadIgnoreBegin(thr, 0); in ThreadStart()
280 ThreadIgnoreSyncBegin(thr, 0); in ThreadStart()
285 void ThreadFinish(ThreadState *thr) { in ThreadFinish() argument
286 ThreadCheckIgnore(thr); in ThreadFinish()
287 StatInc(thr, StatThreadFinish); in ThreadFinish()
288 if (thr->stk_addr && thr->stk_size) in ThreadFinish()
289 DontNeedShadowFor(thr->stk_addr, thr->stk_size); in ThreadFinish()
290 if (thr->tls_addr && thr->tls_size) in ThreadFinish()
291 DontNeedShadowFor(thr->tls_addr, thr->tls_size); in ThreadFinish()
292 thr->is_dead = true; in ThreadFinish()
293 ctx->thread_registry->FinishThread(thr->tid); in ThreadFinish()
305 int ThreadTid(ThreadState *thr, uptr pc, uptr uid) { in ThreadTid() argument
307 DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res); in ThreadTid()
311 void ThreadJoin(ThreadState *thr, uptr pc, int tid) { in ThreadJoin() argument
314 DPrintf("#%d: ThreadJoin tid=%d\n", thr->tid, tid); in ThreadJoin()
315 ctx->thread_registry->JoinThread(tid, thr); in ThreadJoin()
318 void ThreadDetach(ThreadState *thr, uptr pc, int tid) { in ThreadDetach() argument
321 ctx->thread_registry->DetachThread(tid, thr); in ThreadDetach()
324 void ThreadSetName(ThreadState *thr, const char *name) { in ThreadSetName() argument
325 ctx->thread_registry->SetThreadName(thr->tid, name); in ThreadSetName()
328 void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr, in MemoryAccessRange() argument
335 thr->tid, (void*)pc, (void*)addr, in MemoryAccessRange()
358 StatInc(thr, StatMopRange); in MemoryAccessRange()
363 StatInc(thr, StatMopRangeRodata); in MemoryAccessRange()
367 FastState fast_state = thr->fast_state; in MemoryAccessRange()
372 thr->fast_state = fast_state; in MemoryAccessRange()
373 TraceAddEvent(thr, fast_state, EventTypeMop, pc); in MemoryAccessRange()
383 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false, in MemoryAccessRange()
394 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false, in MemoryAccessRange()
404 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false, in MemoryAccessRange()