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;
return bm;
}
-void bm_delete(struct bitmap* const bm)
+void DRD_(bm_delete)(struct bitmap* const bm)
{
struct bitmap2* bm2;
struct bitmap2ref* bm2ref;
* 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;
}
}
-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);
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);
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;
}
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;
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;
/* 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;
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;
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;
}
}
-/** 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;
}
}
-/** 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;
}
}
-/** 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;
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;
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))
{
}
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));
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
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;
}
/** 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;
* @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);
return 0;
}
-void bm_print(struct bitmap* const bm)
+void DRD_(bm_print)(struct bitmap* const bm)
{
struct bitmap2* bm2;
struct bitmap2ref* bm2ref;
}
}
-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;
}
* @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;
&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.*/
}
}
-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.*/
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;
}
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;
}
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));
}
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));
}
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
{
if (size > 0)
{
- drd_trace_load(a, size);
+ DRD_(trace_load)(a, size);
}
}
tl_assert(size < 4096);
if (size > 0)
{
- drd_trace_load(a, size);
+ DRD_(trace_load)(a, size);
}
}
DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
if (size > 0)
{
- drd_trace_store(a, size);
+ DRD_(trace_store)(a, size);
}
}
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)());
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))
{
tl_assert(sg->refcnt == 0);
DRD_(vc_cleanup)(&sg->vc);
- bm_delete(sg->bm);
+ DRD_(bm_delete)(sg->bm);
sg->bm = 0;
}
// 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. */
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. */
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));
}
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)
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);
}
/**
*/
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);
}
/**
*/
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;
{
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)
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",
}
tl_assert(a1);
tl_assert(a1 < a2);
- bm_clear(DRD_(s_suppressed), a1, a2);
+ DRD_(bm_clear)(DRD_(s_suppressed), a1, a2);
}
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);
}
}
* 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)());
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",
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);
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;
}
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))
{
&q->vc);
VG_(message)(Vg_UserMsg, "%s", msg);
}
- bm_merge2(*conflict_set, q->bm);
+ DRD_(bm_merge2)(*conflict_set, q->bm);
}
else
{
}
}
- 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);
}
}
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__
}
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);
}
}
}
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);
}
}
{
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__
}
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);
}
}
}
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);
}
}
{
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
*/
-// 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
#include "pub_tool_basics.h" /* Addr, SizeT */
-// Constant definitions.
+/* Defines. */
#define LHS_R (1<<0)
#define LHS_W (1<<1)
|| (((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,
+/* Function declarations. */
+
+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);
-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,
+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);
-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);
-
-void bm_test(void);
+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 */