Wrapped DRD_() macro around yet even more function names.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9172 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_bitmap.c b/drd/drd_bitmap.c
index 928f221..cd3ec1a 100644
--- a/drd/drd_bitmap.c
+++ b/drd/drd_bitmap.c
@@ -47,14 +47,14 @@
const struct bitmap2* const bm2r);
-/* Local constants. */
+/* Local variables. */
static ULong s_bitmap_creation_count;
/* Function definitions. */
-struct bitmap* bm_new()
+struct bitmap* DRD_(bm_new)()
{
unsigned i;
struct bitmap* bm;
@@ -81,7 +81,7 @@
return bm;
}
-void bm_delete(struct bitmap* const bm)
+void DRD_(bm_delete)(struct bitmap* const bm)
{
struct bitmap2* bm2;
struct bitmap2ref* bm2ref;
@@ -107,9 +107,9 @@
* Record an access of type access_type at addresses a .. a + size - 1 in
* bitmap bm.
*/
-void bm_access_range(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type)
+void DRD_(bm_access_range)(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type)
{
Addr b, b_next;
@@ -171,34 +171,34 @@
}
}
-void bm_access_range_load(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+void DRD_(bm_access_range_load)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- bm_access_range(bm, a1, a2, eLoad);
+ DRD_(bm_access_range)(bm, a1, a2, eLoad);
}
-void bm_access_load_1(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_load_1)(struct bitmap* const bm, const Addr a1)
{
bm_access_aligned_load(bm, a1, 1);
}
-void bm_access_load_2(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_load_2)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 1) == 0)
bm_access_aligned_load(bm, a1, 2);
else
- bm_access_range(bm, a1, a1 + 2, eLoad);
+ DRD_(bm_access_range)(bm, a1, a1 + 2, eLoad);
}
-void bm_access_load_4(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_load_4)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 3) == 0)
bm_access_aligned_load(bm, a1, 4);
else
- bm_access_range(bm, a1, a1 + 4, eLoad);
+ DRD_(bm_access_range)(bm, a1, a1 + 4, eLoad);
}
-void bm_access_load_8(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_load_8)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 7) == 0)
bm_access_aligned_load(bm, a1, 8);
@@ -208,37 +208,37 @@
bm_access_aligned_load(bm, a1 + 4, 4);
}
else
- bm_access_range(bm, a1, a1 + 8, eLoad);
+ DRD_(bm_access_range)(bm, a1, a1 + 8, eLoad);
}
-void bm_access_range_store(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+void DRD_(bm_access_range_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- bm_access_range(bm, a1, a2, eStore);
+ DRD_(bm_access_range)(bm, a1, a2, eStore);
}
-void bm_access_store_1(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_store_1)(struct bitmap* const bm, const Addr a1)
{
bm_access_aligned_store(bm, a1, 1);
}
-void bm_access_store_2(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_store_2)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 1) == 0)
bm_access_aligned_store(bm, a1, 2);
else
- bm_access_range(bm, a1, a1 + 2, eStore);
+ DRD_(bm_access_range)(bm, a1, a1 + 2, eStore);
}
-void bm_access_store_4(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_store_4)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 3) == 0)
bm_access_aligned_store(bm, a1, 4);
else
- bm_access_range(bm, a1, a1 + 4, eStore);
+ DRD_(bm_access_range)(bm, a1, a1 + 4, eStore);
}
-void bm_access_store_8(struct bitmap* const bm, const Addr a1)
+void DRD_(bm_access_store_8)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 7) == 0)
bm_access_aligned_store(bm, a1, 8);
@@ -248,16 +248,16 @@
bm_access_aligned_store(bm, a1 + 4, 4);
}
else
- bm_access_range(bm, a1, a1 + 8, eStore);
+ DRD_(bm_access_range)(bm, a1, a1 + 8, eStore);
}
-Bool bm_has(struct bitmap* const bm, const Addr a1, const Addr a2,
- const BmAccessTypeT access_type)
+Bool DRD_(bm_has)(struct bitmap* const bm, const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type)
{
Addr b;
for (b = a1; b < a2; b++)
{
- if (! bm_has_1(bm, b, access_type))
+ if (! DRD_(bm_has_1)(bm, b, access_type))
{
return False;
}
@@ -265,7 +265,8 @@
return True;
}
-Bool bm_has_any_load(struct bitmap* const bm, const Addr a1, const Addr a2)
+Bool
+DRD_(bm_has_any_load)(struct bitmap* const bm, const Addr a1, const Addr a2)
{
Addr b, b_next;
@@ -317,8 +318,8 @@
return 0;
}
-Bool bm_has_any_store(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+Bool DRD_(bm_has_any_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
Addr b, b_next;
@@ -372,8 +373,8 @@
/* Return True if there is a read access, write access or both */
/* to any of the addresses in the range [ a1, a2 [ in bitmap bm. */
-Bool bm_has_any_access(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+Bool DRD_(bm_has_any_access)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
Addr b, b_next;
@@ -425,11 +426,12 @@
return False;
}
-/** Report whether an access of type access_type at address a is recorded in
- * bitmap bm.
+/**
+ * Report whether an access of type access_type at address a is recorded in
+ * bitmap bm.
*/
-Bool bm_has_1(struct bitmap* const bm,
- const Addr a, const BmAccessTypeT access_type)
+Bool DRD_(bm_has_1)(struct bitmap* const bm,
+ const Addr a, const BmAccessTypeT access_type)
{
const struct bitmap2* p2;
const struct bitmap1* p1;
@@ -448,9 +450,7 @@
return False;
}
-void bm_clear(struct bitmap* const bm,
- const Addr a1,
- const Addr a2)
+void DRD_(bm_clear)(struct bitmap* const bm, const Addr a1, const Addr a2)
{
Addr b, b_next;
@@ -507,11 +507,11 @@
}
}
-/** Clear all references to loads in bitmap bm starting at address a1 and
- * up to but not including address a2.
+/**
+ * Clear all references to loads in bitmap bm starting at address a1 and
+ * up to but not including address a2.
*/
-void bm_clear_load(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+void DRD_(bm_clear_load)(struct bitmap* const bm, const Addr a1, const Addr a2)
{
Addr a;
@@ -525,11 +525,12 @@
}
}
-/** Clear all references to stores in bitmap bm starting at address a1 and
- * up to but not including address a2.
+/**
+ * Clear all references to stores in bitmap bm starting at address a1 and
+ * up to but not including address a2.
*/
-void bm_clear_store(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+void DRD_(bm_clear_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
Addr a;
@@ -543,23 +544,24 @@
}
}
-/** Clear bitmap bm starting at address a1 and up to but not including address
- * a2. Return True if and only if any of the addresses was set before
- * clearing.
+/**
+ * Clear bitmap bm starting at address a1 and up to but not including address
+ * a2. Return True if and only if any of the addresses was set before
+ * clearing.
*/
-Bool bm_test_and_clear(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+Bool DRD_(bm_test_and_clear)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
Bool result;
- result = bm_has_any_access(bm, a1, a2) != 0;
- bm_clear(bm, a1, a2);
+ result = DRD_(bm_has_any_access)(bm, a1, a2) != 0;
+ DRD_(bm_clear)(bm, a1, a2);
return result;
}
-Bool bm_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type)
+Bool DRD_(bm_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type)
{
Addr b, b_next;
@@ -623,80 +625,81 @@
return False;
}
-Bool bm_load_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+Bool DRD_(bm_load_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- return bm_has_conflict_with(bm, a1, a2, eLoad);
+ return DRD_(bm_has_conflict_with)(bm, a1, a2, eLoad);
}
-Bool bm_load_1_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_load_1_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
return bm_aligned_load_has_conflict_with(bm, a1, 1);
}
-Bool bm_load_2_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_load_2_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 1) == 0)
return bm_aligned_load_has_conflict_with(bm, a1, 2);
else
- return bm_has_conflict_with(bm, a1, a1 + 2, eLoad);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 2, eLoad);
}
-Bool bm_load_4_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_load_4_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 3) == 0)
return bm_aligned_load_has_conflict_with(bm, a1, 4);
else
- return bm_has_conflict_with(bm, a1, a1 + 4, eLoad);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 4, eLoad);
}
-Bool bm_load_8_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_load_8_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 7) == 0)
return bm_aligned_load_has_conflict_with(bm, a1, 8);
else
- return bm_has_conflict_with(bm, a1, a1 + 8, eLoad);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 8, eLoad);
}
-Bool bm_store_1_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_store_1_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
return bm_aligned_store_has_conflict_with(bm, a1, 1);
}
-Bool bm_store_2_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_store_2_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 1) == 0)
return bm_aligned_store_has_conflict_with(bm, a1, 2);
else
- return bm_has_conflict_with(bm, a1, a1 + 2, eStore);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 2, eStore);
}
-Bool bm_store_4_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_store_4_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 3) == 0)
return bm_aligned_store_has_conflict_with(bm, a1, 4);
else
- return bm_has_conflict_with(bm, a1, a1 + 4, eStore);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 4, eStore);
}
-Bool bm_store_8_has_conflict_with(struct bitmap* const bm, const Addr a1)
+Bool DRD_(bm_store_8_has_conflict_with)(struct bitmap* const bm, const Addr a1)
{
if ((a1 & 7) == 0)
return bm_aligned_store_has_conflict_with(bm, a1, 8);
else
- return bm_has_conflict_with(bm, a1, a1 + 8, eStore);
+ return DRD_(bm_has_conflict_with)(bm, a1, a1 + 8, eStore);
}
-Bool bm_store_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2)
+Bool DRD_(bm_store_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- return bm_has_conflict_with(bm, a1, a2, eStore);
+ return DRD_(bm_has_conflict_with)(bm, a1, a2, eStore);
}
-/** Return True if the two bitmaps *lhs and *rhs are identical, and false
- * if not.
+/**
+ * Return True if the two bitmaps *lhs and *rhs are identical, and false
+ * if not.
*/
-Bool bm_equal(struct bitmap* const lhs, struct bitmap* const rhs)
+Bool DRD_(bm_equal)(struct bitmap* const lhs, struct bitmap* const rhs)
{
struct bitmap2* bm2l;
struct bitmap2ref* bm2l_ref;
@@ -715,7 +718,7 @@
while (bm2l_ref
&& (bm2l = bm2l_ref->bm2)
&& bm2l
- && ! bm_has_any_access(lhs,
+ && ! DRD_(bm_has_any_access)(lhs,
bm2l->addr << ADDR0_BITS,
(bm2l->addr + 1) << ADDR0_BITS))
{
@@ -738,7 +741,7 @@
}
bm2r = bm2r_ref->bm2;
tl_assert(bm2r);
- tl_assert(bm_has_any_access(rhs,
+ tl_assert(DRD_(bm_has_any_access)(rhs,
bm2r->addr << ADDR0_BITS,
(bm2r->addr + 1) << ADDR0_BITS));
@@ -756,7 +759,7 @@
bm2r = VG_(OSetGen_Next)(rhs->oset);
if (bm2r)
{
- tl_assert(bm_has_any_access(rhs,
+ tl_assert(DRD_(bm_has_any_access)(rhs,
bm2r->addr << ADDR0_BITS,
(bm2r->addr + 1) << ADDR0_BITS));
#if 0
@@ -769,7 +772,7 @@
return True;
}
-void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2)
+void DRD_(bm_swap)(struct bitmap* const bm1, struct bitmap* const bm2)
{
OSet* const tmp = bm1->oset;
bm1->oset = bm2->oset;
@@ -777,8 +780,8 @@
}
/** Merge bitmaps *lhs and *rhs into *lhs. */
-void bm_merge2(struct bitmap* const lhs,
- struct bitmap* const rhs)
+void DRD_(bm_merge2)(struct bitmap* const lhs,
+ struct bitmap* const rhs)
{
struct bitmap2* bm2l;
struct bitmap2ref* bm2l_ref;
@@ -814,8 +817,7 @@
* @param rhs Bitmap to be compared with lhs.
* @return !=0 if there are data races, == 0 if there are none.
*/
-int bm_has_races(struct bitmap* const lhs,
- struct bitmap* const rhs)
+int DRD_(bm_has_races)(struct bitmap* const lhs, struct bitmap* const rhs)
{
VG_(OSetGen_ResetIter)(lhs->oset);
VG_(OSetGen_ResetIter)(rhs->oset);
@@ -868,7 +870,7 @@
return 0;
}
-void bm_print(struct bitmap* const bm)
+void DRD_(bm_print)(struct bitmap* const bm)
{
struct bitmap2* bm2;
struct bitmap2ref* bm2ref;
@@ -898,17 +900,17 @@
}
}
-ULong bm_get_bitmap_creation_count(void)
+ULong DRD_(bm_get_bitmap_creation_count)(void)
{
return s_bitmap_creation_count;
}
-ULong bm_get_bitmap2_node_creation_count(void)
+ULong DRD_(bm_get_bitmap2_node_creation_count)(void)
{
return s_bitmap2_node_creation_count;
}
-ULong bm_get_bitmap2_creation_count(void)
+ULong DRD_(bm_get_bitmap2_creation_count)(void)
{
return s_bitmap2_creation_count;
}
@@ -933,9 +935,8 @@
* @param a1 client address shifted right by ADDR0_BITS.
* @param bm bitmap pointer.
*/
-static
-struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
- struct bitmap2ref* const bm2ref)
+static struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
+ struct bitmap2ref* const bm2ref)
{
UWord a1;
struct bitmap2* bm2;
diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c
index a13789f..908c860 100644
--- a/drd/drd_load_store.c
+++ b/drd/drd_load_store.c
@@ -125,7 +125,7 @@
&drei);
}
-VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size)
+VG_REGPARM(2) void DRD_(trace_load)(Addr addr, SizeT size)
{
#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
/* The assert below has been commented out because of performance reasons.*/
@@ -191,7 +191,7 @@
}
}
-VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size)
+VG_REGPARM(2) void DRD_(trace_store)(Addr addr, SizeT size)
{
#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
/* The assert below has been commented out because of performance reasons.*/
@@ -347,7 +347,7 @@
argv = mkIRExprVec_2(addr_expr, size_expr);
di = unsafeIRDirty_0_N(/*regparms*/2,
"drd_trace_load",
- VG_(fnptr_to_fnentry)(drd_trace_load),
+ VG_(fnptr_to_fnentry)(DRD_(trace_load)),
argv);
break;
}
@@ -412,7 +412,7 @@
argv = mkIRExprVec_2(addr_expr, size_expr);
di = unsafeIRDirty_0_N(/*regparms*/2,
"drd_trace_store",
- VG_(fnptr_to_fnentry)(drd_trace_store),
+ VG_(fnptr_to_fnentry)(DRD_(trace_store)),
argv);
break;
}
@@ -524,7 +524,7 @@
di = unsafeIRDirty_0_N(
/*regparms*/2,
"drd_trace_load",
- VG_(fnptr_to_fnentry)(drd_trace_load),
+ VG_(fnptr_to_fnentry)(DRD_(trace_load)),
argv);
addStmtToIRSB(bb, IRStmt_Dirty(di));
}
@@ -534,7 +534,7 @@
di = unsafeIRDirty_0_N(
/*regparms*/2,
"drd_trace_store",
- VG_(fnptr_to_fnentry)(drd_trace_store),
+ VG_(fnptr_to_fnentry)(DRD_(trace_store)),
argv);
addStmtToIRSB(bb, IRStmt_Dirty(di));
}
diff --git a/drd/drd_load_store.h b/drd/drd_load_store.h
index 9d74147..5153740 100644
--- a/drd/drd_load_store.h
+++ b/drd/drd_load_store.h
@@ -45,8 +45,8 @@
IRType const hWordTy);
void DRD_(trace_mem_access)(const Addr addr, const SizeT size,
const BmAccessTypeT access_type);
-VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size);
-VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size);
+VG_REGPARM(2) void DRD_(trace_load)(Addr addr, SizeT size);
+VG_REGPARM(2) void DRD_(trace_store)(Addr addr, SizeT size);
#endif // __DRD_LOAD_STORE_H
diff --git a/drd/drd_main.c b/drd/drd_main.c
index 2424fdb..f6cfb94 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -222,7 +222,7 @@
{
if (size > 0)
{
- drd_trace_load(a, size);
+ DRD_(trace_load)(a, size);
}
}
@@ -245,7 +245,7 @@
tl_assert(size < 4096);
if (size > 0)
{
- drd_trace_load(a, size);
+ DRD_(trace_load)(a, size);
}
}
@@ -257,7 +257,7 @@
DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
if (size > 0)
{
- drd_trace_store(a, size);
+ DRD_(trace_store)(a, size);
}
}
@@ -560,11 +560,11 @@
DRD_(get_barrier_segment_creation_count)());
VG_(message)(Vg_UserMsg,
" bitmaps: %lld level 1 / %lld level 2 bitmap refs",
- bm_get_bitmap_creation_count(),
- bm_get_bitmap2_node_creation_count());
+ DRD_(bm_get_bitmap_creation_count)(),
+ DRD_(bm_get_bitmap2_node_creation_count)());
VG_(message)(Vg_UserMsg,
" and %lld level 2 bitmaps were allocated.",
- bm_get_bitmap2_creation_count());
+ DRD_(bm_get_bitmap2_creation_count)());
VG_(message)(Vg_UserMsg,
" mutex: %lld non-recursive lock/unlock events.",
DRD_(get_mutex_lock_count)());
diff --git a/drd/drd_segment.c b/drd/drd_segment.c
index 266e819..bd7dc4c 100644
--- a/drd/drd_segment.c
+++ b/drd/drd_segment.c
@@ -79,7 +79,7 @@
else
DRD_(vc_init)(&sg->vc, 0, 0);
DRD_(vc_increment)(&sg->vc, created);
- sg->bm = bm_new();
+ sg->bm = DRD_(bm_new)();
if (DRD_(s_trace_segment))
{
@@ -103,7 +103,7 @@
tl_assert(sg->refcnt == 0);
DRD_(vc_cleanup)(&sg->vc);
- bm_delete(sg->bm);
+ DRD_(bm_delete)(sg->bm);
sg->bm = 0;
}
@@ -214,7 +214,7 @@
// Keep sg1->stacktrace.
// Keep sg1->vc.
// Merge sg2->bm into sg1->bm.
- bm_merge2(sg1->bm, sg2->bm);
+ DRD_(bm_merge2)(sg1->bm, sg2->bm);
}
/** Print the vector clock and the bitmap of the specified segment. */
@@ -224,7 +224,7 @@
VG_(printf)("vc: ");
DRD_(vc_print)(&sg->vc);
VG_(printf)("\n");
- bm_print(sg->bm);
+ DRD_(bm_print)(sg->bm);
}
/** Query whether segment tracing has been enabled. */
diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c
index 6e7cc08..e5175ba 100644
--- a/drd/drd_suppression.c
+++ b/drd/drd_suppression.c
@@ -52,7 +52,7 @@
void DRD_(suppression_init)(void)
{
tl_assert(DRD_(s_suppressed) == 0);
- DRD_(s_suppressed) = bm_new();
+ DRD_(s_suppressed) = DRD_(bm_new)();
tl_assert(DRD_(s_suppressed));
}
@@ -67,7 +67,7 @@
tl_assert(a1 < a2);
// tl_assert(! drd_is_any_suppressed(a1, a2));
- bm_access_range_store(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_access_range_store)(DRD_(s_suppressed), a1, a2);
}
void DRD_(finish_suppression)(const Addr a1, const Addr a2)
@@ -86,7 +86,7 @@
VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), 12);
tl_assert(False);
}
- bm_clear_store(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_clear_store)(DRD_(s_suppressed), a1, a2);
}
/**
@@ -96,7 +96,7 @@
*/
Bool DRD_(is_suppressed)(const Addr a1, const Addr a2)
{
- return bm_has(DRD_(s_suppressed), a1, a2, eStore);
+ return DRD_(bm_has)(DRD_(s_suppressed), a1, a2, eStore);
}
/**
@@ -106,14 +106,14 @@
*/
Bool DRD_(is_any_suppressed)(const Addr a1, const Addr a2)
{
- return bm_has_any_store(DRD_(s_suppressed), a1, a2);
+ return DRD_(bm_has_any_store)(DRD_(s_suppressed), a1, a2);
}
void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2)
{
tl_assert(a1 < a2);
- bm_access_range_load(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_access_range_load)(DRD_(s_suppressed), a1, a2);
if (! DRD_(g_any_address_traced))
{
DRD_(g_any_address_traced) = True;
@@ -124,17 +124,17 @@
{
tl_assert(a1 < a2);
- bm_clear_load(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_clear_load)(DRD_(s_suppressed), a1, a2);
if (DRD_(g_any_address_traced))
{
DRD_(g_any_address_traced)
- = bm_has_any_load(DRD_(s_suppressed), 0, ~(Addr)0);
+ = DRD_(bm_has_any_load)(DRD_(s_suppressed), 0, ~(Addr)0);
}
}
Bool DRD_(is_any_traced)(const Addr a1, const Addr a2)
{
- return bm_has_any_load(DRD_(s_suppressed), a1, a2);
+ return DRD_(bm_has_any_load)(DRD_(s_suppressed), a1, a2);
}
void DRD_(suppression_stop_using_mem)(const Addr a1, const Addr a2)
@@ -144,7 +144,7 @@
Addr b;
for (b = a1; b < a2; b++)
{
- if (bm_has_1(DRD_(s_suppressed), b, eStore))
+ if (DRD_(bm_has_1)(DRD_(s_suppressed), b, eStore))
{
VG_(message)(Vg_DebugMsg,
"stop_using_mem(0x%lx, %ld) finish suppression of 0x%lx",
@@ -154,5 +154,5 @@
}
tl_assert(a1);
tl_assert(a1 < a2);
- bm_clear(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_clear)(DRD_(s_suppressed), a1, a2);
}
diff --git a/drd/drd_thread.c b/drd/drd_thread.c
index 7a8f335..0689675 100644
--- a/drd/drd_thread.c
+++ b/drd/drd_thread.c
@@ -867,13 +867,13 @@
if (other_user == DRD_INVALID_THREADID
&& i != DRD_(g_drd_running_tid))
{
- if (UNLIKELY(bm_test_and_clear(p->bm, a1, a2)))
+ if (UNLIKELY(DRD_(bm_test_and_clear)(p->bm, a1, a2)))
{
other_user = i;
}
continue;
}
- bm_clear(p->bm, a1, a2);
+ DRD_(bm_clear)(p->bm, a1, a2);
}
}
@@ -882,7 +882,7 @@
* conflict set.
*/
if (other_user != DRD_INVALID_THREADID
- && bm_has_any_access(DRD_(g_conflict_set), a1, a2))
+ && DRD_(bm_has_any_access)(DRD_(g_conflict_set), a1, a2))
{
DRD_(thread_compute_conflict_set)(&DRD_(g_conflict_set),
DRD_(thread_get_running_tid)());
@@ -989,7 +989,8 @@
break;
if (! DRD_(vc_lte)(&p->vc, &q->vc))
{
- if (bm_has_conflict_with(q->bm, addr, addr + size, access_type))
+ if (DRD_(bm_has_conflict_with)(q->bm, addr, addr + size,
+ access_type))
{
tl_assert(q->stacktrace);
show_call_stack(i, "Other segment start",
@@ -1015,7 +1016,7 @@
for (p = DRD_(g_threadinfo)[tid].first; p; p = p->next)
{
- if (bm_has(p->bm, addr, addr + size, access_type))
+ if (DRD_(bm_has)(p->bm, addr, addr + size, access_type))
{
thread_report_conflicting_segments_segment(tid, addr, size,
access_type, p);
@@ -1042,8 +1043,8 @@
return True;
DRD_(thread_compute_conflict_set)(&computed_conflict_set, tid);
- result = bm_equal(DRD_(g_conflict_set), computed_conflict_set);
- bm_delete(computed_conflict_set);
+ result = DRD_(bm_equal)(DRD_(g_conflict_set), computed_conflict_set);
+ DRD_(bm_delete)(computed_conflict_set);
return result;
}
@@ -1061,14 +1062,14 @@
tl_assert(tid == DRD_(g_drd_running_tid));
DRD_(s_update_conflict_set_count)++;
- DRD_(s_conflict_set_bitmap_creation_count) -= bm_get_bitmap_creation_count();
- DRD_(s_conflict_set_bitmap2_creation_count) -= bm_get_bitmap2_creation_count();
+ DRD_(s_conflict_set_bitmap_creation_count) -= DRD_(bm_get_bitmap_creation_count)();
+ DRD_(s_conflict_set_bitmap2_creation_count) -= DRD_(bm_get_bitmap2_creation_count)();
if (*conflict_set)
{
- bm_delete(*conflict_set);
+ DRD_(bm_delete)(*conflict_set);
}
- *conflict_set = bm_new();
+ *conflict_set = DRD_(bm_new)();
if (DRD_(s_trace_conflict_set))
{
@@ -1119,7 +1120,7 @@
&q->vc);
VG_(message)(Vg_UserMsg, "%s", msg);
}
- bm_merge2(*conflict_set, q->bm);
+ DRD_(bm_merge2)(*conflict_set, q->bm);
}
else
{
@@ -1139,13 +1140,13 @@
}
}
- DRD_(s_conflict_set_bitmap_creation_count) += bm_get_bitmap_creation_count();
- DRD_(s_conflict_set_bitmap2_creation_count) += bm_get_bitmap2_creation_count();
+ DRD_(s_conflict_set_bitmap_creation_count) += DRD_(bm_get_bitmap_creation_count)();
+ DRD_(s_conflict_set_bitmap2_creation_count) += DRD_(bm_get_bitmap2_creation_count)();
if (0 && DRD_(s_trace_conflict_set))
{
VG_(message)(Vg_UserMsg, "[%d] new conflict set:", tid);
- bm_print(*conflict_set);
+ DRD_(bm_print)(*conflict_set);
VG_(message)(Vg_UserMsg, "[%d] end of new conflict set.", tid);
}
}
diff --git a/drd/drd_thread_bitmap.h b/drd/drd_thread_bitmap.h
index c752360..7568ebc 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(DRD_(running_thread_get_segment)()->bm, a1);
- return bm_load_1_has_conflict_with(DRD_(thread_get_conflict_set)(), a1);
+ DRD_(bm_access_load_1)(DRD_(running_thread_get_segment)()->bm, a1);
+ return DRD_(bm_load_1_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1);
}
static __inline__
@@ -49,8 +49,8 @@
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 2, eLoad);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 2, eLoad);
}
}
@@ -64,8 +64,8 @@
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 4, eLoad);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 4, eLoad);
}
}
@@ -81,27 +81,27 @@
{
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);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eLoad);
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 8, eLoad);
+ return DRD_(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(DRD_(running_thread_get_segment)()->bm, a1, a2);
- return bm_load_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a2);
+ DRD_(bm_access_range_load)(DRD_(running_thread_get_segment)()->bm, a1, a2);
+ return DRD_(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(DRD_(running_thread_get_segment)()->bm, a1);
- return bm_store_1_has_conflict_with(DRD_(thread_get_conflict_set)(), a1);
+ DRD_(bm_access_store_1)(DRD_(running_thread_get_segment)()->bm, a1);
+ return DRD_(bm_store_1_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1);
}
static __inline__
@@ -114,8 +114,8 @@
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 2, eStore);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 2, eStore);
}
}
@@ -129,8 +129,8 @@
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 4, eStore);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 4, eStore);
}
}
@@ -146,20 +146,20 @@
{
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);
+ return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a1 + 8, eStore);
}
else
{
- 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);
+ DRD_(bm_access_range)(DRD_(running_thread_get_segment)()->bm, a1, a1 + 8, eStore);
+ return DRD_(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(DRD_(running_thread_get_segment)()->bm, a1, a2);
- return bm_store_has_conflict_with(DRD_(thread_get_conflict_set)(), a1, a2);
+ DRD_(bm_access_range_store)(DRD_(running_thread_get_segment)()->bm, a1, a2);
+ return DRD_(bm_store_has_conflict_with)(DRD_(thread_get_conflict_set)(), a1, a2);
}
#endif // __DRD_THREAD_BITMAP_H
diff --git a/drd/pub_drd_bitmap.h b/drd/pub_drd_bitmap.h
index 596f4b4..864ff53 100644
--- a/drd/pub_drd_bitmap.h
+++ b/drd/pub_drd_bitmap.h
@@ -23,9 +23,11 @@
*/
-// A bitmap is a data structure that contains information about which
-// addresses have been accessed for reading or writing within a given
-// segment.
+/*
+ * A bitmap is a data structure that contains information about which
+ * addresses have been accessed for reading or writing within a given
+ * segment.
+ */
#ifndef __PUB_DRD_BITMAP_H
@@ -35,7 +37,7 @@
#include "pub_tool_basics.h" /* Addr, SizeT */
-// Constant definitions.
+/* Defines. */
#define LHS_R (1<<0)
#define LHS_W (1<<1)
@@ -45,81 +47,84 @@
|| (((a) & LHS_W) && ((a) & (RHS_R | RHS_W))))
-// Forward declarations.
+/* Forward declarations. */
+
struct bitmap;
-// Datatype definitions.
+/* Datatype definitions. */
+
typedef enum { eLoad, eStore, eStart, eEnd } BmAccessTypeT;
-// Function declarations.
-struct bitmap* bm_new(void);
-void bm_delete(struct bitmap* const bm);
-void bm_access_range(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type);
-void bm_access_range_load(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-void bm_access_load_1(struct bitmap* const bm, const Addr a1);
-void bm_access_load_2(struct bitmap* const bm, const Addr a1);
-void bm_access_load_4(struct bitmap* const bm, const Addr a1);
-void bm_access_load_8(struct bitmap* const bm, const Addr a1);
-void bm_access_range_store(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-void bm_access_store_1(struct bitmap* const bm, const Addr a1);
-void bm_access_store_2(struct bitmap* const bm, const Addr a1);
-void bm_access_store_4(struct bitmap* const bm, const Addr a1);
-void bm_access_store_8(struct bitmap* const bm, const Addr a1);
-Bool bm_has(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type);
-Bool bm_has_any_load(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_has_any_store(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_has_any_access(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_has_1(struct bitmap* const bm,
- const Addr address, const BmAccessTypeT access_type);
-void bm_clear(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-void bm_clear_load(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-void bm_clear_store(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_test_and_clear(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type);
-Bool bm_load_1_has_conflict_with(struct bitmap* const bm, const Addr a1);
-Bool bm_load_2_has_conflict_with(struct bitmap* const bm, const Addr a1);
-Bool bm_load_4_has_conflict_with(struct bitmap* const bm, const Addr a1);
-Bool bm_load_8_has_conflict_with(struct bitmap* const bm, const Addr a1);
-Bool bm_load_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_store_1_has_conflict_with(struct bitmap* const bm,const Addr a1);
-Bool bm_store_2_has_conflict_with(struct bitmap* const bm,const Addr a1);
-Bool bm_store_4_has_conflict_with(struct bitmap* const bm,const Addr a1);
-Bool bm_store_8_has_conflict_with(struct bitmap* const bm,const Addr a1);
-Bool bm_store_has_conflict_with(struct bitmap* const bm,
- const Addr a1, const Addr a2);
-Bool bm_equal(struct bitmap* const lhs, struct bitmap* const rhs);
-void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2);
-void bm_merge2(struct bitmap* const lhs,
- struct bitmap* const rhs);
-int bm_has_races(struct bitmap* const bm1,
- struct bitmap* const bm2);
-void bm_report_races(ThreadId const tid1, ThreadId const tid2,
- struct bitmap* const bm1,
- struct bitmap* const bm2);
-void bm_print(struct bitmap* bm);
-ULong bm_get_bitmap_creation_count(void);
-ULong bm_get_bitmap2_node_creation_count(void);
-ULong bm_get_bitmap2_creation_count(void);
+/* Function declarations. */
-void bm_test(void);
+struct bitmap* DRD_(bm_new)(void);
+void DRD_(bm_delete)(struct bitmap* const bm);
+void DRD_(bm_access_range)(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type);
+void DRD_(bm_access_range_load)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+void DRD_(bm_access_load_1)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_load_2)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_load_4)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_load_8)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_range_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+void DRD_(bm_access_store_1)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_store_2)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_store_4)(struct bitmap* const bm, const Addr a1);
+void DRD_(bm_access_store_8)(struct bitmap* const bm, const Addr a1);
+Bool DRD_(bm_has)(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type);
+Bool DRD_(bm_has_any_load)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_has_any_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_has_any_access)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_has_1)(struct bitmap* const bm,
+ const Addr address, const BmAccessTypeT access_type);
+void DRD_(bm_clear)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+void DRD_(bm_clear_load)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+void DRD_(bm_clear_store)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_test_and_clear)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type);
+Bool DRD_(bm_load_1_has_conflict_with)(struct bitmap* const bm, const Addr a1);
+Bool DRD_(bm_load_2_has_conflict_with)(struct bitmap* const bm, const Addr a1);
+Bool DRD_(bm_load_4_has_conflict_with)(struct bitmap* const bm, const Addr a1);
+Bool DRD_(bm_load_8_has_conflict_with)(struct bitmap* const bm, const Addr a1);
+Bool DRD_(bm_load_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_store_1_has_conflict_with)(struct bitmap* const bm,const Addr a1);
+Bool DRD_(bm_store_2_has_conflict_with)(struct bitmap* const bm,const Addr a1);
+Bool DRD_(bm_store_4_has_conflict_with)(struct bitmap* const bm,const Addr a1);
+Bool DRD_(bm_store_8_has_conflict_with)(struct bitmap* const bm,const Addr a1);
+Bool DRD_(bm_store_has_conflict_with)(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool DRD_(bm_equal)(struct bitmap* const lhs, struct bitmap* const rhs);
+void DRD_(bm_swap)(struct bitmap* const bm1, struct bitmap* const bm2);
+void DRD_(bm_merge2)(struct bitmap* const lhs,
+ struct bitmap* const rhs);
+int DRD_(bm_has_races)(struct bitmap* const bm1,
+ struct bitmap* const bm2);
+void DRD_(bm_report_races)(ThreadId const tid1, ThreadId const tid2,
+ struct bitmap* const bm1,
+ struct bitmap* const bm2);
+void DRD_(bm_print)(struct bitmap* bm);
+ULong DRD_(bm_get_bitmap_creation_count)(void);
+ULong DRD_(bm_get_bitmap2_node_creation_count)(void);
+ULong DRD_(bm_get_bitmap2_creation_count)(void);
+
+void DRD_(bm_test)(void);
#endif /* __PUB_DRD_BITMAP_H */