blob: ee13fa18db3f9b24189955566ad559c1125827ef [file] [log] [blame]
Alexey Samsonov3b2f9f42012-06-04 13:55:19 +00001//===-- tsan_rtl_thread.cc ------------------------------------------------===//
Kostya Serebryany4ad375f2012-05-10 13:48:04 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of ThreadSanitizer (TSan), a race detector.
11//
12//===----------------------------------------------------------------------===//
13
Alexey Samsonov8bd90982012-06-07 09:50:16 +000014#include "sanitizer_common/sanitizer_placement_new.h"
Kostya Serebryany4ad375f2012-05-10 13:48:04 +000015#include "tsan_rtl.h"
16#include "tsan_mman.h"
Kostya Serebryany4ad375f2012-05-10 13:48:04 +000017#include "tsan_platform.h"
18#include "tsan_report.h"
19#include "tsan_sync.h"
20
21namespace __tsan {
22
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000023// ThreadContext implementation.
Kostya Serebryany4ad375f2012-05-10 13:48:04 +000024
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000025ThreadContext::ThreadContext(int tid)
26 : ThreadContextBase(tid)
27 , thr()
28 , sync()
29 , epoch0()
Dmitry Vyukov79915de2013-03-20 10:31:53 +000030 , epoch1() {
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000031}
32
Dmitry Vyukov49e462f2013-03-18 10:10:15 +000033#ifndef TSAN_GO
34ThreadContext::~ThreadContext() {
35}
36#endif
37
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000038void ThreadContext::OnDead() {
39 sync.Reset();
40}
41
42void ThreadContext::OnJoined(void *arg) {
43 ThreadState *caller_thr = static_cast<ThreadState *>(arg);
44 caller_thr->clock.acquire(&sync);
45 StatInc(caller_thr, StatSyncAcquire);
Dmitry Vyukov509dab32013-03-19 10:22:33 +000046 sync.Reset();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000047}
48
49struct OnCreatedArgs {
50 ThreadState *thr;
51 uptr pc;
52};
53
54void ThreadContext::OnCreated(void *arg) {
55 thr = 0;
Dmitry Vyukov50160032013-03-18 08:52:46 +000056 if (tid == 0)
57 return;
58 OnCreatedArgs *args = static_cast<OnCreatedArgs *>(arg);
59 args->thr->fast_state.IncrementEpoch();
60 // Can't increment epoch w/o writing to the trace as well.
61 TraceAddEvent(args->thr, args->thr->fast_state, EventTypeMop, 0);
62 args->thr->clock.set(args->thr->tid, args->thr->fast_state.epoch());
63 args->thr->fast_synch_epoch = args->thr->fast_state.epoch();
64 args->thr->clock.release(&sync);
65 StatInc(args->thr, StatSyncRelease);
Dmitry Vyukov7cd20252013-03-18 09:02:27 +000066#ifdef TSAN_GO
Dmitry Vyukov50160032013-03-18 08:52:46 +000067 creation_stack.ObtainCurrent(args->thr, args->pc);
Dmitry Vyukov7cd20252013-03-18 09:02:27 +000068#else
69 creation_stack_id = CurrentStackId(args->thr, args->pc);
70#endif
Dmitry Vyukov50160032013-03-18 08:52:46 +000071 if (reuse_count == 0)
72 StatInc(args->thr, StatThreadMaxTid);
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000073}
74
Dmitry Vyukov4ecfa692013-03-19 12:25:48 +000075void ThreadContext::OnReset() {
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000076 sync.Reset();
Dmitry Vyukov79915de2013-03-20 10:31:53 +000077 FlushUnneededShadowMemory(GetThreadTrace(tid), TraceSize() * sizeof(Event));
78 //!!! FlushUnneededShadowMemory(GetThreadTraceHeader(tid), sizeof(Trace));
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000079}
80
81struct OnStartedArgs {
82 ThreadState *thr;
83 uptr stk_addr;
84 uptr stk_size;
85 uptr tls_addr;
86 uptr tls_size;
87};
88
89void ThreadContext::OnStarted(void *arg) {
90 OnStartedArgs *args = static_cast<OnStartedArgs*>(arg);
Dmitry Vyukov50160032013-03-18 08:52:46 +000091 thr = args->thr;
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000092 // RoundUp so that one trace part does not contain events
93 // from different threads.
94 epoch0 = RoundUp(epoch1 + 1, kTracePartSize);
95 epoch1 = (u64)-1;
Dmitry Vyukov50160032013-03-18 08:52:46 +000096 new(thr) ThreadState(CTX(), tid, unique_id,
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +000097 epoch0, args->stk_addr, args->stk_size, args->tls_addr, args->tls_size);
98#ifdef TSAN_GO
99 // Setup dynamic shadow stack.
100 const int kInitStackSize = 8;
101 args->thr->shadow_stack = (uptr*)internal_alloc(MBlockShadowStack,
102 kInitStackSize * sizeof(uptr));
103 args->thr->shadow_stack_pos = thr->shadow_stack;
104 args->thr->shadow_stack_end = thr->shadow_stack + kInitStackSize;
105#endif
106#ifndef TSAN_GO
107 AllocatorThreadStart(args->thr);
108#endif
109 thr = args->thr;
110 thr->fast_synch_epoch = epoch0;
111 thr->clock.set(tid, epoch0);
112 thr->clock.acquire(&sync);
113 thr->fast_state.SetHistorySize(flags()->history_size);
114 const uptr trace = (epoch0 / kTracePartSize) % TraceParts();
Dmitry Vyukov79915de2013-03-20 10:31:53 +0000115 Trace *thr_trace = ThreadTrace(thr->tid);
116 thr_trace->headers[trace].epoch0 = epoch0;
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000117 StatInc(thr, StatSyncAcquire);
Dmitry Vyukov79915de2013-03-20 10:31:53 +0000118 sync.Reset();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000119 DPrintf("#%d: ThreadStart epoch=%zu stk_addr=%zx stk_size=%zx "
120 "tls_addr=%zx tls_size=%zx\n",
Alexey Samsonovb5d10f62013-03-18 09:45:22 +0000121 tid, (uptr)epoch0, args->stk_addr, args->stk_size,
122 args->tls_addr, args->tls_size);
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000123 thr->is_alive = true;
124}
125
126void ThreadContext::OnFinished() {
127 if (!detached) {
128 thr->fast_state.IncrementEpoch();
129 // Can't increment epoch w/o writing to the trace as well.
130 TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
131 thr->clock.set(thr->tid, thr->fast_state.epoch());
132 thr->fast_synch_epoch = thr->fast_state.epoch();
133 thr->clock.release(&sync);
134 StatInc(thr, StatSyncRelease);
135 }
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000136 epoch1 = thr->fast_state.epoch();
137
138#ifndef TSAN_GO
139 AllocatorThreadFinish(thr);
140#endif
141 thr->~ThreadState();
142 StatAggregate(CTX()->stat, thr->stat);
143 thr = 0;
144}
145
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000146#ifndef TSAN_GO
147struct ThreadLeak {
148 ThreadContext *tctx;
149 int count;
150};
151
152static void MaybeReportThreadLeak(ThreadContextBase *tctx_base, void *arg) {
153 Vector<ThreadLeak> &leaks = *(Vector<ThreadLeak>*)arg;
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000154 ThreadContext *tctx = static_cast<ThreadContext*>(tctx_base);
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000155 if (tctx->detached || tctx->status != ThreadStatusFinished)
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000156 return;
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000157 for (uptr i = 0; i < leaks.Size(); i++) {
158 if (leaks[i].tctx->creation_stack_id == tctx->creation_stack_id) {
159 leaks[i].count++;
160 return;
161 }
162 }
163 ThreadLeak leak = {tctx, 1};
164 leaks.PushBack(leak);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000165}
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000166#endif
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000167
Dmitry Vyukov536bff32013-05-21 08:12:35 +0000168static void ThreadCheckIgnore(ThreadState *thr) {
169 if (thr->ignore_reads_and_writes) {
170 Printf("ThreadSanitizer: thread T%d finished with ignores enabled.\n",
171 thr->tid);
172 }
173}
174
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000175void ThreadFinalize(ThreadState *thr) {
176 CHECK_GT(thr->in_rtl, 0);
Dmitry Vyukov536bff32013-05-21 08:12:35 +0000177 ThreadCheckIgnore(thr);
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000178#ifndef TSAN_GO
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000179 if (!flags()->report_thread_leaks)
180 return;
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000181 ThreadRegistryLock l(CTX()->thread_registry);
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000182 Vector<ThreadLeak> leaks(MBlockScopedBuf);
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000183 CTX()->thread_registry->RunCallbackForEachThreadLocked(
Dmitry Vyukovebf63d02013-03-21 16:55:17 +0000184 MaybeReportThreadLeak, &leaks);
185 for (uptr i = 0; i < leaks.Size(); i++) {
186 ScopedReport rep(ReportTypeThreadLeak);
187 rep.AddThread(leaks[i].tctx);
188 rep.SetCount(leaks[i].count);
189 OutputReport(CTX(), rep);
190 }
191#endif
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000192}
193
Dmitry Vyukov67dc5702012-11-07 16:41:57 +0000194int ThreadCount(ThreadState *thr) {
195 CHECK_GT(thr->in_rtl, 0);
196 Context *ctx = CTX();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000197 uptr result;
198 ctx->thread_registry->GetNumberOfThreads(0, 0, &result);
199 return (int)result;
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000200}
201
202int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) {
203 CHECK_GT(thr->in_rtl, 0);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000204 StatInc(thr, StatThreadCreate);
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000205 Context *ctx = CTX();
206 OnCreatedArgs args = { thr, pc };
207 int tid = ctx->thread_registry->CreateThread(uid, detached, thr->tid, &args);
Alexey Samsonov51ae9832012-06-06 13:11:29 +0000208 DPrintf("#%d: ThreadCreate tid=%d uid=%zu\n", thr->tid, tid, uid);
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000209 StatSet(thr, StatThreadMaxAlive, ctx->thread_registry->GetMaxAliveThreads());
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000210 return tid;
211}
212
Dmitry Vyukov56faa552012-10-02 12:58:14 +0000213void ThreadStart(ThreadState *thr, int tid, uptr os_id) {
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000214 CHECK_GT(thr->in_rtl, 0);
215 uptr stk_addr = 0;
216 uptr stk_size = 0;
217 uptr tls_addr = 0;
218 uptr tls_size = 0;
Dmitry Vyukov7339eb12012-05-25 11:15:04 +0000219 GetThreadStackAndTls(tid == 0, &stk_addr, &stk_size, &tls_addr, &tls_size);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000220
Dmitry Vyukov2d4e3c12012-05-28 07:44:34 +0000221 if (tid) {
Dmitry Vyukov2e7f29f2013-03-18 15:49:07 +0000222 if (stk_addr && stk_size)
Dmitry Vyukovce26a0a2013-03-18 16:56:48 +0000223 MemoryRangeImitateWrite(thr, /*pc=*/ 1, stk_addr, stk_size);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000224
Dmitry Vyukov03d32ec2012-07-05 16:18:28 +0000225 if (tls_addr && tls_size) {
226 // Check that the thr object is in tls;
227 const uptr thr_beg = (uptr)thr;
228 const uptr thr_end = (uptr)thr + sizeof(*thr);
229 CHECK_GE(thr_beg, tls_addr);
230 CHECK_LE(thr_beg, tls_addr + tls_size);
231 CHECK_GE(thr_end, tls_addr);
232 CHECK_LE(thr_end, tls_addr + tls_size);
233 // Since the thr object is huge, skip it.
Dmitry Vyukovce26a0a2013-03-18 16:56:48 +0000234 MemoryRangeImitateWrite(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr);
235 MemoryRangeImitateWrite(thr, /*pc=*/ 2,
236 thr_end, tls_addr + tls_size - thr_end);
Dmitry Vyukov03d32ec2012-07-05 16:18:28 +0000237 }
Dmitry Vyukov2d4e3c12012-05-28 07:44:34 +0000238 }
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000239
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000240 OnStartedArgs args = { thr, stk_addr, stk_size, tls_addr, tls_size };
241 CTX()->thread_registry->StartThread(tid, os_id, &args);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000242}
243
244void ThreadFinish(ThreadState *thr) {
245 CHECK_GT(thr->in_rtl, 0);
Dmitry Vyukov536bff32013-05-21 08:12:35 +0000246 ThreadCheckIgnore(thr);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000247 StatInc(thr, StatThreadFinish);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000248 if (thr->stk_addr && thr->stk_size)
Dmitry Vyukov2e7f29f2013-03-18 15:49:07 +0000249 DontNeedShadowFor(thr->stk_addr, thr->stk_size);
250 if (thr->tls_addr && thr->tls_size)
251 DontNeedShadowFor(thr->tls_addr, thr->tls_size);
Dmitry Vyukovfa985a02012-06-28 18:07:46 +0000252 thr->is_alive = false;
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000253 Context *ctx = CTX();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000254 ctx->thread_registry->FinishThread(thr->tid);
255}
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000256
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000257static bool FindThreadByUid(ThreadContextBase *tctx, void *arg) {
258 uptr uid = (uptr)arg;
259 if (tctx->user_id == uid && tctx->status != ThreadStatusInvalid) {
260 tctx->user_id = 0;
261 return true;
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000262 }
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000263 return false;
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000264}
265
266int ThreadTid(ThreadState *thr, uptr pc, uptr uid) {
267 CHECK_GT(thr->in_rtl, 0);
Dmitry Vyukov880bb662012-05-28 17:32:50 +0000268 Context *ctx = CTX();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000269 int res = ctx->thread_registry->FindThread(FindThreadByUid, (void*)uid);
Alexey Samsonov51ae9832012-06-06 13:11:29 +0000270 DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res);
Dmitry Vyukov880bb662012-05-28 17:32:50 +0000271 return res;
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000272}
273
274void ThreadJoin(ThreadState *thr, uptr pc, int tid) {
275 CHECK_GT(thr->in_rtl, 0);
276 CHECK_GT(tid, 0);
277 CHECK_LT(tid, kMaxTid);
278 DPrintf("#%d: ThreadJoin tid=%d\n", thr->tid, tid);
279 Context *ctx = CTX();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000280 ctx->thread_registry->JoinThread(tid, thr);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000281}
282
283void ThreadDetach(ThreadState *thr, uptr pc, int tid) {
284 CHECK_GT(thr->in_rtl, 0);
285 CHECK_GT(tid, 0);
286 CHECK_LT(tid, kMaxTid);
287 Context *ctx = CTX();
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000288 ctx->thread_registry->DetachThread(tid);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000289}
290
Dmitry Vyukov1b469932012-12-04 15:46:05 +0000291void ThreadSetName(ThreadState *thr, const char *name) {
Alexey Samsonov9aecdfe2013-03-15 13:48:44 +0000292 CHECK_GT(thr->in_rtl, 0);
293 CTX()->thread_registry->SetThreadName(thr->tid, name);
Dmitry Vyukov1b469932012-12-04 15:46:05 +0000294}
295
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000296void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr,
297 uptr size, bool is_write) {
298 if (size == 0)
299 return;
300
301 u64 *shadow_mem = (u64*)MemToShadow(addr);
302 DPrintf2("#%d: MemoryAccessRange: @%p %p size=%d is_write=%d\n",
303 thr->tid, (void*)pc, (void*)addr,
304 (int)size, is_write);
305
306#if TSAN_DEBUG
307 if (!IsAppMem(addr)) {
Alexey Samsonovad9d65f2012-11-02 12:17:51 +0000308 Printf("Access to non app mem %zx\n", addr);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000309 DCHECK(IsAppMem(addr));
310 }
311 if (!IsAppMem(addr + size - 1)) {
Alexey Samsonovad9d65f2012-11-02 12:17:51 +0000312 Printf("Access to non app mem %zx\n", addr + size - 1);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000313 DCHECK(IsAppMem(addr + size - 1));
314 }
315 if (!IsShadowMem((uptr)shadow_mem)) {
Alexey Samsonovad9d65f2012-11-02 12:17:51 +0000316 Printf("Bad shadow addr %p (%zx)\n", shadow_mem, addr);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000317 DCHECK(IsShadowMem((uptr)shadow_mem));
318 }
319 if (!IsShadowMem((uptr)(shadow_mem + size * kShadowCnt / 8 - 1))) {
Alexey Samsonovad9d65f2012-11-02 12:17:51 +0000320 Printf("Bad shadow addr %p (%zx)\n",
Alexey Samsonov51ae9832012-06-06 13:11:29 +0000321 shadow_mem + size * kShadowCnt / 8 - 1, addr + size - 1);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000322 DCHECK(IsShadowMem((uptr)(shadow_mem + size * kShadowCnt / 8 - 1)));
323 }
324#endif
325
326 StatInc(thr, StatMopRange);
327
Dmitry Vyukovb62c1582013-03-20 13:21:50 +0000328 if (*shadow_mem == kShadowRodata) {
329 // Access to .rodata section, no races here.
330 // Measurements show that it can be 10-20% of all memory accesses.
331 StatInc(thr, StatMopRangeRodata);
332 return;
333 }
334
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000335 FastState fast_state = thr->fast_state;
336 if (fast_state.GetIgnoreBit())
337 return;
338
339 fast_state.IncrementEpoch();
340 thr->fast_state = fast_state;
Dmitry Vyukov2429b022012-11-28 10:35:31 +0000341 TraceAddEvent(thr, fast_state, EventTypeMop, pc);
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000342
343 bool unaligned = (addr % kShadowCell) != 0;
344
345 // Handle unaligned beginning, if any.
346 for (; addr % kShadowCell && size; addr++, size--) {
347 int const kAccessSizeLog = 0;
348 Shadow cur(fast_state);
349 cur.SetWrite(is_write);
350 cur.SetAddr0AndSizeLog(addr & (kShadowCell - 1), kAccessSizeLog);
Dmitry Vyukovba429142013-02-01 09:42:06 +0000351 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000352 shadow_mem, cur);
353 }
354 if (unaligned)
355 shadow_mem += kShadowCnt;
356 // Handle middle part, if any.
357 for (; size >= kShadowCell; addr += kShadowCell, size -= kShadowCell) {
358 int const kAccessSizeLog = 3;
359 Shadow cur(fast_state);
360 cur.SetWrite(is_write);
361 cur.SetAddr0AndSizeLog(0, kAccessSizeLog);
Dmitry Vyukovba429142013-02-01 09:42:06 +0000362 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000363 shadow_mem, cur);
364 shadow_mem += kShadowCnt;
365 }
366 // Handle ending, if any.
367 for (; size; addr++, size--) {
368 int const kAccessSizeLog = 0;
369 Shadow cur(fast_state);
370 cur.SetWrite(is_write);
371 cur.SetAddr0AndSizeLog(addr & (kShadowCell - 1), kAccessSizeLog);
Dmitry Vyukovba429142013-02-01 09:42:06 +0000372 MemoryAccessImpl(thr, addr, kAccessSizeLog, is_write, false,
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000373 shadow_mem, cur);
374 }
375}
Dmitry Vyukov3c2489e2013-02-13 13:05:36 +0000376
377void MemoryAccessRangeStep(ThreadState *thr, uptr pc, uptr addr,
378 uptr size, uptr step, bool is_write) {
379 if (size == 0)
380 return;
381 FastState fast_state = thr->fast_state;
382 if (fast_state.GetIgnoreBit())
383 return;
384 StatInc(thr, StatMopRange);
385 fast_state.IncrementEpoch();
386 thr->fast_state = fast_state;
387 TraceAddEvent(thr, fast_state, EventTypeMop, pc);
388
389 for (uptr addr_end = addr + size; addr < addr_end; addr += step) {
390 u64 *shadow_mem = (u64*)MemToShadow(addr);
391 Shadow cur(fast_state);
392 cur.SetWrite(is_write);
393 cur.SetAddr0AndSizeLog(addr & (kShadowCell - 1), kSizeLog1);
394 MemoryAccessImpl(thr, addr, kSizeLog1, is_write, false,
395 shadow_mem, cur);
396 }
397}
Kostya Serebryany4ad375f2012-05-10 13:48:04 +0000398} // namespace __tsan