Home | History | Annotate | Download | only in rtl

Lines Matching defs:thr

27   , thr()
49 ThreadState *thr;
54 thr = 0;
58 args->thr->fast_state.IncrementEpoch();
60 TraceAddEvent(args->thr, args->thr->fast_state, EventTypeMop, 0);
61 ReleaseImpl(args->thr, 0, &sync);
62 creation_stack_id = CurrentStackId(args->thr, args->pc);
64 StatInc(args->thr, StatThreadMaxTid);
74 ThreadState *thr;
83 thr = args->thr;
88 new(thr) ThreadState(ctx, tid, unique_id, epoch0, reuse_count,
91 thr->shadow_stack = &ThreadTrace(thr->tid)->shadow_stack[0];
92 thr->shadow_stack_pos = thr->shadow_stack;
93 thr->shadow_stack_end = thr->shadow_stack + kShadowStackSize;
97 thr->shadow_stack = (uptr*)internal_alloc(MBlockShadowStack,
99 thr->shadow_stack_pos = thr->shadow_stack;
100 thr->shadow_stack_end = thr->shadow_stack + kInitStackSize;
103 AllocatorThreadStart(thr);
106 thr->dd_pt = ctx->dd->CreatePhysicalThread();
107 thr->dd_lt = ctx->dd->CreateLogicalThread(unique_id);
109 thr->fast_synch_epoch = epoch0;
110 AcquireImpl(thr, 0, &sync);
111 thr->fast_state.SetHistorySize(flags()->history_size);
113 Trace *thr_trace = ThreadTrace(thr->tid);
115 StatInc(thr, StatSyncAcquire);
121 thr->is_alive = true;
126 thr->fast_state.IncrementEpoch();
128 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
129 ReleaseImpl(thr, 0, &sync);
131 epoch1 = thr->fast_state.epoch();
134 ctx->dd->DestroyPhysicalThread(thr->dd_pt);
135 ctx->dd->DestroyLogicalThread(thr->dd_lt);
137 ctx->metamap.OnThreadIdle(thr);
139 AllocatorThreadFinish(thr);
141 thr->~ThreadState();
142 StatAggregate(ctx->stat, thr->stat);
143 thr = 0;
186 static void ThreadCheckIgnore(ThreadState *thr) {
189 if (thr->ignore_reads_and_writes)
190 ReportIgnoresEnabled(thr->tctx, &thr->mop_ignore_set);
191 if (thr->ignore_sync)
192 ReportIgnoresEnabled(thr->tctx, &thr->sync_ignore_set);
195 static void ThreadCheckIgnore(ThreadState *thr) {}
198 void ThreadFinalize(ThreadState *thr) {
199 ThreadCheckIgnore(thr);
211 OutputReport(thr, rep);
216 int ThreadCount(ThreadState *thr) {
222 int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) {
223 StatInc(thr, StatThreadCreate);
224 OnCreatedArgs args = { thr, pc };
225 int tid = ctx->thread_registry->CreateThread(uid, detached, thr->tid, &args);
226 DPrintf("#%d: ThreadCreate tid=%d uid=%zu\n", thr->tid, tid, uid);
227 StatSet(thr, StatThreadMaxAlive, ctx->thread_registry->GetMaxAliveThreads());
231 void ThreadStart(ThreadState *thr, int tid, uptr os_id) {
240 MemoryRangeImitateWrite(thr, /*pc=*/ 1, stk_addr, stk_size);
243 // Check that the thr object is in tls;
244 const uptr thr_beg = (uptr)thr;
245 const uptr thr_end = (uptr)thr + sizeof(*thr);
250 // Since the thr object is huge, skip it.
251 MemoryRangeImitateWrite(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr);
252 MemoryRangeImitateWrite(thr, /*pc=*/ 2,
258 OnStartedArgs args = { thr, stk_addr, stk_size, tls_addr, tls_size };
262 thr->tctx = (ThreadContext*)tr->GetThreadLocked(tid);
267 thr->ignore_interceptors++;
268 ThreadIgnoreBegin(thr, 0);
269 ThreadIgnoreSyncBegin(thr, 0);
274 void ThreadFinish(ThreadState *thr) {
275 ThreadCheckIgnore(thr);
276 StatInc(thr, StatThreadFinish);
277 if (thr->stk_addr && thr->stk_size)
278 DontNeedShadowFor(thr->stk_addr, thr->stk_size);
279 if (thr->tls_addr && thr->tls_size)
280 DontNeedShadowFor(thr->tls_addr, thr->tls_size);
281 thr->is_alive = false;
282 ctx->thread_registry->FinishThread(thr->tid);
294 int ThreadTid(ThreadState *thr, uptr pc, uptr uid) {
296 DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res);
300 void ThreadJoin(ThreadState *thr, uptr pc, int tid) {
303 DPrintf("#%d: ThreadJoin tid=%d\n", thr->tid, tid);
304 ctx->thread_registry->JoinThread(tid, thr);
307 void ThreadDetach(ThreadState *thr, uptr pc, int tid) {
313 void ThreadSetName(ThreadState *thr, const char *name) {
314 ctx->thread_registry->SetThreadName(thr->tid, name);
317 void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr,
324 thr->tid, (void*)pc, (void*)addr,
347 StatInc(thr, StatMopRange);
352 StatInc(thr, StatMopRangeRodata);
356 FastState fast_state = thr->fast_state;
361 thr->fast_state = fast_state;
362 TraceAddEvent(thr, fast_state, EventTypeMop, pc);
372 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
383 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
393 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,