From: Bart Van Assche Date: Sun, 15 Feb 2009 13:11:14 +0000 (+0000) Subject: Wrapped DRD_() macro around thread-related function names. X-Git-Tag: svn/VALGRIND_3_5_0~978 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8dd5b6ceb8c0550207576c19ceb88ade71018aba;p=thirdparty%2Fvalgrind.git Wrapped DRD_() macro around thread-related function names. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9168 --- diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c index 0e2e80c794..e96c1fe0e7 100644 --- a/drd/drd_barrier.c +++ b/drd/drd_barrier.c @@ -218,7 +218,7 @@ void DRD_(barrier_init)(const Addr barrier, VG_(message)(Vg_UserMsg, "[%d/%d] barrier_reinit %s 0x%lx count %ld -> %ld", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), DRD_(barrier_get_typename)(p), barrier, p->count, @@ -229,7 +229,7 @@ void DRD_(barrier_init)(const Addr barrier, VG_(message)(Vg_UserMsg, "[%d/%d] barrier_init %s 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), DRD_(barrier_get_typename)(p), barrier); } @@ -263,7 +263,7 @@ void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type) VG_(message)(Vg_UserMsg, "[%d/%d] barrier_destroy %s 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), DRD_(barrier_get_typename)(p), barrier); } @@ -318,7 +318,7 @@ void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier, VG_(message)(Vg_UserMsg, "[%d/%d] barrier_pre_wait %s 0x%lx iteration %ld", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), DRD_(barrier_get_typename)(p), barrier, p->pre_iteration); @@ -332,7 +332,7 @@ void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier, VG_(OSetGen_Insert)(p->oset, q); tl_assert(VG_(OSetGen_Lookup)(p->oset, &word_tid) == q); } - thread_get_latest_segment(&q->sg[p->pre_iteration], tid); + DRD_(thread_get_latest_segment)(&q->sg[p->pre_iteration], tid); if (--p->pre_waiters_left <= 0) { @@ -396,11 +396,11 @@ void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier, if (r != q) { tl_assert(r->sg[p->post_iteration]); - thread_combine_vc2(tid, &r->sg[p->post_iteration]->vc); + DRD_(thread_combine_vc2)(tid, &r->sg[p->post_iteration]->vc); } } - thread_new_segment(tid); + DRD_(thread_new_segment)(tid); DRD_(s_barrier_segment_creation_count)++; if (--p->post_waiters_left <= 0) diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c index 2f43b5fa5c..f79973ef52 100644 --- a/drd/drd_clientreq.c +++ b/drd/drd_clientreq.c @@ -66,10 +66,10 @@ static Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) { UWord result = 0; - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); tl_assert(vg_tid == VG_(get_running_tid())); - tl_assert(VgThreadIdToDrdThreadId(vg_tid) == drd_tid); + tl_assert(DRD_(VgThreadIdToDrdThreadId)(vg_tid) == drd_tid); switch (arg[0]) { @@ -109,14 +109,14 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) i, sps[i], fps[i], desc); } #endif - thread_set_stack_startup(drd_tid, VG_(get_SP)(vg_tid)); + DRD_(thread_set_stack_startup)(drd_tid, VG_(get_SP)(vg_tid)); DRD_(start_suppression)(topmost_sp, VG_(thread_get_stack_max)(vg_tid), "stack top"); break; } case VG_USERREQ__DRD_START_NEW_SEGMENT: - thread_new_segment(PtThreadIdToDrdThreadId(arg[1])); + DRD_(thread_new_segment)(DRD_(PtThreadIdToDrdThreadId)(arg[1])); break; case VG_USERREQ__DRD_START_TRACE_ADDR: @@ -128,31 +128,32 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__DRD_STOP_RECORDING: - thread_stop_recording(drd_tid); + DRD_(thread_stop_recording)(drd_tid); break; case VG_USERREQ__DRD_START_RECORDING: - thread_start_recording(drd_tid); + DRD_(thread_start_recording)(drd_tid); break; case VG_USERREQ__SET_PTHREADID: // pthread_self() returns 0 for programs not linked with libpthread.so. if (arg[1] != INVALID_POSIX_THREADID) - thread_set_pthreadid(drd_tid, arg[1]); + DRD_(thread_set_pthreadid)(drd_tid, arg[1]); break; case VG_USERREQ__SET_JOINABLE: - thread_set_joinable(PtThreadIdToDrdThreadId(arg[1]), (Bool)arg[2]); + DRD_(thread_set_joinable)(DRD_(PtThreadIdToDrdThreadId)(arg[1]), + (Bool)arg[2]); break; case VG_USERREQ__POST_THREAD_JOIN: tl_assert(arg[1]); - DRD_(thread_post_join)(drd_tid, PtThreadIdToDrdThreadId(arg[1])); + DRD_(thread_post_join)(drd_tid, DRD_(PtThreadIdToDrdThreadId)(arg[1])); break; case VG_USERREQ__PRE_THREAD_CANCEL: tl_assert(arg[1]); - thread_pre_cancel(drd_tid); + DRD_(thread_pre_cancel)(drd_tid); break; case VG_USERREQ__POST_THREAD_CANCEL: @@ -160,71 +161,71 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__PRE_MUTEX_INIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) mutex_init(arg[1], arg[2]); break; case VG_USERREQ__POST_MUTEX_INIT: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_MUTEX_DESTROY: - thread_enter_synchr(drd_tid); + DRD_(thread_enter_synchr)(drd_tid); break; case VG_USERREQ__POST_MUTEX_DESTROY: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) mutex_post_destroy(arg[1]); break; case VG_USERREQ__PRE_MUTEX_LOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) mutex_pre_lock(arg[1], arg[2], arg[3]); break; case VG_USERREQ__POST_MUTEX_LOCK: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) mutex_post_lock(arg[1], arg[2], False/*post_cond_wait*/); break; case VG_USERREQ__PRE_MUTEX_UNLOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) mutex_unlock(arg[1], arg[2]); break; case VG_USERREQ__POST_MUTEX_UNLOCK: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) DRD_(spinlock_init_or_unlock)(arg[1]); break; case VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_COND_INIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) cond_pre_init(arg[1]); break; case VG_USERREQ__POST_COND_INIT: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_COND_DESTROY: - thread_enter_synchr(drd_tid); + DRD_(thread_enter_synchr)(drd_tid); break; case VG_USERREQ__POST_COND_DESTROY: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) cond_post_destroy(arg[1]); break; case VG_USERREQ__PRE_COND_WAIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) { const Addr cond = arg[1]; const Addr mutex = arg[2]; @@ -235,7 +236,7 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__POST_COND_WAIT: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) { const Addr cond = arg[1]; const Addr mutex = arg[2]; @@ -246,86 +247,86 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__PRE_COND_SIGNAL: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) cond_pre_signal(arg[1]); break; case VG_USERREQ__POST_COND_SIGNAL: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_COND_BROADCAST: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) cond_pre_broadcast(arg[1]); break; case VG_USERREQ__POST_COND_BROADCAST: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_SEM_INIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) semaphore_init(arg[1], arg[2], arg[3]); break; case VG_USERREQ__POST_SEM_INIT: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_SEM_DESTROY: - thread_enter_synchr(drd_tid); + DRD_(thread_enter_synchr)(drd_tid); break; case VG_USERREQ__POST_SEM_DESTROY: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) semaphore_destroy(arg[1]); break; case VG_USERREQ__PRE_SEM_WAIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) semaphore_pre_wait(arg[1]); break; case VG_USERREQ__POST_SEM_WAIT: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) semaphore_post_wait(drd_tid, arg[1], arg[2]); break; case VG_USERREQ__PRE_SEM_POST: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) semaphore_pre_post(drd_tid, arg[1]); break; case VG_USERREQ__POST_SEM_POST: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) semaphore_post_post(drd_tid, arg[1], arg[2]); break; case VG_USERREQ__PRE_BARRIER_INIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) DRD_(barrier_init)(arg[1], arg[2], arg[3], arg[4]); break; case VG_USERREQ__POST_BARRIER_INIT: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; case VG_USERREQ__PRE_BARRIER_DESTROY: - thread_enter_synchr(drd_tid); + DRD_(thread_enter_synchr)(drd_tid); break; case VG_USERREQ__POST_BARRIER_DESTROY: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) DRD_(barrier_destroy)(arg[1], arg[2]); break; case VG_USERREQ__PRE_BARRIER_WAIT: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) DRD_(barrier_pre_wait)(drd_tid, arg[1], arg[2]); break; case VG_USERREQ__POST_BARRIER_WAIT: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) DRD_(barrier_post_wait)(drd_tid, arg[1], arg[2], arg[3]); break; @@ -338,32 +339,32 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__PRE_RWLOCK_RDLOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) rwlock_pre_rdlock(arg[1]); break; case VG_USERREQ__POST_RWLOCK_RDLOCK: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) rwlock_post_rdlock(arg[1], arg[2]); break; case VG_USERREQ__PRE_RWLOCK_WRLOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) rwlock_pre_wrlock(arg[1]); break; case VG_USERREQ__POST_RWLOCK_WRLOCK: - if (thread_leave_synchr(drd_tid) == 0) + if (DRD_(thread_leave_synchr)(drd_tid) == 0) rwlock_post_wrlock(arg[1], arg[2]); break; case VG_USERREQ__PRE_RWLOCK_UNLOCK: - if (thread_enter_synchr(drd_tid) == 0) + if (DRD_(thread_enter_synchr)(drd_tid) == 0) rwlock_pre_unlock(arg[1]); break; case VG_USERREQ__POST_RWLOCK_UNLOCK: - thread_leave_synchr(drd_tid); + DRD_(thread_leave_synchr)(drd_tid); break; default: diff --git a/drd/drd_cond.c b/drd/drd_cond.c index 06027b2c72..83da627389 100644 --- a/drd/drd_cond.c +++ b/drd/drd_cond.c @@ -124,7 +124,7 @@ void cond_pre_init(const Addr cond) VG_(message)(Vg_UserMsg, "[%d/%d] cond_init cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } @@ -153,7 +153,7 @@ void cond_post_destroy(const Addr cond) VG_(message)(Vg_UserMsg, "[%d/%d] cond_destroy cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } @@ -196,7 +196,7 @@ int cond_pre_wait(const Addr cond, const Addr mutex) VG_(message)(Vg_UserMsg, "[%d/%d] cond_pre_wait cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } @@ -220,7 +220,7 @@ int cond_pre_wait(const Addr cond, const Addr mutex) } tl_assert(p->mutex); q = mutex_get(p->mutex); - if (q && q->owner == thread_get_running_tid() && q->recursion_count > 0) + if (q && q->owner == DRD_(thread_get_running_tid)() && q->recursion_count > 0) { const ThreadId vg_tid = VG_(get_running_tid)(); MutexErrInfo MEI = { q->a1, q->recursion_count, q->owner }; @@ -248,7 +248,7 @@ int cond_post_wait(const Addr cond) VG_(message)(Vg_UserMsg, "[%d/%d] cond_post_wait cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } @@ -271,7 +271,7 @@ int cond_post_wait(const Addr cond) static void cond_signal(Addr const cond) { const ThreadId vg_tid = VG_(get_running_tid)(); - const DrdThreadId drd_tid = VgThreadIdToDrdThreadId(vg_tid); + const DrdThreadId drd_tid = DRD_(VgThreadIdToDrdThreadId)(vg_tid); struct cond_info* const cond_p = cond_get(cond); if (cond_p && cond_p->waiter_count > 0) @@ -306,7 +306,7 @@ void cond_pre_signal(Addr const cond) VG_(message)(Vg_UserMsg, "[%d/%d] cond_signal cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } @@ -321,7 +321,7 @@ void cond_pre_broadcast(Addr const cond) VG_(message)(Vg_UserMsg, "[%d/%d] cond_broadcast cond 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), cond); } diff --git a/drd/drd_error.c b/drd/drd_error.c index 870cb2e803..5c87812326 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -114,7 +114,7 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri) VG_(message)(Vg_UserMsg, "Conflicting %s by thread %d/%d at 0x%08lx size %ld", dri->access_type == eStore ? "store" : "load", - DrdThreadIdToVgThreadId(dri->tid), + DRD_(DrdThreadIdToVgThreadId)(dri->tid), dri->tid, dri->addr, dri->size); @@ -152,8 +152,9 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri) } if (s_drd_show_conflicting_segments) { - thread_report_conflicting_segments(dri->tid, - dri->addr, dri->size, dri->access_type); + DRD_(thread_report_conflicting_segments)(dri->tid, + dri->addr, dri->size, + dri->access_type); } VG_(free)(descr2); @@ -211,7 +212,7 @@ static void drd_tool_error_pp(Error* const e) "%s: cond 0x%lx, mutex 0x%lx locked by thread %d/%d", VG_(get_error_string)(e), cdi->cond, cdi->mutex, - DrdThreadIdToVgThreadId(cdi->tid), cdi->tid); + DRD_(DrdThreadIdToVgThreadId)(cdi->tid), cdi->tid); VG_(pp_ExeContext)(VG_(get_error_where)(e)); first_observed(cdi->mutex); break; diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c index a219cec693..a13789f46a 100644 --- a/drd/drd_load_store.c +++ b/drd/drd_load_store.c @@ -52,20 +52,20 @@ /* Local variables. */ -static Bool s_drd_check_stack_accesses = False; +static Bool DRD_(s_check_stack_accesses) = False; /* Function definitions. */ Bool DRD_(get_check_stack_accesses)() { - return s_drd_check_stack_accesses; + return DRD_(s_check_stack_accesses); } void DRD_(set_check_stack_accesses)(const Bool c) { tl_assert(c == False || c == True); - s_drd_check_stack_accesses = c; + DRD_(s_check_stack_accesses) = c; } void DRD_(trace_mem_access)(const Addr addr, const SizeT size, @@ -74,7 +74,8 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size, if (DRD_(is_any_traced)(addr, addr + size)) { char vc[80]; - DRD_(vc_snprint)(vc, sizeof(vc), thread_get_vc(thread_get_running_tid())); + DRD_(vc_snprint)(vc, sizeof(vc), + DRD_(thread_get_vc)(DRD_(thread_get_running_tid)())); VG_(message)(Vg_UserMsg, "%s 0x%lx size %ld (vg %d / drd %d / vc %s)", access_type == eLoad @@ -89,11 +90,11 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size, addr, size, VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), vc); VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), VG_(clo_backtrace_size)); - tl_assert(DrdThreadIdToVgThreadId(thread_get_running_tid()) + tl_assert(DRD_(DrdThreadIdToVgThreadId)(DRD_(thread_get_running_tid)()) == VG_(get_running_tid)()); } } @@ -113,7 +114,7 @@ static void drd_report_race(const Addr addr, const SizeT size, { DataRaceErrInfo drei; - drei.tid = thread_get_running_tid(); + drei.tid = DRD_(thread_get_running_tid)(); drei.addr = addr; drei.size = size; drei.access_type = access_type; @@ -132,8 +133,9 @@ VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size) == VgThreadIdToDrdThreadId(VG_(get_running_tid()))); #endif - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_load_triggers_conflict(addr, addr + size) && ! DRD_(is_suppressed)(addr, addr + size)) { @@ -143,8 +145,9 @@ VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size) static VG_REGPARM(1) void drd_trace_load_1(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_load_1_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 1)) { @@ -154,8 +157,9 @@ static VG_REGPARM(1) void drd_trace_load_1(Addr addr) static VG_REGPARM(1) void drd_trace_load_2(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_load_2_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 2)) { @@ -165,8 +169,9 @@ static VG_REGPARM(1) void drd_trace_load_2(Addr addr) static VG_REGPARM(1) void drd_trace_load_4(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_load_4_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 4)) { @@ -176,8 +181,9 @@ static VG_REGPARM(1) void drd_trace_load_4(Addr addr) static VG_REGPARM(1) void drd_trace_load_8(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_load_8_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 8)) { @@ -193,8 +199,9 @@ VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size) == VgThreadIdToDrdThreadId(VG_(get_running_tid()))); #endif - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_store_triggers_conflict(addr, addr + size) && ! DRD_(is_suppressed)(addr, addr + size)) { @@ -204,8 +211,9 @@ VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size) static VG_REGPARM(1) void drd_trace_store_1(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_store_1_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 1)) { @@ -215,8 +223,9 @@ static VG_REGPARM(1) void drd_trace_store_1(Addr addr) static VG_REGPARM(1) void drd_trace_store_2(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_store_2_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 2)) { @@ -226,8 +235,9 @@ static VG_REGPARM(1) void drd_trace_store_2(Addr addr) static VG_REGPARM(1) void drd_trace_store_4(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_store_4_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 4)) { @@ -237,8 +247,9 @@ static VG_REGPARM(1) void drd_trace_store_4(Addr addr) static VG_REGPARM(1) void drd_trace_store_8(Addr addr) { - if (running_thread_is_recording() - && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) + if (DRD_(running_thread_is_recording)() + && (DRD_(s_check_stack_accesses) + || ! DRD_(thread_address_on_stack)(addr)) && bm_access_store_8_triggers_conflict(addr) && ! DRD_(is_suppressed)(addr, addr + 8)) { @@ -298,7 +309,7 @@ static void instrument_load(IRSB* const bb, mkIRExpr_HWord(size))))); } - if (! s_drd_check_stack_accesses && is_stack_access(bb, addr_expr)) + if (! DRD_(s_check_stack_accesses) && is_stack_access(bb, addr_expr)) return; switch (size) @@ -363,7 +374,7 @@ static void instrument_store(IRSB* const bb, mkIRExpr_HWord(size))))); } - if (! s_drd_check_stack_accesses && is_stack_access(bb, addr_expr)) + if (! DRD_(s_check_stack_accesses) && is_stack_access(bb, addr_expr)) return; switch (size) diff --git a/drd/drd_main.c b/drd/drd_main.c index ca8b6c35fd..d61dcdabbb 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -118,7 +118,7 @@ static Bool DRD_(process_cmd_line_option)(Char* arg) rwlock_set_shared_threshold(shared_threshold_ms); } if (segment_merging != -1) - thread_set_segment_merging(segment_merging); + DRD_(thread_set_segment_merging)(segment_merging); if (show_confl_seg != -1) set_show_conflicting_segments(show_confl_seg); if (trace_address) @@ -133,11 +133,11 @@ static Bool DRD_(process_cmd_line_option)(Char* arg) if (trace_cond != -1) cond_set_trace(trace_cond); if (trace_csw != -1) - thread_trace_context_switches(trace_csw); + DRD_(thread_trace_context_switches)(trace_csw); if (trace_fork_join != -1) DRD_(thread_set_trace_fork_join)(trace_fork_join); if (trace_conflict_set != -1) - thread_trace_conflict_set(trace_conflict_set); + DRD_(thread_trace_conflict_set)(trace_conflict_set); if (trace_mutex != -1) mutex_set_trace(trace_mutex); if (trace_rwlock != -1) @@ -249,7 +249,7 @@ static void drd_post_mem_write(const CorePart part, const Addr a, const SizeT size) { - thread_set_vg_running_tid(VG_(get_running_tid)()); + DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)()); if (size > 0) { drd_trace_store(a, size); @@ -295,7 +295,7 @@ void drd_stop_using_mem(const Addr a1, const SizeT len, } if (! is_stack_mem || DRD_(get_check_stack_accesses)()) { - thread_stop_using_mem(a1, a2); + DRD_(thread_stop_using_mem)(a1, a2); DRD_(clientobj_stop_using_mem)(a1, a2); DRD_(suppression_stop_using_mem)(a1, a2); } @@ -361,7 +361,7 @@ void drd_start_using_mem_w_perms(const Addr a, const SizeT len, const Bool rr, const Bool ww, const Bool xx, ULong di_handle) { - thread_set_vg_running_tid(VG_(get_running_tid)()); + DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)()); drd_start_using_mem(a, len); @@ -374,7 +374,8 @@ void drd_start_using_mem_w_perms(const Addr a, const SizeT len, static __inline__ void drd_start_using_mem_stack(const Addr a, const SizeT len) { - thread_set_stack_min(thread_get_running_tid(), a - VG_STACK_REDZONE_SZB); + DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(), + a - VG_STACK_REDZONE_SZB); drd_start_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB); } @@ -385,8 +386,8 @@ void drd_start_using_mem_stack(const Addr a, const SizeT len) static __inline__ void drd_stop_using_mem_stack(const Addr a, const SizeT len) { - thread_set_stack_min(thread_get_running_tid(), - a + len - VG_STACK_REDZONE_SZB); + DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(), + a + len - VG_STACK_REDZONE_SZB); drd_stop_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB, True); } @@ -395,7 +396,7 @@ static void drd_start_using_mem_stack_signal( const Addr a, const SizeT len, ThreadId tid_for_whom_the_signal_frame_is_being_constructed) { - thread_set_vg_running_tid(VG_(get_running_tid)()); + DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)()); drd_start_using_mem(a, len); } @@ -407,12 +408,12 @@ static void drd_stop_using_mem_stack_signal(Addr a, SizeT len) static void drd_pre_thread_create(const ThreadId creator, const ThreadId created) { - const DrdThreadId drd_creator = VgThreadIdToDrdThreadId(creator); + const DrdThreadId drd_creator = DRD_(VgThreadIdToDrdThreadId)(creator); tl_assert(created != VG_INVALID_THREADID); - thread_pre_create(drd_creator, created); - if (IsValidDrdThreadId(drd_creator)) + DRD_(thread_pre_create)(drd_creator, created); + if (DRD_(IsValidDrdThreadId)(drd_creator)) { - thread_new_segment(drd_creator); + DRD_(thread_new_segment)(drd_creator); } if (DRD_(thread_get_trace_fork_join)()) { @@ -432,7 +433,7 @@ void drd_post_thread_create(const ThreadId vg_created) tl_assert(vg_created != VG_INVALID_THREADID); - drd_created = thread_post_create(vg_created); + drd_created = DRD_(thread_post_create)(vg_created); if (DRD_(thread_get_trace_fork_join)()) { VG_(message)(Vg_DebugMsg, @@ -441,9 +442,9 @@ void drd_post_thread_create(const ThreadId vg_created) } if (! DRD_(get_check_stack_accesses)()) { - DRD_(start_suppression)(thread_get_stack_max(drd_created) - - thread_get_stack_size(drd_created), - thread_get_stack_max(drd_created), + DRD_(start_suppression)(DRD_(thread_get_stack_max)(drd_created) + - DRD_(thread_get_stack_size)(drd_created), + DRD_(thread_get_stack_max)(drd_created), "stack"); } } @@ -455,28 +456,29 @@ static void drd_thread_finished(ThreadId vg_tid) tl_assert(VG_(get_running_tid)() == vg_tid); - drd_tid = VgThreadIdToDrdThreadId(vg_tid); + drd_tid = DRD_(VgThreadIdToDrdThreadId)(vg_tid); if (DRD_(thread_get_trace_fork_join)()) { VG_(message)(Vg_DebugMsg, "drd_thread_finished tid = %d/%d%s", vg_tid, drd_tid, - thread_get_joinable(drd_tid) + DRD_(thread_get_joinable)(drd_tid) ? "" : " (which is a detached thread)"); } if (DRD_(s_show_stack_usage)) { - const SizeT stack_size = thread_get_stack_size(drd_tid); + const SizeT stack_size = DRD_(thread_get_stack_size)(drd_tid); const SizeT used_stack - = thread_get_stack_max(drd_tid) - thread_get_stack_min_min(drd_tid); + = (DRD_(thread_get_stack_max)(drd_tid) + - DRD_(thread_get_stack_min_min)(drd_tid)); VG_(message)(Vg_UserMsg, "thread %d/%d%s finished and used %ld bytes out of %ld" " on its stack. Margin: %ld bytes.", vg_tid, drd_tid, - thread_get_joinable(drd_tid) + DRD_(thread_get_joinable)(drd_tid) ? "" : " (which is a detached thread)", used_stack, @@ -484,12 +486,12 @@ static void drd_thread_finished(ThreadId vg_tid) stack_size - used_stack); } - drd_stop_using_mem(thread_get_stack_min(drd_tid), - thread_get_stack_max(drd_tid) - - thread_get_stack_min(drd_tid), + drd_stop_using_mem(DRD_(thread_get_stack_min)(drd_tid), + DRD_(thread_get_stack_max)(drd_tid) + - DRD_(thread_get_stack_min)(drd_tid), True); - thread_stop_recording(drd_tid); - thread_finished(drd_tid); + DRD_(thread_stop_recording)(drd_tid); + DRD_(thread_finished)(drd_tid); } // @@ -514,7 +516,7 @@ static void DRD_(post_clo_init)(void) static void drd_start_client_code(const ThreadId tid, const ULong bbs_done) { tl_assert(tid == VG_(get_running_tid)()); - thread_set_vg_running_tid(tid); + DRD_(thread_set_vg_running_tid)(tid); } static void DRD_(fini)(Int exitcode) @@ -527,12 +529,12 @@ static void DRD_(fini)(Int exitcode) ULong dscvc; update_conflict_set_count - = thread_get_update_conflict_set_count(&dsnsc, &dscvc); + = DRD_(thread_get_update_conflict_set_count)(&dsnsc, &dscvc); VG_(message)(Vg_UserMsg, " thread: %lld context switches" " / %lld updates of the conflict set", - thread_get_context_switch_count(), + DRD_(thread_get_context_switch_count)(), update_conflict_set_count); VG_(message)(Vg_UserMsg, " (%lld new sg + %lld combine vc + %lld csw).", @@ -544,7 +546,7 @@ static void DRD_(fini)(Int exitcode) " %lld discard points.", DRD_(sg_get_segments_created_count)(), DRD_(sg_get_max_segments_alive_count)(), - thread_get_discard_ordered_segments_count()); + DRD_(thread_get_discard_ordered_segments_count)()); VG_(message)(Vg_UserMsg, " (%lld m, %lld rw, %lld s, %lld b)", get_mutex_segment_creation_count(), diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c index 136a644a44..3f265089a8 100644 --- a/drd/drd_mutex.c +++ b/drd/drd_mutex.c @@ -90,7 +90,7 @@ static void mutex_cleanup(struct mutex_info* p) VG_(message)(Vg_UserMsg, "[%d/%d] mutex_destroy %s 0x%lx rc %d owner %d", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), mutex_get_typename(p), p->a1, p ? p->recursion_count : -1, @@ -167,7 +167,7 @@ mutex_init(const Addr mutex, const MutexT mutex_type) VG_(message)(Vg_UserMsg, "[%d/%d] mutex_init %s 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), mutex_type_name(mutex_type), mutex); } @@ -230,7 +230,7 @@ void mutex_pre_lock(const Addr mutex, MutexT mutex_type, VG_(message)(Vg_UserMsg, "[%d/%d] %s %s 0x%lx rc %d owner %d", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), trylock ? "pre_mutex_lock " : "mutex_trylock ", p ? mutex_get_typename(p) : "(?)", mutex, @@ -253,7 +253,7 @@ void mutex_pre_lock(const Addr mutex, MutexT mutex_type, } if (! trylock - && p->owner == thread_get_running_tid() + && p->owner == DRD_(thread_get_running_tid)() && p->recursion_count >= 1 && mutex_type != mutex_type_recursive_mutex) { @@ -274,7 +274,7 @@ void mutex_pre_lock(const Addr mutex, MutexT mutex_type, void mutex_post_lock(const Addr mutex, const Bool took_lock, const Bool post_cond_wait) { - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); struct mutex_info* p; p = mutex_get(mutex); @@ -303,9 +303,9 @@ void mutex_post_lock(const Addr mutex, const Bool took_lock, if (last_owner != drd_tid && last_owner != DRD_INVALID_THREADID) { tl_assert(p->last_locked_segment); - thread_combine_vc2(drd_tid, &p->last_locked_segment->vc); + DRD_(thread_combine_vc2)(drd_tid, &p->last_locked_segment->vc); } - thread_new_segment(drd_tid); + DRD_(thread_new_segment)(drd_tid); s_mutex_segment_creation_count++; p->owner = drd_tid; @@ -338,7 +338,7 @@ void mutex_post_lock(const Addr mutex, const Bool took_lock, */ void mutex_unlock(const Addr mutex, MutexT mutex_type) { - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); const ThreadId vg_tid = VG_(get_running_tid)(); struct mutex_info* p; @@ -418,8 +418,8 @@ void mutex_unlock(const Addr mutex, MutexT mutex_type) /* current vector clock of the thread such that it is available when */ /* this mutex is locked again. */ - thread_get_latest_segment(&p->last_locked_segment, drd_tid); - thread_new_segment(drd_tid); + DRD_(thread_get_latest_segment)(&p->last_locked_segment, drd_tid); + DRD_(thread_new_segment)(drd_tid); p->acquired_at = 0; s_mutex_segment_creation_count++; } diff --git a/drd/drd_rwlock.c b/drd/drd_rwlock.c index 78abbb87ae..0cda736e1c 100644 --- a/drd/drd_rwlock.c +++ b/drd/drd_rwlock.c @@ -166,7 +166,7 @@ static void rwlock_combine_other_vc(struct rwlock_info* const p, { if (q->tid != tid && (readers_too || q->last_lock_was_writer_lock)) { - thread_combine_vc2(tid, &q->last_unlock_segment->vc); + DRD_(thread_combine_vc2)(tid, &q->last_unlock_segment->vc); } } } @@ -198,7 +198,7 @@ static void rwlock_cleanup(struct rwlock_info* p) VG_(message)(Vg_UserMsg, "[%d/%d] rwlock_destroy 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), p->a1); } @@ -265,7 +265,7 @@ struct rwlock_info* rwlock_pre_init(const Addr rwlock) VG_(message)(Vg_UserMsg, "[%d/%d] rwlock_init 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), rwlock); } @@ -323,14 +323,14 @@ void rwlock_pre_rdlock(const Addr rwlock) VG_(message)(Vg_UserMsg, "[%d/%d] pre_rwlock_rdlock 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), rwlock); } p = rwlock_get_or_allocate(rwlock); tl_assert(p); - if (rwlock_is_wrlocked_by(p, thread_get_running_tid())) + if (rwlock_is_wrlocked_by(p, DRD_(thread_get_running_tid)())) { VG_(message)(Vg_UserMsg, "reader-writer lock 0x%lx is already locked for" @@ -345,7 +345,7 @@ void rwlock_pre_rdlock(const Addr rwlock) */ void rwlock_post_rdlock(const Addr rwlock, const Bool took_lock) { - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); struct rwlock_info* p; struct rwlock_thread_info* q; @@ -370,7 +370,7 @@ void rwlock_post_rdlock(const Addr rwlock, const Bool took_lock) { rwlock_combine_other_vc(p, drd_tid, False); q->last_lock_was_writer_lock = False; - thread_new_segment(drd_tid); + DRD_(thread_new_segment)(drd_tid); s_rwlock_segment_creation_count++; p->acquiry_time_ms = VG_(read_millisecond_timer)(); @@ -394,7 +394,7 @@ void rwlock_pre_wrlock(const Addr rwlock) VG_(message)(Vg_UserMsg, "[%d/%d] pre_rwlock_wrlock 0x%lx", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), rwlock); } @@ -405,7 +405,7 @@ void rwlock_pre_wrlock(const Addr rwlock) tl_assert(p); - if (rwlock_is_wrlocked_by(p, thread_get_running_tid())) + if (rwlock_is_wrlocked_by(p, DRD_(thread_get_running_tid)())) { RwlockErrInfo REI = { p->a1 }; VG_(maybe_record_error)(VG_(get_running_tid)(), @@ -423,7 +423,7 @@ void rwlock_pre_wrlock(const Addr rwlock) */ void rwlock_post_wrlock(const Addr rwlock, const Bool took_lock) { - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); struct rwlock_info* p; struct rwlock_thread_info* q; @@ -441,13 +441,13 @@ void rwlock_post_wrlock(const Addr rwlock, const Bool took_lock) if (! p || ! took_lock) return; - q = lookup_or_insert_node(p->thread_info, thread_get_running_tid()); + q = lookup_or_insert_node(p->thread_info, DRD_(thread_get_running_tid)()); tl_assert(q->writer_nesting_count == 0); q->writer_nesting_count++; q->last_lock_was_writer_lock = True; tl_assert(q->writer_nesting_count == 1); rwlock_combine_other_vc(p, drd_tid, True); - thread_new_segment(drd_tid); + DRD_(thread_new_segment)(drd_tid); s_rwlock_segment_creation_count++; p->acquiry_time_ms = VG_(read_millisecond_timer)(); p->acquired_at = VG_(record_ExeContext)(VG_(get_running_tid)(), 0); @@ -464,7 +464,7 @@ void rwlock_post_wrlock(const Addr rwlock, const Bool took_lock) */ void rwlock_pre_unlock(const Addr rwlock) { - const DrdThreadId drd_tid = thread_get_running_tid(); + const DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); const ThreadId vg_tid = VG_(get_running_tid)(); struct rwlock_info* p; struct rwlock_thread_info* q; @@ -548,8 +548,8 @@ void rwlock_pre_unlock(const Addr rwlock) /* current vector clock of the thread such that it is available when */ /* this rwlock is locked again. */ - thread_get_latest_segment(&q->last_unlock_segment, drd_tid); - thread_new_segment(drd_tid); + DRD_(thread_get_latest_segment)(&q->last_unlock_segment, drd_tid); + DRD_(thread_new_segment)(drd_tid); s_rwlock_segment_creation_count++; } } diff --git a/drd/drd_segment.c b/drd/drd_segment.c index 0c7cf034e7..266e819e0d 100644 --- a/drd/drd_segment.c +++ b/drd/drd_segment.c @@ -56,13 +56,14 @@ void DRD_(sg_init)(Segment* const sg, DrdThreadId const created) { Segment* creator_sg; - ThreadId vg_created = DrdThreadIdToVgThreadId(created); + ThreadId vg_created = DRD_(DrdThreadIdToVgThreadId)(created); tl_assert(sg); - tl_assert(creator == DRD_INVALID_THREADID || IsValidDrdThreadId(creator)); + tl_assert(creator == DRD_INVALID_THREADID + || DRD_(IsValidDrdThreadId)(creator)); creator_sg = (creator != DRD_INVALID_THREADID - ? thread_get_segment(creator) : 0); + ? DRD_(thread_get_segment)(creator) : 0); sg->next = 0; sg->prev = 0; @@ -86,7 +87,7 @@ void DRD_(sg_init)(Segment* const sg, VG_(snprintf)(msg, sizeof(msg), "New segment for thread %d/%d with vc ", created != VG_INVALID_THREADID - ? DrdThreadIdToVgThreadId(created) + ? DRD_(DrdThreadIdToVgThreadId)(created) : DRD_INVALID_THREADID, created); DRD_(vc_snprint)(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg), diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index c3bad6b305..5d6143f841 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -160,7 +160,7 @@ struct semaphore_info* semaphore_init(const Addr semaphore, VG_(message)(Vg_UserMsg, "[%d/%d] semaphore_init 0x%lx value %u", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), semaphore, value); } @@ -202,7 +202,7 @@ void semaphore_destroy(const Addr semaphore) VG_(message)(Vg_UserMsg, "[%d/%d] semaphore_destroy 0x%lx value %u", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), semaphore, p ? p->value : 0); } @@ -249,7 +249,7 @@ void semaphore_post_wait(const DrdThreadId tid, const Addr semaphore, VG_(message)(Vg_UserMsg, "[%d/%d] semaphore_wait 0x%lx value %u -> %u", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), semaphore, p ? p->value : 0, p ? p->value - 1 : 0); @@ -282,10 +282,10 @@ void semaphore_post_wait(const DrdThreadId tid, const Addr semaphore, if (p->last_sem_post_tid != tid && p->last_sem_post_tid != DRD_INVALID_THREADID) { - thread_combine_vc2(tid, &sg->vc); + DRD_(thread_combine_vc2)(tid, &sg->vc); } DRD_(sg_put)(sg); - thread_new_segment(tid); + DRD_(thread_new_segment)(tid); s_semaphore_segment_creation_count++; } } @@ -305,15 +305,15 @@ void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore) VG_(message)(Vg_UserMsg, "[%d/%d] semaphore_post 0x%lx value %u -> %u", VG_(get_running_tid)(), - thread_get_running_tid(), + DRD_(thread_get_running_tid)(), semaphore, p->value - 1, p->value); } p->last_sem_post_tid = tid; - thread_new_segment(tid); + DRD_(thread_new_segment)(tid); sg = 0; - thread_get_latest_segment(&sg, tid); + DRD_(thread_get_latest_segment)(&sg, tid); tl_assert(sg); segment_push(p, sg); s_semaphore_segment_creation_count++; diff --git a/drd/drd_thread.c b/drd/drd_thread.c index cdb02822e3..3f213e2a4d 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -47,12 +47,13 @@ /* Local functions. */ -static void thread_append_segment(const DrdThreadId tid, - Segment* const sg); -static void thread_discard_segment(const DrdThreadId tid, Segment* const sg); -static Bool thread_conflict_set_up_to_date(const DrdThreadId tid); -static void thread_compute_conflict_set(struct bitmap** conflict_set, - const DrdThreadId tid); +static void DRD_(thread_append_segment)(const DrdThreadId tid, + Segment* const sg); +static void DRD_(thread_discard_segment)(const DrdThreadId tid, + Segment* const sg); +static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid); +static void DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set, + const DrdThreadId tid); /* Local variables. */ @@ -76,13 +77,13 @@ static Bool DRD_(s_segment_merging) = True; /* Function definitions. */ -void thread_trace_context_switches(const Bool t) +void DRD_(thread_trace_context_switches)(const Bool t) { tl_assert(t == False || t == True); DRD_(s_trace_context_switches) = t; } -void thread_trace_conflict_set(const Bool t) +void DRD_(thread_trace_conflict_set)(const Bool t) { tl_assert(t == False || t == True); DRD_(s_trace_conflict_set) = t; @@ -99,7 +100,7 @@ void DRD_(thread_set_trace_fork_join)(const Bool t) DRD_(s_trace_fork_join) = t; } -void thread_set_segment_merging(const Bool m) +void DRD_(thread_set_segment_merging)(const Bool m) { tl_assert(m == False || m == True); DRD_(s_segment_merging) = m; @@ -109,7 +110,7 @@ void thread_set_segment_merging(const Bool m) * Convert Valgrind's ThreadId into a DrdThreadId. Report failure if * Valgrind's ThreadId does not yet exist. */ -DrdThreadId VgThreadIdToDrdThreadId(const ThreadId tid) +DrdThreadId DRD_(VgThreadIdToDrdThreadId)(const ThreadId tid) { int i; @@ -128,12 +129,11 @@ DrdThreadId VgThreadIdToDrdThreadId(const ThreadId tid) return DRD_INVALID_THREADID; } -static -DrdThreadId VgThreadIdToNewDrdThreadId(const ThreadId tid) +static DrdThreadId DRD_(VgThreadIdToNewDrdThreadId)(const ThreadId tid) { int i; - tl_assert(VgThreadIdToDrdThreadId(tid) == DRD_INVALID_THREADID); + tl_assert(DRD_(VgThreadIdToDrdThreadId)(tid) == DRD_INVALID_THREADID); for (i = 1; i < DRD_N_THREADS; i++) { @@ -163,7 +163,7 @@ DrdThreadId VgThreadIdToNewDrdThreadId(const ThreadId tid) return DRD_INVALID_THREADID; } -DrdThreadId PtThreadIdToDrdThreadId(const PThreadId tid) +DrdThreadId DRD_(PtThreadIdToDrdThreadId)(const PThreadId tid) { int i; @@ -180,7 +180,7 @@ DrdThreadId PtThreadIdToDrdThreadId(const PThreadId tid) return DRD_INVALID_THREADID; } -ThreadId DrdThreadIdToVgThreadId(const DrdThreadId tid) +ThreadId DRD_(DrdThreadIdToVgThreadId)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -195,7 +195,7 @@ ThreadId DrdThreadIdToVgThreadId(const DrdThreadId tid) * ThreadInfo struct. * @return True if sane, False if not. */ -static Bool sane_ThreadInfo(const ThreadInfo* const ti) +static Bool DRD_(sane_ThreadInfo)(const ThreadInfo* const ti) { Segment* p; for (p = ti->first; p; p = p->next) { @@ -222,19 +222,19 @@ static Bool sane_ThreadInfo(const ThreadInfo* const ti) * from the context of the creator thread, before the new thread has been * created. */ -DrdThreadId thread_pre_create(const DrdThreadId creator, - const ThreadId vg_created) +DrdThreadId DRD_(thread_pre_create)(const DrdThreadId creator, + const ThreadId vg_created) { DrdThreadId created; - tl_assert(VgThreadIdToDrdThreadId(vg_created) == DRD_INVALID_THREADID); - created = VgThreadIdToNewDrdThreadId(vg_created); + tl_assert(DRD_(VgThreadIdToDrdThreadId)(vg_created) == DRD_INVALID_THREADID); + created = DRD_(VgThreadIdToNewDrdThreadId)(vg_created); tl_assert(0 <= (int)created && created < DRD_N_THREADS && created != DRD_INVALID_THREADID); tl_assert(DRD_(g_threadinfo)[created].first == 0); tl_assert(DRD_(g_threadinfo)[created].last == 0); - thread_append_segment(created, DRD_(sg_new)(creator, created)); + DRD_(thread_append_segment)(created, DRD_(sg_new)(creator, created)); return created; } @@ -245,9 +245,9 @@ DrdThreadId thread_pre_create(const DrdThreadId creator, * on the newly created thread, e.g. from the handler installed via * VG_(track_pre_thread_first_insn)(). */ -DrdThreadId thread_post_create(const ThreadId vg_created) +DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created) { - const DrdThreadId created = VgThreadIdToDrdThreadId(vg_created); + const DrdThreadId created = DRD_(VgThreadIdToDrdThreadId)(vg_created); tl_assert(0 <= (int)created && created < DRD_N_THREADS && created != DRD_INVALID_THREADID); @@ -268,16 +268,16 @@ DrdThreadId thread_post_create(const ThreadId vg_created) */ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) { - tl_assert(IsValidDrdThreadId(drd_joiner)); - tl_assert(IsValidDrdThreadId(drd_joinee)); - thread_new_segment(drd_joinee); - thread_combine_vc(drd_joiner, drd_joinee); - thread_new_segment(drd_joiner); + tl_assert(DRD_(IsValidDrdThreadId)(drd_joiner)); + tl_assert(DRD_(IsValidDrdThreadId)(drd_joinee)); + DRD_(thread_new_segment)(drd_joinee); + DRD_(thread_combine_vc)(drd_joiner, drd_joinee); + DRD_(thread_new_segment)(drd_joiner); if (DRD_(s_trace_fork_join)) { - const ThreadId joiner = DrdThreadIdToVgThreadId(drd_joiner); - const ThreadId joinee = DrdThreadIdToVgThreadId(drd_joinee); + const ThreadId joiner = DRD_(DrdThreadIdToVgThreadId)(drd_joiner); + const ThreadId joinee = DRD_(DrdThreadIdToVgThreadId)(drd_joinee); const unsigned msg_size = 256; char* msg; @@ -291,7 +291,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) VG_(snprintf)(msg + VG_(strlen)(msg), msg_size - VG_(strlen)(msg), ", new vc: "); DRD_(vc_snprint)(msg + VG_(strlen)(msg), msg_size - VG_(strlen)(msg), - thread_get_vc(drd_joiner)); + DRD_(thread_get_vc)(drd_joiner)); } VG_(message)(Vg_DebugMsg, "%s", msg); VG_(free)(msg); @@ -299,11 +299,11 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) if (! DRD_(get_check_stack_accesses)()) { - DRD_(finish_suppression)(thread_get_stack_max(drd_joinee) - - thread_get_stack_size(drd_joinee), - thread_get_stack_max(drd_joinee)); + DRD_(finish_suppression)(DRD_(thread_get_stack_max)(drd_joinee) + - DRD_(thread_get_stack_size)(drd_joinee), + DRD_(thread_get_stack_max)(drd_joinee)); } - thread_delete(drd_joinee); + DRD_(thread_delete)(drd_joinee); mutex_thread_delete(drd_joinee); cond_thread_delete(drd_joinee); semaphore_thread_delete(drd_joinee); @@ -316,7 +316,8 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) * Any conflicting accesses in the range stack_startup..stack_max will be * ignored. */ -void thread_set_stack_startup(const DrdThreadId tid, const Addr stack_startup) +void DRD_(thread_set_stack_startup)(const DrdThreadId tid, + const Addr stack_startup) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -325,28 +326,28 @@ void thread_set_stack_startup(const DrdThreadId tid, const Addr stack_startup) DRD_(g_threadinfo)[tid].stack_startup = stack_startup; } -Addr thread_get_stack_min(const DrdThreadId tid) +Addr DRD_(thread_get_stack_min)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); return DRD_(g_threadinfo)[tid].stack_min; } -Addr thread_get_stack_min_min(const DrdThreadId tid) +Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); return DRD_(g_threadinfo)[tid].stack_min_min; } -Addr thread_get_stack_max(const DrdThreadId tid) +Addr DRD_(thread_get_stack_max)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); return DRD_(g_threadinfo)[tid].stack_max; } -SizeT thread_get_stack_size(const DrdThreadId tid) +SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -357,7 +358,7 @@ SizeT thread_get_stack_size(const DrdThreadId tid) * Clean up thread-specific data structures. Call this just after * pthread_join(). */ -void thread_delete(const DrdThreadId tid) +void DRD_(thread_delete)(const DrdThreadId tid) { Segment* sg; Segment* sg_prev; @@ -384,7 +385,7 @@ void thread_delete(const DrdThreadId tid) * thread_delete() is called. Note: thread_delete() is only called for * joinable threads, not for detached threads. */ -void thread_finished(const DrdThreadId tid) +void DRD_(thread_finished)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -406,7 +407,7 @@ void thread_finished(const DrdThreadId tid) } /** Called just before pthread_cancel(). */ -void thread_pre_cancel(const DrdThreadId tid) +void DRD_(thread_pre_cancel)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -415,7 +416,7 @@ void thread_pre_cancel(const DrdThreadId tid) DRD_(g_threadinfo)[tid].synchr_nesting = 0; } -void thread_set_pthreadid(const DrdThreadId tid, const PThreadId ptid) +void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -425,14 +426,14 @@ void thread_set_pthreadid(const DrdThreadId tid, const PThreadId ptid) DRD_(g_threadinfo)[tid].pt_threadid = ptid; } -Bool thread_get_joinable(const DrdThreadId tid) +Bool DRD_(thread_get_joinable)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); return ! DRD_(g_threadinfo)[tid].detached_posix_thread; } -void thread_set_joinable(const DrdThreadId tid, const Bool joinable) +void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -448,20 +449,22 @@ void thread_set_joinable(const DrdThreadId tid, const Bool joinable) DRD_(g_threadinfo)[tid].detached_posix_thread = ! joinable; } -void thread_set_vg_running_tid(const ThreadId vg_tid) +void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid) { tl_assert(vg_tid != VG_INVALID_THREADID); if (vg_tid != DRD_(s_vg_running_tid)) { - thread_set_running_tid(vg_tid, VgThreadIdToDrdThreadId(vg_tid)); + DRD_(thread_set_running_tid)(vg_tid, + DRD_(VgThreadIdToDrdThreadId)(vg_tid)); } tl_assert(DRD_(s_vg_running_tid) != VG_INVALID_THREADID); tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID); } -void thread_set_running_tid(const ThreadId vg_tid, const DrdThreadId drd_tid) +void DRD_(thread_set_running_tid)(const ThreadId vg_tid, + const DrdThreadId drd_tid) { tl_assert(vg_tid != VG_INVALID_THREADID); tl_assert(drd_tid != DRD_INVALID_THREADID); @@ -475,12 +478,12 @@ void thread_set_running_tid(const ThreadId vg_tid, const DrdThreadId drd_tid) "Context switch from thread %d/%d to thread %d/%d;" " segments: %llu", DRD_(s_vg_running_tid), DRD_(g_drd_running_tid), - DrdThreadIdToVgThreadId(drd_tid), drd_tid, + DRD_(DrdThreadIdToVgThreadId)(drd_tid), drd_tid, DRD_(sg_get_segments_alive_count)()); } DRD_(s_vg_running_tid) = vg_tid; DRD_(g_drd_running_tid) = drd_tid; - thread_compute_conflict_set(&DRD_(g_conflict_set), drd_tid); + DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), drd_tid); DRD_(s_context_switch_count)++; } @@ -488,31 +491,32 @@ void thread_set_running_tid(const ThreadId vg_tid, const DrdThreadId drd_tid) tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID); } -int thread_enter_synchr(const DrdThreadId tid) +int DRD_(thread_enter_synchr)(const DrdThreadId tid) { - tl_assert(IsValidDrdThreadId(tid)); + tl_assert(DRD_(IsValidDrdThreadId)(tid)); return DRD_(g_threadinfo)[tid].synchr_nesting++; } -int thread_leave_synchr(const DrdThreadId tid) +int DRD_(thread_leave_synchr)(const DrdThreadId tid) { - tl_assert(IsValidDrdThreadId(tid)); + tl_assert(DRD_(IsValidDrdThreadId)(tid)); tl_assert(DRD_(g_threadinfo)[tid].synchr_nesting >= 1); return --DRD_(g_threadinfo)[tid].synchr_nesting; } -int thread_get_synchr_nesting_count(const DrdThreadId tid) +int DRD_(thread_get_synchr_nesting_count)(const DrdThreadId tid) { - tl_assert(IsValidDrdThreadId(tid)); + tl_assert(DRD_(IsValidDrdThreadId)(tid)); return DRD_(g_threadinfo)[tid].synchr_nesting; } /** Append a new segment at the end of the segment list. */ -static void thread_append_segment(const DrdThreadId tid, Segment* const sg) +static +void DRD_(thread_append_segment)(const DrdThreadId tid, Segment* const sg) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); - // tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[tid])); + // tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); sg->prev = DRD_(g_threadinfo)[tid].last; sg->next = 0; if (DRD_(g_threadinfo)[tid].last) @@ -520,18 +524,19 @@ static void thread_append_segment(const DrdThreadId tid, Segment* const sg) DRD_(g_threadinfo)[tid].last = sg; if (DRD_(g_threadinfo)[tid].first == 0) DRD_(g_threadinfo)[tid].first = sg; - // tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[tid])); + // tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); } /** * Remove a segment from the segment list of thread threadid, and free the * associated memory. */ -static void thread_discard_segment(const DrdThreadId tid, Segment* const sg) +static +void DRD_(thread_discard_segment)(const DrdThreadId tid, Segment* const sg) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); - //tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[tid])); + //tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); if (sg->prev) sg->prev->next = sg->next; @@ -543,10 +548,10 @@ static void thread_discard_segment(const DrdThreadId tid, Segment* const sg) DRD_(g_threadinfo)[tid].last = sg->prev; DRD_(sg_put)(sg); - //tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[tid])); + //tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); } -VectorClock* thread_get_vc(const DrdThreadId tid) +VectorClock* DRD_(thread_get_vc)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -557,7 +562,7 @@ VectorClock* thread_get_vc(const DrdThreadId tid) /** * Return the latest segment of thread 'tid' and increment its reference count. */ -void thread_get_latest_segment(Segment** sg, const DrdThreadId tid) +void DRD_(thread_get_latest_segment)(Segment** sg, const DrdThreadId tid) { tl_assert(sg); tl_assert(0 <= (int)tid && tid < DRD_N_THREADS @@ -573,14 +578,15 @@ void thread_get_latest_segment(Segment** sg, const DrdThreadId tid) * (Michiel Ronsse calls this "clock snooping" in his papers about DIOTA). * @param vc pointer to a vectorclock, holds result upon return. */ -static void thread_compute_minimum_vc(VectorClock* vc) +static void DRD_(thread_compute_minimum_vc)(VectorClock* vc) { unsigned i; Bool first; Segment* latest_sg; first = True; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { latest_sg = DRD_(g_threadinfo)[i].last; if (latest_sg) @@ -594,14 +600,15 @@ static void thread_compute_minimum_vc(VectorClock* vc) } } -static void thread_compute_maximum_vc(VectorClock* vc) +static void DRD_(thread_compute_maximum_vc)(VectorClock* vc) { unsigned i; Bool first; Segment* latest_sg; first = True; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { latest_sg = DRD_(g_threadinfo)[i].last; if (latest_sg) @@ -620,7 +627,7 @@ static void thread_compute_maximum_vc(VectorClock* vc) * clock of every thread -- these segments can no longer be involved in a * data race. */ -static void thread_discard_ordered_segments(void) +static void DRD_(thread_discard_ordered_segments)(void) { unsigned i; VectorClock thread_vc_min; @@ -628,14 +635,14 @@ static void thread_discard_ordered_segments(void) DRD_(s_discard_ordered_segments_count)++; DRD_(vc_init)(&thread_vc_min, 0, 0); - thread_compute_minimum_vc(&thread_vc_min); + DRD_(thread_compute_minimum_vc)(&thread_vc_min); if (DRD_(sg_get_trace)()) { char msg[256]; VectorClock thread_vc_max; DRD_(vc_init)(&thread_vc_max, 0, 0); - thread_compute_maximum_vc(&thread_vc_max); + DRD_(thread_compute_maximum_vc)(&thread_vc_max); VG_(snprintf)(msg, sizeof(msg), "Discarding ordered segments -- min vc is "); DRD_(vc_snprint)(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg), @@ -648,7 +655,8 @@ static void thread_discard_ordered_segments(void) DRD_(vc_cleanup)(&thread_vc_max); } - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { Segment* sg; Segment* sg_next; @@ -656,7 +664,7 @@ static void thread_discard_ordered_segments(void) sg && (sg_next = sg->next) && DRD_(vc_lte)(&sg->vc, &thread_vc_min); sg = sg_next) { - thread_discard_segment(i, sg); + DRD_(thread_discard_segment)(i, sg); } } DRD_(vc_cleanup)(&thread_vc_min); @@ -675,11 +683,12 @@ static void thread_merge_segments(void) { unsigned i; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { Segment* sg; - // tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[i])); + // tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[i])); for (sg = DRD_(g_threadinfo)[i].first; sg; sg = sg->next) { @@ -690,11 +699,11 @@ static void thread_merge_segments(void) { /* Merge sg and sg->next into sg. */ DRD_(sg_merge)(sg, sg->next); - thread_discard_segment(i, sg->next); + DRD_(thread_discard_segment)(i, sg->next); } } - // tl_assert(sane_ThreadInfo(&DRD_(g_threadinfo)[i])); + // tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[i])); } } @@ -729,7 +738,8 @@ static Bool conflict_set_update_needed(const DrdThreadId tid, if (old_sg == 0) return True; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { Segment* q; @@ -770,7 +780,7 @@ static Bool conflict_set_update_needed(const DrdThreadId tid, * Create a new segment for the specified thread, and discard any segments * that cannot cause races anymore. */ -void thread_new_segment(const DrdThreadId tid) +void DRD_(thread_new_segment)(const DrdThreadId tid) { Segment* new_sg; @@ -778,20 +788,20 @@ void thread_new_segment(const DrdThreadId tid) && tid != DRD_INVALID_THREADID); new_sg = DRD_(sg_new)(tid, tid); - thread_append_segment(tid, new_sg); + DRD_(thread_append_segment)(tid, new_sg); if (conflict_set_update_needed(tid, new_sg)) { - thread_compute_conflict_set(&DRD_(g_conflict_set), - DRD_(g_drd_running_tid)); + DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), + DRD_(g_drd_running_tid)); DRD_(s_conflict_set_new_segment_count)++; } else if (tid == DRD_(g_drd_running_tid)) { - tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); + tl_assert(DRD_(thread_conflict_set_up_to_date)(DRD_(g_drd_running_tid))); } - thread_discard_ordered_segments(); + DRD_(thread_discard_ordered_segments)(); if (DRD_(s_segment_merging)) { @@ -800,7 +810,7 @@ void thread_new_segment(const DrdThreadId tid) } /** Call this function after thread 'joiner' joined thread 'joinee'. */ -void thread_combine_vc(DrdThreadId joiner, DrdThreadId joinee) +void DRD_(thread_combine_vc)(DrdThreadId joiner, DrdThreadId joinee) { tl_assert(joiner != joinee); tl_assert(0 <= (int)joiner && joiner < DRD_N_THREADS @@ -811,11 +821,11 @@ void thread_combine_vc(DrdThreadId joiner, DrdThreadId joinee) tl_assert(DRD_(g_threadinfo)[joinee].last); DRD_(vc_combine)(&DRD_(g_threadinfo)[joiner].last->vc, &DRD_(g_threadinfo)[joinee].last->vc); - thread_discard_ordered_segments(); + DRD_(thread_discard_ordered_segments)(); if (joiner == DRD_(g_drd_running_tid)) { - thread_compute_conflict_set(&DRD_(g_conflict_set), joiner); + DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), joiner); } } @@ -824,15 +834,15 @@ void thread_combine_vc(DrdThreadId joiner, DrdThreadId joinee) * synchronization until the memory accesses in the segment with vector clock * 'vc' finished. */ -void thread_combine_vc2(DrdThreadId tid, const VectorClock* const vc) +void DRD_(thread_combine_vc2)(DrdThreadId tid, const VectorClock* const vc) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); tl_assert(DRD_(g_threadinfo)[tid].last); tl_assert(vc); DRD_(vc_combine)(&DRD_(g_threadinfo)[tid].last->vc, vc); - thread_compute_conflict_set(&DRD_(g_conflict_set), tid); - thread_discard_ordered_segments(); + DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), tid); + DRD_(thread_discard_ordered_segments)(); DRD_(s_conflict_set_combine_vc_count)++; } @@ -841,14 +851,15 @@ void thread_combine_vc2(DrdThreadId tid, const VectorClock* const vc) * [ a1, a2 [, e.g. because of a call to free() or a stack pointer * increase. */ -void thread_stop_using_mem(const Addr a1, const Addr a2) +void DRD_(thread_stop_using_mem)(const Addr a1, const Addr a2) { DrdThreadId other_user; unsigned i; /* For all threads, mark the range [ a1, a2 [ as no longer in use. */ other_user = DRD_INVALID_THREADID; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { Segment* p; for (p = DRD_(g_threadinfo)[i].first; p; p = p->next) @@ -873,11 +884,12 @@ void thread_stop_using_mem(const Addr a1, const Addr a2) if (other_user != DRD_INVALID_THREADID && bm_has_any_access(DRD_(g_conflict_set), a1, a2)) { - thread_compute_conflict_set(&DRD_(g_conflict_set), thread_get_running_tid()); + DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set), + DRD_(thread_get_running_tid)()); } } -void thread_start_recording(const DrdThreadId tid) +void DRD_(thread_start_recording)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -885,7 +897,7 @@ void thread_start_recording(const DrdThreadId tid) DRD_(g_threadinfo)[tid].is_recording = True; } -void thread_stop_recording(const DrdThreadId tid) +void DRD_(thread_stop_recording)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -893,12 +905,13 @@ void thread_stop_recording(const DrdThreadId tid) DRD_(g_threadinfo)[tid].is_recording = False; } -void thread_print_all(void) +void DRD_(thread_print_all)(void) { unsigned i; Segment* p; - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { if (DRD_(g_threadinfo)[i].first) { @@ -923,7 +936,7 @@ static void show_call_stack(const DrdThreadId tid, const Char* const msg, ExeContext* const callstack) { - const ThreadId vg_tid = DrdThreadIdToVgThreadId(tid); + const ThreadId vg_tid = DRD_(DrdThreadIdToVgThreadId)(tid); VG_(message)(Vg_UserMsg, "%s (thread %d/%d)", msg, vg_tid, tid); @@ -958,7 +971,8 @@ thread_report_conflicting_segments_segment(const DrdThreadId tid, && tid != DRD_INVALID_THREADID); tl_assert(p); - for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); i++) + for (i = 0; i < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); + i++) { if (i != tid) { @@ -989,10 +1003,10 @@ thread_report_conflicting_segments_segment(const DrdThreadId tid, } } -void thread_report_conflicting_segments(const DrdThreadId tid, - const Addr addr, - const SizeT size, - const BmAccessTypeT access_type) +void DRD_(thread_report_conflicting_segments)(const DrdThreadId tid, + const Addr addr, + const SizeT size, + const BmAccessTypeT access_type) { Segment* p; @@ -1013,7 +1027,7 @@ void thread_report_conflicting_segments(const DrdThreadId tid, * Verify whether the conflict set for thread tid is up to date. Only perform * the check if the environment variable DRD_VERIFY_CONFLICT_SET has been set. */ -static Bool thread_conflict_set_up_to_date(const DrdThreadId tid) +static Bool DRD_(thread_conflict_set_up_to_date)(const DrdThreadId tid) { static int do_verify_conflict_set = -1; Bool result; @@ -1027,7 +1041,7 @@ static Bool thread_conflict_set_up_to_date(const DrdThreadId tid) if (do_verify_conflict_set == 0) return True; - thread_compute_conflict_set(&computed_conflict_set, tid); + DRD_(thread_compute_conflict_set)(&computed_conflict_set, tid); result = bm_equal(DRD_(g_conflict_set), computed_conflict_set); bm_delete(computed_conflict_set); return result; @@ -1037,8 +1051,8 @@ static Bool thread_conflict_set_up_to_date(const DrdThreadId tid) * Compute a bitmap that represents the union of all memory accesses of all * segments that are unordered to the current segment of the thread tid. */ -static void thread_compute_conflict_set(struct bitmap** conflict_set, - const DrdThreadId tid) +static void DRD_(thread_compute_conflict_set)(struct bitmap** conflict_set, + const DrdThreadId tid) { Segment* p; @@ -1062,7 +1076,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, VG_(snprintf)(msg, sizeof(msg), "computing conflict set for thread %d/%d with vc ", - DrdThreadIdToVgThreadId(tid), tid); + DRD_(DrdThreadIdToVgThreadId)(tid), tid); DRD_(vc_snprint)(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg), &DRD_(g_threadinfo)[tid].last->vc); @@ -1088,7 +1102,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, for (j = 0; j < sizeof(DRD_(g_threadinfo)) / sizeof(DRD_(g_threadinfo)[0]); j++) { - if (j != tid && IsValidDrdThreadId(j)) + if (j != tid && DRD_(IsValidDrdThreadId)(j)) { const Segment* q; for (q = DRD_(g_threadinfo)[j].last; q; q = q->prev) @@ -1136,17 +1150,17 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, } } -ULong thread_get_context_switch_count(void) +ULong DRD_(thread_get_context_switch_count)(void) { return DRD_(s_context_switch_count); } -ULong thread_get_discard_ordered_segments_count(void) +ULong DRD_(thread_get_discard_ordered_segments_count)(void) { return DRD_(s_discard_ordered_segments_count); } -ULong thread_get_update_conflict_set_count(ULong* dsnsc, ULong* dscvc) +ULong DRD_(thread_get_update_conflict_set_count)(ULong* dsnsc, ULong* dscvc) { tl_assert(dsnsc); tl_assert(dscvc); @@ -1155,12 +1169,12 @@ ULong thread_get_update_conflict_set_count(ULong* dsnsc, ULong* dscvc) return DRD_(s_update_conflict_set_count); } -ULong thread_get_conflict_set_bitmap_creation_count(void) +ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void) { return DRD_(s_conflict_set_bitmap_creation_count); } -ULong thread_get_conflict_set_bitmap2_creation_count(void) +ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void) { return DRD_(s_conflict_set_bitmap2_creation_count); } diff --git a/drd/drd_thread.h b/drd/drd_thread.h index b4534c37b7..6537463793 100644 --- a/drd/drd_thread.h +++ b/drd/drd_thread.h @@ -94,67 +94,67 @@ extern struct bitmap* DRD_(g_conflict_set); /* Function declarations. */ -void thread_trace_context_switches(const Bool t); -void thread_trace_conflict_set(const Bool t); +void DRD_(thread_trace_context_switches)(const Bool t); +void DRD_(thread_trace_conflict_set)(const Bool t); Bool DRD_(thread_get_trace_fork_join)(void); void DRD_(thread_set_trace_fork_join)(const Bool t); -void thread_set_segment_merging(const Bool m); +void DRD_(thread_set_segment_merging)(const Bool m); -DrdThreadId VgThreadIdToDrdThreadId(const ThreadId tid); -DrdThreadId NewVgThreadIdToDrdThreadId(const ThreadId tid); -DrdThreadId PtThreadIdToDrdThreadId(const PThreadId tid); -ThreadId DrdThreadIdToVgThreadId(const DrdThreadId tid); -DrdThreadId thread_pre_create(const DrdThreadId creator, +DrdThreadId DRD_(VgThreadIdToDrdThreadId)(const ThreadId tid); +DrdThreadId DRD_(NewVgThreadIdToDrdThreadId)(const ThreadId tid); +DrdThreadId DRD_(PtThreadIdToDrdThreadId)(const PThreadId tid); +ThreadId DRD_(DrdThreadIdToVgThreadId)(const DrdThreadId tid); +DrdThreadId DRD_(thread_pre_create)(const DrdThreadId creator, const ThreadId vg_created); -DrdThreadId thread_post_create(const ThreadId vg_created); +DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created); void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee); -void thread_delete(const DrdThreadId tid); -void thread_finished(const DrdThreadId tid); -void thread_pre_cancel(const DrdThreadId tid); -void thread_set_stack_startup(const DrdThreadId tid, const Addr stack_startup); -Addr thread_get_stack_min(const DrdThreadId tid); -Addr thread_get_stack_min_min(const DrdThreadId tid); -Addr thread_get_stack_max(const DrdThreadId tid); -SizeT thread_get_stack_size(const DrdThreadId tid); -void thread_set_pthreadid(const DrdThreadId tid, const PThreadId ptid); -Bool thread_get_joinable(const DrdThreadId tid); -void thread_set_joinable(const DrdThreadId tid, const Bool joinable); -void thread_set_vg_running_tid(const ThreadId vg_tid); -void thread_set_running_tid(const ThreadId vg_tid, +void DRD_(thread_delete)(const DrdThreadId tid); +void DRD_(thread_finished)(const DrdThreadId tid); +void DRD_(thread_pre_cancel)(const DrdThreadId tid); +void DRD_(thread_set_stack_startup)(const DrdThreadId tid, const Addr stack_startup); +Addr DRD_(thread_get_stack_min)(const DrdThreadId tid); +Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid); +Addr DRD_(thread_get_stack_max)(const DrdThreadId tid); +SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid); +void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid); +Bool DRD_(thread_get_joinable)(const DrdThreadId tid); +void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable); +void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid); +void DRD_(thread_set_running_tid)(const ThreadId vg_tid, const DrdThreadId drd_tid); -int thread_enter_synchr(const DrdThreadId tid); -int thread_leave_synchr(const DrdThreadId tid); -int thread_get_synchr_nesting_count(const DrdThreadId tid); -void thread_new_segment(const DrdThreadId tid); -VectorClock* thread_get_vc(const DrdThreadId tid); -void thread_get_latest_segment(Segment** sg, const DrdThreadId tid); -void thread_combine_vc(const DrdThreadId joiner, const DrdThreadId joinee); -void thread_combine_vc2(const DrdThreadId tid, const VectorClock* const vc); - -void thread_stop_using_mem(const Addr a1, const Addr a2); -void thread_start_recording(const DrdThreadId tid); -void thread_stop_recording(const DrdThreadId tid); -void thread_print_all(void); -void thread_report_races(const DrdThreadId tid); -void thread_report_races_segment(const DrdThreadId tid, +int DRD_(thread_enter_synchr)(const DrdThreadId tid); +int DRD_(thread_leave_synchr)(const DrdThreadId tid); +int DRD_(thread_get_synchr_nesting_count)(const DrdThreadId tid); +void DRD_(thread_new_segment)(const DrdThreadId tid); +VectorClock* DRD_(thread_get_vc)(const DrdThreadId tid); +void DRD_(thread_get_latest_segment)(Segment** sg, const DrdThreadId tid); +void DRD_(thread_combine_vc)(const DrdThreadId joiner, const DrdThreadId joinee); +void DRD_(thread_combine_vc2)(const DrdThreadId tid, const VectorClock* const vc); + +void DRD_(thread_stop_using_mem)(const Addr a1, const Addr a2); +void DRD_(thread_start_recording)(const DrdThreadId tid); +void DRD_(thread_stop_recording)(const DrdThreadId tid); +void DRD_(thread_print_all)(void); +void DRD_(thread_report_races)(const DrdThreadId tid); +void DRD_(thread_report_races_segment)(const DrdThreadId tid, const Segment* const p); -void thread_report_all_races(void); -void thread_report_conflicting_segments(const DrdThreadId tid, +void DRD_(thread_report_all_races)(void); +void DRD_(thread_report_conflicting_segments)(const DrdThreadId tid, const Addr addr, const SizeT size, const BmAccessTypeT access_type); -ULong thread_get_context_switch_count(void); -ULong thread_get_report_races_count(void); -ULong thread_get_discard_ordered_segments_count(void); -ULong thread_get_update_conflict_set_count(ULong* dsnsc, ULong* dscvc); -ULong thread_get_conflict_set_bitmap_creation_count(void); -ULong thread_get_conflict_set_bitmap2_creation_count(void); +ULong DRD_(thread_get_context_switch_count)(void); +ULong DRD_(thread_get_report_races_count)(void); +ULong DRD_(thread_get_discard_ordered_segments_count)(void); +ULong DRD_(thread_get_update_conflict_set_count)(ULong* dsnsc, ULong* dscvc); +ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void); +ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void); /* Inline function definitions. */ static __inline__ -Bool IsValidDrdThreadId(const DrdThreadId tid) +Bool DRD_(IsValidDrdThreadId)(const DrdThreadId tid) { return (0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID && ! (DRD_(g_threadinfo)[tid].vg_thread_exists == False @@ -163,20 +163,20 @@ Bool IsValidDrdThreadId(const DrdThreadId tid) } static __inline__ -DrdThreadId thread_get_running_tid(void) +DrdThreadId DRD_(thread_get_running_tid)(void) { tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID); return DRD_(g_drd_running_tid); } static __inline__ -struct bitmap* thread_get_conflict_set(void) +struct bitmap* DRD_(thread_get_conflict_set)(void) { return DRD_(g_conflict_set); } static __inline__ -Bool running_thread_is_recording(void) +Bool DRD_(running_thread_is_recording)(void) { #ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(0 <= (int)DRD_(g_drd_running_tid) && DRD_(g_drd_running_tid) < DRD_N_THREADS @@ -187,7 +187,7 @@ Bool running_thread_is_recording(void) } static __inline__ -void thread_set_stack_min(const DrdThreadId tid, const Addr stack_min) +void DRD_(thread_set_stack_min)(const DrdThreadId tid, const Addr stack_min) { #ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(0 <= (int)tid @@ -212,7 +212,7 @@ void thread_set_stack_min(const DrdThreadId tid, const Addr stack_min) * currently scheduled thread. */ static __inline__ -Bool thread_address_on_stack(const Addr a) +Bool DRD_(thread_address_on_stack)(const Addr a) { return (DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].stack_min <= a && a < DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].stack_max); @@ -220,7 +220,7 @@ Bool thread_address_on_stack(const Addr a) /** Return a pointer to the latest segment for the specified thread. */ static __inline__ -Segment* thread_get_segment(const DrdThreadId tid) +Segment* DRD_(thread_get_segment)(const DrdThreadId tid) { #ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(0 <= (int)tid && tid < DRD_N_THREADS @@ -232,9 +232,9 @@ Segment* thread_get_segment(const DrdThreadId tid) /** Return a pointer to the latest segment for the running thread. */ static __inline__ -Segment* running_thread_get_segment(void) +Segment* DRD_(running_thread_get_segment)(void) { - return thread_get_segment(DRD_(g_drd_running_tid)); + return DRD_(thread_get_segment)(DRD_(g_drd_running_tid)); } #endif // __THREAD_H diff --git a/drd/drd_thread_bitmap.h b/drd/drd_thread_bitmap.h index aa43e83154..c752360663 100644 --- a/drd/drd_thread_bitmap.h +++ b/drd/drd_thread_bitmap.h @@ -35,8 +35,8 @@ static __inline__ Bool bm_access_load_1_triggers_conflict(const Addr a1) { - bm_access_load_1(running_thread_get_segment()->bm, a1); - return bm_load_1_has_conflict_with(thread_get_conflict_set(), a1); + bm_access_load_1(DRD_(running_thread_get_segment)()->bm, a1); + return bm_load_1_has_conflict_with(DRD_(thread_get_conflict_set)(), a1); } static __inline__ @@ -44,13 +44,13 @@ Bool bm_access_load_2_triggers_conflict(const Addr a1) { if ((a1 & 1) == 0) { - bm_access_aligned_load(running_thread_get_segment()->bm, a1, 2); - return bm_aligned_load_has_conflict_with(thread_get_conflict_set(), a1, 2); + bm_access_aligned_load(DRD_(running_thread_get_segment)()->bm, a1, 2); + return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 2); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 2, eLoad); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 2, eLoad); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 2, eLoad); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 2, eLoad); } } @@ -59,13 +59,13 @@ Bool bm_access_load_4_triggers_conflict(const Addr a1) { if ((a1 & 3) == 0) { - bm_access_aligned_load(running_thread_get_segment()->bm, a1, 4); - return bm_aligned_load_has_conflict_with(thread_get_conflict_set(), a1, 4); + bm_access_aligned_load(DRD_(running_thread_get_segment)()->bm, a1, 4); + return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 4); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 4, eLoad); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 4, eLoad); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 4, eLoad); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 4, eLoad); } } @@ -74,34 +74,34 @@ Bool bm_access_load_8_triggers_conflict(const Addr a1) { if ((a1 & 7) == 0) { - bm_access_aligned_load(running_thread_get_segment()->bm, a1, 8); - return bm_aligned_load_has_conflict_with(thread_get_conflict_set(), a1, 8); + bm_access_aligned_load(DRD_(running_thread_get_segment)()->bm, a1, 8); + return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 8); } else if ((a1 & 3) == 0) { - bm_access_aligned_load(running_thread_get_segment()->bm, a1 + 0, 4); - bm_access_aligned_load(running_thread_get_segment()->bm, a1 + 4, 4); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 8, eLoad); + bm_access_aligned_load(DRD_(running_thread_get_segment)()->bm, a1 + 0, 4); + bm_access_aligned_load(DRD_(running_thread_get_segment)()->bm, a1 + 4, 4); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eLoad); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 8, eLoad); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 8, eLoad); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 8, eLoad); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eLoad); } } static __inline__ Bool bm_access_load_triggers_conflict(const Addr a1, const Addr a2) { - bm_access_range_load(running_thread_get_segment()->bm, a1, a2); - return bm_load_has_conflict_with(thread_get_conflict_set(), a1, a2); + bm_access_range_load(DRD_(running_thread_get_segment)()->bm, a1, a2); + return bm_load_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a2); } static __inline__ Bool bm_access_store_1_triggers_conflict(const Addr a1) { - bm_access_store_1(running_thread_get_segment()->bm, a1); - return bm_store_1_has_conflict_with(thread_get_conflict_set(), a1); + bm_access_store_1(DRD_(running_thread_get_segment)()->bm, a1); + return bm_store_1_has_conflict_with(DRD_(thread_get_conflict_set)(), a1); } static __inline__ @@ -109,13 +109,13 @@ Bool bm_access_store_2_triggers_conflict(const Addr a1) { if ((a1 & 1) == 0) { - bm_access_aligned_store(running_thread_get_segment()->bm, a1, 2); - return bm_aligned_store_has_conflict_with(thread_get_conflict_set(), a1, 2); + bm_access_aligned_store(DRD_(running_thread_get_segment)()->bm, a1, 2); + return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 2); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 2, eStore); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 2, eStore); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 2, eStore); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 2, eStore); } } @@ -124,13 +124,13 @@ Bool bm_access_store_4_triggers_conflict(const Addr a1) { if ((a1 & 3) == 0) { - bm_access_aligned_store(running_thread_get_segment()->bm, a1, 4); - return bm_aligned_store_has_conflict_with(thread_get_conflict_set(), a1, 4); + bm_access_aligned_store(DRD_(running_thread_get_segment)()->bm, a1, 4); + return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 4); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 4, eStore); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 4, eStore); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 4, eStore); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 4, eStore); } } @@ -139,27 +139,27 @@ Bool bm_access_store_8_triggers_conflict(const Addr a1) { if ((a1 & 7) == 0) { - bm_access_aligned_store(running_thread_get_segment()->bm, a1, 8); - return bm_aligned_store_has_conflict_with(thread_get_conflict_set(), a1, 8); + bm_access_aligned_store(DRD_(running_thread_get_segment)()->bm, a1, 8); + return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, 8); } else if ((a1 & 3) == 0) { - bm_access_aligned_store(running_thread_get_segment()->bm, a1 + 0, 4); - bm_access_aligned_store(running_thread_get_segment()->bm, a1 + 4, 4); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 8, eStore); + bm_access_aligned_store(DRD_(running_thread_get_segment)()->bm, a1 + 0, 4); + bm_access_aligned_store(DRD_(running_thread_get_segment)()->bm, a1 + 4, 4); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eStore); } else { - bm_access_range(running_thread_get_segment()->bm, a1, a1 + 8, eStore); - return bm_has_conflict_with(thread_get_conflict_set(), a1, a1 + 8, eStore); + bm_access_range(DRD_(running_thread_get_segment)()->bm, a1, a1 + 8, eStore); + return bm_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eStore); } } static __inline__ Bool bm_access_store_triggers_conflict(const Addr a1, const Addr a2) { - bm_access_range_store(running_thread_get_segment()->bm, a1, a2); - return bm_store_has_conflict_with(thread_get_conflict_set(), a1, a2); + bm_access_range_store(DRD_(running_thread_get_segment)()->bm, a1, a2); + return bm_store_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a2); } #endif // __DRD_THREAD_BITMAP_H