|
From: <sv...@va...> - 2009-02-15 11:00:35
|
Author: bart
Date: 2009-02-15 11:00:29 +0000 (Sun, 15 Feb 2009)
New Revision: 9165
Log:
Wrapped DRD_() macro around all barrier-related function names.
Modified:
trunk/drd/drd_barrier.c
trunk/drd/drd_barrier.h
trunk/drd/drd_clientreq.c
trunk/drd/drd_main.c
trunk/drd/drd_thread.c
Modified: trunk/drd/drd_barrier.c
===================================================================
--- trunk/drd/drd_barrier.c 2009-02-15 10:40:44 UTC (rev 9164)
+++ trunk/drd/drd_barrier.c 2009-02-15 11:00:29 UTC (rev 9165)
@@ -36,7 +36,7 @@
#include "pub_tool_threadstate.h" // VG_(get_running_tid)()
-// Type definitions.
+/* Type definitions. */
/** Information associated with one thread participating in a barrier. */
struct barrier_thread_info
@@ -49,31 +49,32 @@
};
-// Local functions.
+/* Local functions. */
-static void barrier_cleanup(struct barrier_info* p);
-static const char* barrier_get_typename(struct barrier_info* const p);
-static const char* barrier_type_name(const BarrierT bt);
+static void DRD_(barrier_cleanup)(struct barrier_info* p);
+static const char* DRD_(barrier_get_typename)(struct barrier_info* const p);
+static const char* DRD_(barrier_type_name)(const BarrierT bt);
-// Local variables.
+/* Local variables. */
-static Bool s_trace_barrier = False;
-static ULong s_barrier_segment_creation_count;
+static Bool DRD_(s_trace_barrier) = False;
+static ULong DRD_(s_barrier_segment_creation_count);
-// Function definitions.
+/* Function definitions. */
-void barrier_set_trace(const Bool trace_barrier)
+void DRD_(barrier_set_trace)(const Bool trace_barrier)
{
- s_trace_barrier = trace_barrier;
+ DRD_(s_trace_barrier) = trace_barrier;
}
/** Initialize the structure *p with the specified thread ID and iteration
* information. */
-static void barrier_thread_initialize(struct barrier_thread_info* const p,
- const DrdThreadId tid,
- const Word iteration)
+static
+void DRD_(barrier_thread_initialize)(struct barrier_thread_info* const p,
+ const DrdThreadId tid,
+ const Word iteration)
{
p->tid = tid;
p->iteration = iteration;
@@ -82,7 +83,7 @@
}
/** Deallocate the memory that was allocated in barrier_thread_initialize(). */
-static void barrier_thread_destroy(struct barrier_thread_info* const p)
+static void DRD_(barrier_thread_destroy)(struct barrier_thread_info* const p)
{
tl_assert(p);
DRD_(sg_put)(p->sg[0]);
@@ -92,16 +93,16 @@
/** Initialize the structure *p with the specified client-side barrier address,
* barrier object size and number of participants in each barrier. */
static
-void barrier_initialize(struct barrier_info* const p,
- const Addr barrier,
- const BarrierT barrier_type,
- const Word count)
+void DRD_(barrier_initialize)(struct barrier_info* const p,
+ const Addr barrier,
+ const BarrierT barrier_type,
+ const Word count)
{
tl_assert(barrier != 0);
tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
tl_assert(p->a1 == barrier);
- p->cleanup = (void(*)(DrdClientobj*))barrier_cleanup;
+ p->cleanup = (void(*)(DrdClientobj*))DRD_(barrier_cleanup);
p->barrier_type = barrier_type;
p->count = count;
p->pre_iteration = 0;
@@ -118,7 +119,7 @@
/** Deallocate the memory allocated by barrier_initialize() and in p->oset.
* Called by clientobj_destroy().
*/
-void barrier_cleanup(struct barrier_info* p)
+void DRD_(barrier_cleanup)(struct barrier_info* p)
{
struct barrier_thread_info* q;
@@ -138,7 +139,7 @@
VG_(OSetGen_ResetIter)(p->oset);
for ( ; (q = VG_(OSetGen_Next)(p->oset)) != 0; )
{
- barrier_thread_destroy(q);
+ DRD_(barrier_thread_destroy)(q);
}
VG_(OSetGen_Destroy)(p->oset);
}
@@ -147,38 +148,38 @@
* found, add it. */
static
struct barrier_info*
-barrier_get_or_allocate(const Addr barrier,
- const BarrierT barrier_type, const Word count)
+DRD_(barrier_get_or_allocate)(const Addr barrier,
+ const BarrierT barrier_type, const Word count)
{
struct barrier_info *p;
tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
tl_assert(offsetof(DrdClientobj, barrier) == 0);
- p = &clientobj_get(barrier, ClientBarrier)->barrier;
+ p = &(clientobj_get(barrier, ClientBarrier)->barrier);
if (p == 0)
{
- p = &clientobj_add(barrier, ClientBarrier)->barrier;
- barrier_initialize(p, barrier, barrier_type, count);
+ p = &(clientobj_add(barrier, ClientBarrier)->barrier);
+ DRD_(barrier_initialize)(p, barrier, barrier_type, count);
}
return p;
}
/** Look up the address of the information associated with the client-side
* barrier object. */
-static struct barrier_info* barrier_get(const Addr barrier)
+static struct barrier_info* DRD_(barrier_get)(const Addr barrier)
{
tl_assert(offsetof(DrdClientobj, barrier) == 0);
- return &clientobj_get(barrier, ClientBarrier)->barrier;
+ return &(clientobj_get(barrier, ClientBarrier)->barrier);
}
/** Initialize a barrier with client address barrier, client size size, and
* where count threads participate in each barrier.
* Called before pthread_barrier_init().
*/
-void barrier_init(const Addr barrier,
- const BarrierT barrier_type, const Word count,
- const Bool reinitialization)
+void DRD_(barrier_init)(const Addr barrier,
+ const BarrierT barrier_type, const Word count,
+ const Bool reinitialization)
{
struct barrier_info* p;
@@ -196,7 +197,7 @@
if (! reinitialization && barrier_type == pthread_barrier)
{
- p = barrier_get(barrier);
+ p = DRD_(barrier_get)(barrier);
if (p)
{
BarrierErrInfo bei = { barrier };
@@ -207,9 +208,9 @@
&bei);
}
}
- p = barrier_get_or_allocate(barrier, barrier_type, count);
+ p = DRD_(barrier_get_or_allocate)(barrier, barrier_type, count);
- if (s_trace_barrier)
+ if (DRD_(s_trace_barrier))
{
if (reinitialization)
{
@@ -217,7 +218,7 @@
"[%d/%d] barrier_reinit %s 0x%lx count %ld -> %ld",
VG_(get_running_tid)(),
thread_get_running_tid(),
- barrier_get_typename(p),
+ DRD_(barrier_get_typename)(p),
barrier,
p->count,
count);
@@ -228,7 +229,7 @@
"[%d/%d] barrier_init %s 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
- barrier_get_typename(p),
+ DRD_(barrier_get_typename)(p),
barrier);
}
}
@@ -250,19 +251,19 @@
}
/** Called after pthread_barrier_destroy(). */
-void barrier_destroy(const Addr barrier, const BarrierT barrier_type)
+void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type)
{
struct barrier_info* p;
- p = barrier_get(barrier);
+ p = DRD_(barrier_get)(barrier);
- if (s_trace_barrier)
+ if (DRD_(s_trace_barrier))
{
VG_(message)(Vg_UserMsg,
"[%d/%d] barrier_destroy %s 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
- barrier_get_typename(p),
+ DRD_(barrier_get_typename)(p),
barrier);
}
@@ -291,14 +292,14 @@
}
/** Called before pthread_barrier_wait(). */
-void barrier_pre_wait(const DrdThreadId tid, const Addr barrier,
- const BarrierT barrier_type)
+void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier,
+ const BarrierT barrier_type)
{
struct barrier_info* p;
struct barrier_thread_info* q;
const UWord word_tid = tid;
- p = barrier_get(barrier);
+ p = DRD_(barrier_get)(barrier);
if (p == 0 && barrier_type == gomp_barrier)
{
VG_(message)(Vg_UserMsg, "");
@@ -311,13 +312,13 @@
}
tl_assert(p);
- if (s_trace_barrier)
+ if (DRD_(s_trace_barrier))
{
VG_(message)(Vg_UserMsg,
"[%d/%d] barrier_pre_wait %s 0x%lx iteration %ld",
VG_(get_running_tid)(),
thread_get_running_tid(),
- barrier_get_typename(p),
+ DRD_(barrier_get_typename)(p),
barrier,
p->pre_iteration);
}
@@ -326,7 +327,7 @@
if (q == 0)
{
q = VG_(OSetGen_AllocNode)(p->oset, sizeof(*q));
- barrier_thread_initialize(q, tid, p->pre_iteration);
+ DRD_(barrier_thread_initialize)(q, tid, p->pre_iteration);
VG_(OSetGen_Insert)(p->oset, q);
tl_assert(VG_(OSetGen_Lookup)(p->oset, &word_tid) == q);
}
@@ -340,20 +341,20 @@
}
/** Called after pthread_barrier_wait(). */
-void barrier_post_wait(const DrdThreadId tid, const Addr barrier,
- const BarrierT barrier_type, const Bool waited)
+void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier,
+ const BarrierT barrier_type, const Bool waited)
{
struct barrier_info* p;
- p = barrier_get(barrier);
+ p = DRD_(barrier_get)(barrier);
- if (s_trace_barrier)
+ if (DRD_(s_trace_barrier))
{
VG_(message)(Vg_UserMsg,
"[%d/%d] barrier_post_wait %s 0x%lx iteration %ld",
VG_(get_running_tid)(),
tid,
- p ? barrier_get_typename(p) : "(?)",
+ p ? DRD_(barrier_get_typename)(p) : "(?)",
barrier,
p ? p->post_iteration : -1);
}
@@ -384,7 +385,7 @@
&bei);
q = VG_(OSetGen_AllocNode)(p->oset, sizeof(*q));
- barrier_thread_initialize(q, tid, p->pre_iteration);
+ DRD_(barrier_thread_initialize)(q, tid, p->pre_iteration);
VG_(OSetGen_Insert)(p->oset, q);
tl_assert(VG_(OSetGen_Lookup)(p->oset, &word_tid) == q);
}
@@ -399,7 +400,7 @@
}
thread_new_segment(tid);
- s_barrier_segment_creation_count++;
+ DRD_(s_barrier_segment_creation_count)++;
if (--p->post_waiters_left <= 0)
{
@@ -410,7 +411,7 @@
}
/** Call this function when thread tid stops to exist. */
-void barrier_thread_delete(const DrdThreadId tid)
+void DRD_(barrier_thread_delete)(const DrdThreadId tid)
{
struct barrier_info* p;
@@ -425,20 +426,20 @@
*/
if (q)
{
- barrier_thread_destroy(q);
+ DRD_(barrier_thread_destroy)(q);
VG_(OSetGen_FreeNode)(p->oset, q);
}
}
}
-static const char* barrier_get_typename(struct barrier_info* const p)
+static const char* DRD_(barrier_get_typename)(struct barrier_info* const p)
{
tl_assert(p);
- return barrier_type_name(p->barrier_type);
+ return DRD_(barrier_type_name)(p->barrier_type);
}
-static const char* barrier_type_name(const BarrierT bt)
+static const char* DRD_(barrier_type_name)(const BarrierT bt)
{
switch (bt)
{
@@ -450,7 +451,7 @@
return "?";
}
-ULong get_barrier_segment_creation_count(void)
+ULong DRD_(get_barrier_segment_creation_count)(void)
{
- return s_barrier_segment_creation_count;
+ return DRD_(s_barrier_segment_creation_count);
}
Modified: trunk/drd/drd_barrier.h
===================================================================
--- trunk/drd/drd_barrier.h 2009-02-15 10:40:44 UTC (rev 9164)
+++ trunk/drd/drd_barrier.h 2009-02-15 11:00:29 UTC (rev 9165)
@@ -30,26 +30,26 @@
#define __DRD_BARRIER_H
+#include "drd_basics.h" // DrdThreadId
#include "drd_clientreq.h" // BarrierT
-#include "drd_thread.h" // DrdThreadId
#include "pub_tool_basics.h" // Addr
struct barrier_info;
-void barrier_set_trace(const Bool trace_barrier);
-void barrier_init(const Addr barrier,
- const BarrierT barrier_type, const Word count,
- const Bool reinitialization);
-void barrier_destroy(const Addr barrier, const BarrierT barrier_type);
-void barrier_pre_wait(const DrdThreadId tid, const Addr barrier,
- const BarrierT barrier_type);
-void barrier_post_wait(const DrdThreadId tid, const Addr barrier,
- const BarrierT barrier_type, const Bool waited);
-void barrier_thread_delete(const DrdThreadId threadid);
-void barrier_stop_using_mem(const Addr a1, const Addr a2);
-ULong get_barrier_segment_creation_count(void);
+void DRD_(barrier_set_trace)(const Bool trace_barrier);
+void DRD_(barrier_init)(const Addr barrier,
+ const BarrierT barrier_type, const Word count,
+ const Bool reinitialization);
+void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type);
+void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier,
+ const BarrierT barrier_type);
+void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier,
+ const BarrierT barrier_type, const Bool waited);
+void DRD_(barrier_thread_delete)(const DrdThreadId threadid);
+void DRD_(barrier_stop_using_mem)(const Addr a1, const Addr a2);
+ULong DRD_(get_barrier_segment_creation_count)(void);
#endif /* __DRD_BARRIER_H */
Modified: trunk/drd/drd_clientreq.c
===================================================================
--- trunk/drd/drd_clientreq.c 2009-02-15 10:40:44 UTC (rev 9164)
+++ trunk/drd/drd_clientreq.c 2009-02-15 11:00:29 UTC (rev 9165)
@@ -303,7 +303,7 @@
case VG_USERREQ__PRE_BARRIER_INIT:
if (thread_enter_synchr(drd_tid) == 0)
- barrier_init(arg[1], arg[2], arg[3], arg[4]);
+ DRD_(barrier_init)(arg[1], arg[2], arg[3], arg[4]);
break;
case VG_USERREQ__POST_BARRIER_INIT:
@@ -316,17 +316,17 @@
case VG_USERREQ__POST_BARRIER_DESTROY:
if (thread_leave_synchr(drd_tid) == 0)
- barrier_destroy(arg[1], arg[2]);
+ DRD_(barrier_destroy)(arg[1], arg[2]);
break;
case VG_USERREQ__PRE_BARRIER_WAIT:
if (thread_enter_synchr(drd_tid) == 0)
- barrier_pre_wait(drd_tid, arg[1], arg[2]);
+ DRD_(barrier_pre_wait)(drd_tid, arg[1], arg[2]);
break;
case VG_USERREQ__POST_BARRIER_WAIT:
if (thread_leave_synchr(drd_tid) == 0)
- barrier_post_wait(drd_tid, arg[1], arg[2], arg[3]);
+ DRD_(barrier_post_wait)(drd_tid, arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__PRE_RWLOCK_INIT:
Modified: trunk/drd/drd_main.c
===================================================================
--- trunk/drd/drd_main.c 2009-02-15 10:40:44 UTC (rev 9164)
+++ trunk/drd/drd_main.c 2009-02-15 11:00:29 UTC (rev 9165)
@@ -127,7 +127,7 @@
DRD_(start_tracing_address_range)(addr, addr + 1);
}
if (trace_barrier != -1)
- barrier_set_trace(trace_barrier);
+ DRD_(barrier_set_trace)(trace_barrier);
if (trace_clientobj != -1)
clientobj_set_trace(trace_clientobj);
if (trace_cond != -1)
@@ -550,7 +550,7 @@
get_mutex_segment_creation_count(),
get_rwlock_segment_creation_count(),
get_semaphore_segment_creation_count(),
- get_barrier_segment_creation_count());
+ DRD_(get_barrier_segment_creation_count)());
VG_(message)(Vg_UserMsg,
" bitmaps: %lld level 1 / %lld level 2 bitmap refs",
bm_get_bitmap_creation_count(),
Modified: trunk/drd/drd_thread.c
===================================================================
--- trunk/drd/drd_thread.c 2009-02-15 10:40:44 UTC (rev 9164)
+++ trunk/drd/drd_thread.c 2009-02-15 11:00:29 UTC (rev 9165)
@@ -304,7 +304,7 @@
mutex_thread_delete(drd_joinee);
cond_thread_delete(drd_joinee);
semaphore_thread_delete(drd_joinee);
- barrier_thread_delete(drd_joinee);
+ DRD_(barrier_thread_delete)(drd_joinee);
}
/* NPTL hack: NPTL allocates the 'struct pthread' on top of the stack, */
|