tl_assert(a1);
tl_assert(a1 <= a2);
+#if 0
+ if (a2 - a1 >= ADDR0_COUNT)
+ VG_(message)(Vg_DebugMsg, "bm_clear(bm = %p, a1 = 0x%lx, a2 = 0x%lx, delta = 0x%lx",
+ bm, a1, a2, a2 - a1);
+#endif
+
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2ref* p2ref;
struct bitmap2* p2;
Addr c;
tl_assert(a1 <= b && b < a2);
#endif
- p2ref = bm2_lookup_next_exclusive(bm, b >> ADDR0_BITS);
- if (p2ref == 0)
- break;
-
- p2 = p2ref->bm2;
-
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(p2ref->addr >= (b >> ADDR0_BITS));
-#endif
- b = p2ref->addr << ADDR0_BITS;
- if (b < a1)
- b = a1;
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(a1 <= b);
-#endif
- if (b >= a2)
- break;
+ p2 = bm2_lookup_exclusive(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
b_next = a2;
}
+ if (p2 == 0)
+ continue;
+
c = b;
/* If the first address in the bitmap that must be cleared does not */
/* start on an UWord boundary, start clearing the first addresses. */
tl_assert(a1);
tl_assert(a1 <= a2);
+#if 0
+ if (a2 - a1 >= ADDR0_COUNT)
+ VG_(message)(Vg_DebugMsg, "bm_clear_load(bm = %p, a1 = 0x%lx, a2 = 0x%lx, delta = 0x%lx",
+ bm, a1, a2, a2 - a1);
+#endif
+
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2ref* p2ref;
struct bitmap2* p2;
Addr c;
tl_assert(a1 <= b && b < a2);
#endif
- p2ref = bm2_lookup_next_exclusive(bm, b >> ADDR0_BITS);
- if (p2ref == 0)
- break;
-
- p2 = p2ref->bm2;
-
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(p2ref->addr >= (b >> ADDR0_BITS));
-#endif
- b = p2ref->addr << ADDR0_BITS;
- if (b < a1)
- b = a1;
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(a1 <= b);
-#endif
- if (b >= a2)
- break;
+ p2 = bm2_lookup_exclusive(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
b_next = a2;
}
+ if (p2 == 0)
+ continue;
+
c = b;
/* If the first address in the bitmap that must be cleared does not */
/* start on an UWord boundary, start clearing the first addresses. */
tl_assert(a1);
tl_assert(a1 <= a2);
+#if 0
+ if (a2 - a1 >= ADDR0_COUNT)
+ VG_(message)(Vg_DebugMsg, "bm_clear_store(bm = %p, a1 = 0x%lx, a2 = 0x%lx, delta = 0x%lx",
+ bm, a1, a2, a2 - a1);
+#endif
+
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2ref* p2ref;
struct bitmap2* p2;
Addr c;
tl_assert(a1 <= b && b < a2);
#endif
- p2ref = bm2_lookup_next_exclusive(bm, b >> ADDR0_BITS);
- if (p2ref == 0)
- break;
-
- p2 = p2ref->bm2;
-
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(p2ref->addr >= (b >> ADDR0_BITS));
-#endif
- b = p2ref->addr << ADDR0_BITS;
- if (b < a1)
- b = a1;
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(a1 <= b);
-#endif
- if (b >= a2)
- break;
+ p2 = bm2_lookup_exclusive(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
b_next = a2;
}
+ if (p2 == 0)
+ continue;
+
c = b;
/* If the first address in the bitmap that must be cleared does not */
/* start on an UWord boundary, start clearing the first addresses. */
return bm2;
}
-/** Look up the first address in bitmap bm that is greater than or equal to
- * a1 and return a pointer to a second level bitmap that is not shared and
- * hence may be modified.
- *
- * @param a1 client address shifted right by ADDR0_BITS.
- * @param bm bitmap pointer.
- */
-static __inline__
-struct bitmap2ref*
-bm2_lookup_next_exclusive(struct bitmap* const bm, const UWord a1)
-{
- struct bitmap2ref* bm2ref;
- struct bitmap2* bm2;
-
- bm2ref = 0;
- bm2 = 0;
-
- VG_(OSetGen_ResetIterAt)(bm->oset, &a1);
- bm2ref = VG_(OSetGen_Next)(bm->oset);
-
- if (bm2ref)
- {
- bm2 = bm2ref->bm2;
- if (bm2->refcnt > 1)
- {
-#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(bm2ref);
-#endif
- bm2 = bm2_make_exclusive(*(struct bitmap**)&bm, bm2ref);
- }
- }
-
- return bm2ref;
-}
-
/** Look up the address a1 in bitmap bm. The returned second level bitmap has
* reference count one and hence may be modified.
*