|
From: <sv...@va...> - 2008-03-30 18:41:03
|
Author: bart
Date: 2008-03-30 19:41:07 +0100 (Sun, 30 Mar 2008)
New Revision: 7825
Log:
Split bm_has_any() into bm_has_any_load() and bm_has_any_store().
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_suppression.c
trunk/exp-drd/pub_drd_bitmap.h
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-30 17:56:43 UTC (rev 7824)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-30 18:41:07 UTC (rev 7825)
@@ -280,24 +280,112 @@
return True;
}
-Bool bm_has_any(const struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type)
+Bool bm_has_any_load(const struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- Addr b;
+ Addr b, b_next;
tl_assert(bm);
- for (b = a1; b < a2; b++)
+ for (b = a1; b < a2; b = b_next)
{
- if (bm_has_1(bm, b, access_type))
+ const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
+
+ b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
+ if (b_next > a2)
{
- return True;
+ b_next = a2;
}
+
+ if (bm2)
+ {
+ Addr b_start;
+ Addr b_end;
+ UWord b0;
+ const struct bitmap1* const p1 = &bm2->bm1;
+
+ if ((bm2->addr << ADDR0_BITS) < a1)
+ b_start = a1;
+ else
+ if ((bm2->addr << ADDR0_BITS) < a2)
+ b_start = (bm2->addr << ADDR0_BITS);
+ else
+ break;
+ tl_assert(a1 <= b_start && b_start <= a2);
+
+ if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
+ b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
+ else
+ b_end = a2;
+ tl_assert(a1 <= b_end && b_end <= a2);
+ tl_assert(b_start < b_end);
+ tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
+
+ for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
+ {
+ if (bm0_is_set(p1->bm0_r, b0))
+ {
+ return True;
+ }
+ }
+ }
}
- return False;
+ return 0;
}
+Bool bm_has_any_store(const struct bitmap* const bm,
+ const Addr a1, const Addr a2)
+{
+ Addr b, b_next;
+
+ tl_assert(bm);
+
+ for (b = a1; b < a2; b = b_next)
+ {
+ const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
+
+ b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
+ if (b_next > a2)
+ {
+ b_next = a2;
+ }
+
+ if (bm2)
+ {
+ Addr b_start;
+ Addr b_end;
+ UWord b0;
+ const struct bitmap1* const p1 = &bm2->bm1;
+
+ if ((bm2->addr << ADDR0_BITS) < a1)
+ b_start = a1;
+ else
+ if ((bm2->addr << ADDR0_BITS) < a2)
+ b_start = (bm2->addr << ADDR0_BITS);
+ else
+ break;
+ tl_assert(a1 <= b_start && b_start <= a2);
+
+ if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
+ b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
+ else
+ b_end = a2;
+ tl_assert(a1 <= b_end && b_end <= a2);
+ tl_assert(b_start < b_end);
+ tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
+
+ for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
+ {
+ if (bm0_is_set(p1->bm0_w, b0))
+ {
+ return True;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
/* Return a non-zero value if there is a read access, write access or both */
/* to any of the addresses in the range [ a1, a2 [ in bitmap bm. */
UWord bm_has_any_access(const struct bitmap* const bm,
Modified: trunk/exp-drd/drd_suppression.c
===================================================================
--- trunk/exp-drd/drd_suppression.c 2008-03-30 17:56:43 UTC (rev 7824)
+++ trunk/exp-drd/drd_suppression.c 2008-03-30 18:41:07 UTC (rev 7825)
@@ -102,7 +102,7 @@
*/
Bool drd_is_any_suppressed(const Addr a1, const Addr a2)
{
- return bm_has_any(s_suppressed, a1, a2, eStore);
+ return bm_has_any_store(s_suppressed, a1, a2);
}
void drd_start_tracing_address_range(const Addr a1, const Addr a2)
@@ -123,13 +123,13 @@
bm_clear_load(s_suppressed, a1, a2);
if (g_any_address_traced)
{
- g_any_address_traced = bm_has_any(s_suppressed, 0, ~(Addr)0, eLoad);
+ g_any_address_traced = bm_has_any_load(s_suppressed, 0, ~(Addr)0);
}
}
Bool drd_is_any_traced(const Addr a1, const Addr a2)
{
- return bm_has_any(s_suppressed, a1, a2, eLoad);
+ return bm_has_any_load(s_suppressed, a1, a2);
}
void drd_suppression_stop_using_mem(const Addr a1, const Addr a2)
Modified: trunk/exp-drd/pub_drd_bitmap.h
===================================================================
--- trunk/exp-drd/pub_drd_bitmap.h 2008-03-30 17:56:43 UTC (rev 7824)
+++ trunk/exp-drd/pub_drd_bitmap.h 2008-03-30 18:41:07 UTC (rev 7825)
@@ -71,9 +71,10 @@
Bool bm_has(const struct bitmap* const bm,
const Addr a1, const Addr a2,
const BmAccessTypeT access_type);
-Bool bm_has_any(const struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type);
+Bool bm_has_any_load(const struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool bm_has_any_store(const struct bitmap* const bm,
+ const Addr a1, const Addr a2);
UWord bm_has_any_access(const struct bitmap* const bm,
const Addr a1, const Addr a2);
UWord bm_has_1(const struct bitmap* const bm,
|