Home | History | Annotate | Download | only in rtl

Lines Matching refs:thr

27   , thr()
49 ThreadState *thr;
54 thr = 0;
58 if (!args->thr) // GCD workers don't have a parent thread.
60 args->thr->fast_state.IncrementEpoch();
62 TraceAddEvent(args->thr, args->thr->fast_state, EventTypeMop, 0);
63 ReleaseImpl(args->thr, 0, &sync);
64 creation_stack_id = CurrentStackId(args->thr, args->pc);
66 StatInc(args->thr, StatThreadMaxTid);
81 ThreadState *thr;
90 thr = args->thr;
95 new(thr) ThreadState(ctx, tid, unique_id, epoch0, reuse_count,
98 thr->shadow_stack = &ThreadTrace(thr->tid)->shadow_stack[0];
99 thr->shadow_stack_pos = thr->shadow_stack;
100 thr->shadow_stack_end = thr->shadow_stack + kShadowStackSize;
104 thr->shadow_stack = (uptr*)internal_alloc(MBlockShadowStack,
106 thr->shadow_stack_pos = thr->shadow_stack;
107 thr->shadow_stack_end = thr->shadow_stack + kInitStackSize;
110 thr->dd_lt = ctx->dd->CreateLogicalThread(unique_id);
111 thr->fast_state.SetHistorySize(flags()->history_size);
114 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
116 thr->fast_synch_epoch = epoch0;
117 AcquireImpl(thr, 0, &sync);
118 StatInc(thr, StatSyncAcquire);
119 sync.Reset(&thr->proc()->clock_cache);
120 thr->is_inited = true;
129 thr->fast_state.IncrementEpoch();
131 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
132 ReleaseImpl(thr, 0, &sync);
134 epoch1 = thr->fast_state.epoch();
137 ctx->dd->DestroyLogicalThread(thr->dd_lt);
138 thr->~ThreadState();
140 StatAggregate(ctx->stat, thr->stat);
142 thr = 0;
185 static void ThreadCheckIgnore(ThreadState *thr) {
188 if (thr->ignore_reads_and_writes)
189 ReportIgnoresEnabled(thr->tctx, &thr->mop_ignore_set);
190 if (thr->ignore_sync)
191 ReportIgnoresEnabled(thr->tctx, &thr->sync_ignore_set);
194 static void ThreadCheckIgnore(ThreadState *thr) {}
197 void ThreadFinalize(ThreadState *thr) {
198 ThreadCheckIgnore(thr);
210 OutputReport(thr, rep);
215 int ThreadCount(ThreadState *thr) {
221 int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) {
222 StatInc(thr, StatThreadCreate);
223 OnCreatedArgs args = { thr, pc };
224 u32 parent_tid = thr ? thr->tid : kInvalidTid; // No parent for GCD workers.
228 StatSet(thr, StatThreadMaxAlive, ctx->thread_registry->GetMaxAliveThreads());
232 void ThreadStart(ThreadState *thr, int tid, uptr os_id) {
242 MemoryRangeImitateWrite(thr, /*pc=*/ 1, stk_addr, stk_size);
245 // Check that the thr object is in tls;
246 const uptr thr_beg = (uptr)thr;
247 const uptr thr_end = (uptr)thr + sizeof(*thr);
252 // Since the thr object is huge, skip it.
253 MemoryRangeImitateWrite(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr);
254 MemoryRangeImitateWrite(thr, /*pc=*/ 2,
261 OnStartedArgs args = { thr, stk_addr, stk_size, tls_addr, tls_size };
265 thr->tctx = (ThreadContext*)tr->GetThreadLocked(tid);
270 thr->ignore_interceptors++;
271 ThreadIgnoreBegin(thr, 0);
272 ThreadIgnoreSyncBegin(thr, 0);
277 void ThreadFinish(ThreadState *thr) {
278 ThreadCheckIgnore(thr);
279 StatInc(thr, StatThreadFinish);
280 if (thr->stk_addr && thr->stk_size)
281 DontNeedShadowFor(thr->stk_addr, thr->stk_size);
282 if (thr->tls_addr && thr->tls_size)
283 DontNeedShadowFor(thr->tls_addr, thr->tls_size);
284 thr->is_dead = true;
285 ctx->thread_registry->FinishThread(thr->tid);
297 int ThreadTid(ThreadState *thr, uptr pc, uptr uid) {
299 DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res);
303 void ThreadJoin(ThreadState *thr, uptr pc, int tid) {
306 DPrintf("#%d: ThreadJoin tid=%d\n", thr->tid, tid);
307 ctx->thread_registry->JoinThread(tid, thr);
310 void ThreadDetach(ThreadState *thr, uptr pc, int tid) {
313 ctx->thread_registry->DetachThread(tid, thr);
316 void ThreadSetName(ThreadState *thr, const char *name) {
317 ctx->thread_registry->SetThreadName(thr->tid, name);
320 void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr,
327 thr->tid, (void*)pc, (void*)addr,
350 StatInc(thr, StatMopRange);
355 StatInc(thr, StatMopRangeRodata);
359 FastState fast_state = thr->fast_state;
364 thr->fast_state = fast_state;
365 TraceAddEvent(thr, fast_state, EventTypeMop, pc);
375 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
386 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
396 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,