blob: 81424baf6c5c87792f1c5df50e90b89b5d4a2fa9 [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001/*
2 This file is part of drd, a data race detector.
3
sewardj85642922008-01-14 11:54:56 +00004 Copyright (C) 2006-2008 Bart Van Assche
sewardjaf44c822007-11-25 14:01:38 +00005 bart.vanassche@gmail.com
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307, USA.
21
22 The GNU General Public License is contained in the file COPYING.
23*/
24
25
26#include "pub_tool_basics.h" // Addr, SizeT
27#include "pub_tool_debuginfo.h" // VG_(get_objname)()
28#include "pub_tool_libcassert.h" // tl_assert()
29#include "pub_tool_libcbase.h" // VG_(memset)
30#include "pub_tool_libcprint.h" // VG_(printf)
31#include "pub_tool_machine.h" // VG_(get_IP)()
32#include "pub_tool_mallocfree.h" // VG_(malloc), VG_(free)
33#include "pub_drd_bitmap.h"
34#include "drd_bitmap.h"
35#include "drd_error.h"
36#include "drd_suppression.h"
37
38
bartf647d342008-03-24 19:12:12 +000039/* Forward declarations. */
sewardjaf44c822007-11-25 14:01:38 +000040
bartf647d342008-03-24 19:12:12 +000041struct bitmap2;
sewardjaf44c822007-11-25 14:01:38 +000042
43
bartf647d342008-03-24 19:12:12 +000044/* Local function declarations. */
sewardjaf44c822007-11-25 14:01:38 +000045
46static void bm2_merge(struct bitmap2* const bm2l,
47 const struct bitmap2* const bm2r);
48
49
bartf647d342008-03-24 19:12:12 +000050/* Local constants. */
51
52static ULong s_bitmap_creation_count;
53
54
55/* Function definitions. */
sewardjaf44c822007-11-25 14:01:38 +000056
57struct bitmap* bm_new()
58{
bart33e56c92008-03-24 06:41:30 +000059 unsigned i;
bart3772a982008-03-15 08:11:03 +000060 struct bitmap* bm;
sewardjaf44c822007-11-25 14:01:38 +000061
bartf29205e2008-03-25 18:51:06 +000062 /* If this assert fails, fix the definition of BITS_PER_BITS_PER_UWORD */
63 /* in drd_bitmap.h. */
bart3772a982008-03-15 08:11:03 +000064 tl_assert((1 << BITS_PER_BITS_PER_UWORD) == BITS_PER_UWORD);
sewardjaf44c822007-11-25 14:01:38 +000065
bart3772a982008-03-15 08:11:03 +000066 bm = VG_(malloc)(sizeof(*bm));
67 tl_assert(bm);
bartf29205e2008-03-25 18:51:06 +000068 /* Cache initialization. a1 is initialized with a value that never can */
69 /* match any valid address: the upper ADDR0_BITS bits of a1 are always */
70 /* zero for a valid cache entry. */
bart33e56c92008-03-24 06:41:30 +000071 for (i = 0; i < N_CACHE_ELEM; i++)
72 {
bartf29205e2008-03-25 18:51:06 +000073 bm->cache[i].a1 = ~(UWord)1;
bart33e56c92008-03-24 06:41:30 +000074 bm->cache[i].bm2 = 0;
75 }
bartf647d342008-03-24 19:12:12 +000076 bm->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
sewardjaf44c822007-11-25 14:01:38 +000077
bart3772a982008-03-15 08:11:03 +000078 s_bitmap_creation_count++;
sewardjaf44c822007-11-25 14:01:38 +000079
bart3772a982008-03-15 08:11:03 +000080 return bm;
sewardjaf44c822007-11-25 14:01:38 +000081}
82
83void bm_delete(struct bitmap* const bm)
84{
bartf647d342008-03-24 19:12:12 +000085 struct bitmap2* bm2;
86 struct bitmap2ref* bm2ref;
87
bart3772a982008-03-15 08:11:03 +000088 tl_assert(bm);
bartf647d342008-03-24 19:12:12 +000089
90 VG_(OSetGen_ResetIter)(bm->oset);
91 for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
92 {
93 bm2 = bm2ref->bm2;
94 tl_assert(bm2->refcnt >= 1);
95 if (--bm2->refcnt == 0)
96 {
97 VG_(free)(bm2);
98 }
99 }
100
bart3772a982008-03-15 08:11:03 +0000101 VG_(OSetGen_Destroy)(bm->oset);
102 VG_(free)(bm);
sewardjaf44c822007-11-25 14:01:38 +0000103}
104
105/**
bart36556122008-03-13 19:24:30 +0000106 * Record an access of type access_type at addresses a .. a + size - 1 in
sewardjaf44c822007-11-25 14:01:38 +0000107 * bitmap bm.
108 */
barta79df6e2008-03-14 17:07:51 +0000109static
sewardjaf44c822007-11-25 14:01:38 +0000110void bm_access_range(struct bitmap* const bm,
bart9036dea2008-03-13 19:10:06 +0000111 const Addr a1, const Addr a2,
bart0268dfa2008-03-11 20:10:21 +0000112 const BmAccessTypeT access_type)
sewardjaf44c822007-11-25 14:01:38 +0000113{
bart3772a982008-03-15 08:11:03 +0000114 Addr b, b_next;
bart36556122008-03-13 19:24:30 +0000115
bart3772a982008-03-15 08:11:03 +0000116 tl_assert(bm);
117 tl_assert(a1 < a2);
sewardjaf44c822007-11-25 14:01:38 +0000118
bart3772a982008-03-15 08:11:03 +0000119 for (b = a1; b < a2; b = b_next)
120 {
121 Addr b_start;
122 Addr b_end;
123 struct bitmap2* bm2;
124 SPLIT_ADDRESS(b);
bart36556122008-03-13 19:24:30 +0000125
bart3772a982008-03-15 08:11:03 +0000126 b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
127 if (b_next > a2)
128 {
129 b_next = a2;
130 }
bart36556122008-03-13 19:24:30 +0000131
bartf647d342008-03-24 19:12:12 +0000132 bm2 = bm2_lookup_or_insert_exclusive(bm, b1);
bart3772a982008-03-15 08:11:03 +0000133 tl_assert(bm2);
bart36556122008-03-13 19:24:30 +0000134
bart3772a982008-03-15 08:11:03 +0000135 if ((bm2->addr << ADDR0_BITS) < a1)
136 b_start = a1;
137 else
138 if ((bm2->addr << ADDR0_BITS) < a2)
139 b_start = (bm2->addr << ADDR0_BITS);
bart36556122008-03-13 19:24:30 +0000140 else
bart3772a982008-03-15 08:11:03 +0000141 break;
142 tl_assert(a1 <= b_start && b_start <= a2);
bart36556122008-03-13 19:24:30 +0000143
bart3772a982008-03-15 08:11:03 +0000144 if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
145 b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
146 else
147 b_end = a2;
148 tl_assert(a1 <= b_end && b_end <= a2);
149 tl_assert(b_start < b_end);
150 tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
bart36556122008-03-13 19:24:30 +0000151
bart0008f5b2008-03-22 17:07:39 +0000152 if (access_type == eLoad)
bart3772a982008-03-15 08:11:03 +0000153 {
bart0008f5b2008-03-22 17:07:39 +0000154 for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end - 1) & ADDR0_MASK); b0++)
bart36556122008-03-13 19:24:30 +0000155 {
bart3772a982008-03-15 08:11:03 +0000156 bm0_set(bm2->bm1.bm0_r, b0);
sewardjaf44c822007-11-25 14:01:38 +0000157 }
bart0008f5b2008-03-22 17:07:39 +0000158 }
159 else
160 {
161 for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end - 1) & ADDR0_MASK); b0++)
bart3772a982008-03-15 08:11:03 +0000162 {
163 bm0_set(bm2->bm1.bm0_w, b0);
164 }
165 }
166 }
sewardjaf44c822007-11-25 14:01:38 +0000167}
168
barta79df6e2008-03-14 17:07:51 +0000169static inline
170void bm_access_aligned_load(struct bitmap* const bm,
bartf8bc71d2008-03-15 11:42:34 +0000171 const Addr a1, const SizeT size)
barta79df6e2008-03-14 17:07:51 +0000172{
bart3772a982008-03-15 08:11:03 +0000173 struct bitmap2* bm2;
barta79df6e2008-03-14 17:07:51 +0000174
bartf647d342008-03-24 19:12:12 +0000175 bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS);
bartf8bc71d2008-03-15 11:42:34 +0000176 bm0_set_range(bm2->bm1.bm0_r, a1 & ADDR0_MASK, size);
barta79df6e2008-03-14 17:07:51 +0000177}
178
179static inline
180void bm_access_aligned_store(struct bitmap* const bm,
bartf8bc71d2008-03-15 11:42:34 +0000181 const Addr a1, const SizeT size)
barta79df6e2008-03-14 17:07:51 +0000182{
bart3772a982008-03-15 08:11:03 +0000183 struct bitmap2* bm2;
barta79df6e2008-03-14 17:07:51 +0000184
bartf647d342008-03-24 19:12:12 +0000185 bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS);
bartf8bc71d2008-03-15 11:42:34 +0000186 bm0_set_range(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size);
barta79df6e2008-03-14 17:07:51 +0000187}
188
bart36556122008-03-13 19:24:30 +0000189void bm_access_range_load(struct bitmap* const bm,
190 const Addr a1, const Addr a2)
191{
bart3772a982008-03-15 08:11:03 +0000192 bm_access_range(bm, a1, a2, eLoad);
bart36556122008-03-13 19:24:30 +0000193}
194
barta79df6e2008-03-14 17:07:51 +0000195void bm_access_load_1(struct bitmap* const bm, const Addr a1)
196{
bartf8bc71d2008-03-15 11:42:34 +0000197 bm_access_aligned_load(bm, a1, 1);
barta79df6e2008-03-14 17:07:51 +0000198}
199
200void bm_access_load_2(struct bitmap* const bm, const Addr a1)
201{
bart3772a982008-03-15 08:11:03 +0000202 if ((a1 & 1) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000203 bm_access_aligned_load(bm, a1, 2);
bart3772a982008-03-15 08:11:03 +0000204 else
205 bm_access_range(bm, a1, a1 + 2, eLoad);
barta79df6e2008-03-14 17:07:51 +0000206}
207
208void bm_access_load_4(struct bitmap* const bm, const Addr a1)
209{
bart3772a982008-03-15 08:11:03 +0000210 if ((a1 & 3) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000211 bm_access_aligned_load(bm, a1, 4);
bart3772a982008-03-15 08:11:03 +0000212 else
213 bm_access_range(bm, a1, a1 + 4, eLoad);
barta79df6e2008-03-14 17:07:51 +0000214}
215
216void bm_access_load_8(struct bitmap* const bm, const Addr a1)
217{
bart3772a982008-03-15 08:11:03 +0000218 if ((a1 & 7) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000219 bm_access_aligned_load(bm, a1, 8);
bart3772a982008-03-15 08:11:03 +0000220 else if ((a1 & 3) == 0)
221 {
bartf8bc71d2008-03-15 11:42:34 +0000222 bm_access_aligned_load(bm, a1 + 0, 4);
223 bm_access_aligned_load(bm, a1 + 4, 4);
bart3772a982008-03-15 08:11:03 +0000224 }
225 else
226 bm_access_range(bm, a1, a1 + 8, eLoad);
barta79df6e2008-03-14 17:07:51 +0000227}
228
229void bm_access_store_1(struct bitmap* const bm, const Addr a1)
230{
bartf8bc71d2008-03-15 11:42:34 +0000231 bm_access_aligned_store(bm, a1, 1);
barta79df6e2008-03-14 17:07:51 +0000232}
233
234void bm_access_store_2(struct bitmap* const bm, const Addr a1)
235{
bart3772a982008-03-15 08:11:03 +0000236 if ((a1 & 1) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000237 bm_access_aligned_store(bm, a1, 2);
bart3772a982008-03-15 08:11:03 +0000238 else
239 bm_access_range(bm, a1, a1 + 2, eStore);
barta79df6e2008-03-14 17:07:51 +0000240}
241
242void bm_access_store_4(struct bitmap* const bm, const Addr a1)
243{
bart3772a982008-03-15 08:11:03 +0000244 if ((a1 & 3) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000245 bm_access_aligned_store(bm, a1, 4);
bart3772a982008-03-15 08:11:03 +0000246 else
247 bm_access_range(bm, a1, a1 + 4, eStore);
barta79df6e2008-03-14 17:07:51 +0000248}
249
250void bm_access_store_8(struct bitmap* const bm, const Addr a1)
251{
bart3772a982008-03-15 08:11:03 +0000252 if ((a1 & 7) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000253 bm_access_aligned_store(bm, a1, 8);
bart3772a982008-03-15 08:11:03 +0000254 else if ((a1 & 3) == 0)
255 {
bartf8bc71d2008-03-15 11:42:34 +0000256 bm_access_aligned_store(bm, a1 + 0, 4);
257 bm_access_aligned_store(bm, a1 + 4, 4);
bart3772a982008-03-15 08:11:03 +0000258 }
259 else
260 bm_access_range(bm, a1, a1 + 8, eStore);
barta79df6e2008-03-14 17:07:51 +0000261}
262
bart36556122008-03-13 19:24:30 +0000263void bm_access_range_store(struct bitmap* const bm,
264 const Addr a1, const Addr a2)
265{
bart3772a982008-03-15 08:11:03 +0000266 bm_access_range(bm, a1, a2, eStore);
bart36556122008-03-13 19:24:30 +0000267}
268
269Bool bm_has(const struct bitmap* const bm, const Addr a1, const Addr a2,
sewardjaf44c822007-11-25 14:01:38 +0000270 const BmAccessTypeT access_type)
271{
bart3772a982008-03-15 08:11:03 +0000272 Addr b;
273 for (b = a1; b < a2; b++)
274 {
275 if (! bm_has_1(bm, b, access_type))
276 {
277 return False;
278 }
279 }
280 return True;
sewardjaf44c822007-11-25 14:01:38 +0000281}
282
283Bool bm_has_any(const struct bitmap* const bm,
bart36556122008-03-13 19:24:30 +0000284 const Addr a1, const Addr a2,
sewardjaf44c822007-11-25 14:01:38 +0000285 const BmAccessTypeT access_type)
286{
bart3772a982008-03-15 08:11:03 +0000287 Addr b;
sewardjaf44c822007-11-25 14:01:38 +0000288
bart3772a982008-03-15 08:11:03 +0000289 tl_assert(bm);
sewardjaf44c822007-11-25 14:01:38 +0000290
bart3772a982008-03-15 08:11:03 +0000291 for (b = a1; b < a2; b++)
292 {
293 if (bm_has_1(bm, b, access_type))
294 {
295 return True;
296 }
297 }
298 return False;
sewardjaf44c822007-11-25 14:01:38 +0000299}
300
301/* Return a non-zero value if there is a read access, write access or both */
302/* to any of the addresses in the range [ a1, a2 [ in bitmap bm. */
303UWord bm_has_any_access(const struct bitmap* const bm,
304 const Addr a1,
305 const Addr a2)
306{
bart3772a982008-03-15 08:11:03 +0000307 Addr b, b_next;
sewardjaf44c822007-11-25 14:01:38 +0000308
bart3772a982008-03-15 08:11:03 +0000309 tl_assert(bm);
sewardjaf44c822007-11-25 14:01:38 +0000310
bart3772a982008-03-15 08:11:03 +0000311 for (b = a1; b < a2; b = b_next)
312 {
bartf647d342008-03-24 19:12:12 +0000313 const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
sewardjaf44c822007-11-25 14:01:38 +0000314
bart3772a982008-03-15 08:11:03 +0000315 b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
316 if (b_next > a2)
317 {
318 b_next = a2;
319 }
sewardjaf44c822007-11-25 14:01:38 +0000320
bart3772a982008-03-15 08:11:03 +0000321 if (bm2)
322 {
323 Addr b_start;
324 Addr b_end;
325 UWord b0;
326 const struct bitmap1* const p1 = &bm2->bm1;
sewardjaf44c822007-11-25 14:01:38 +0000327
bart3772a982008-03-15 08:11:03 +0000328 if ((bm2->addr << ADDR0_BITS) < a1)
329 b_start = a1;
330 else
331 if ((bm2->addr << ADDR0_BITS) < a2)
332 b_start = (bm2->addr << ADDR0_BITS);
333 else
334 break;
335 tl_assert(a1 <= b_start && b_start <= a2);
sewardjaf44c822007-11-25 14:01:38 +0000336
bart3772a982008-03-15 08:11:03 +0000337 if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
338 b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
339 else
340 b_end = a2;
341 tl_assert(a1 <= b_end && b_end <= a2);
342 tl_assert(b_start < b_end);
343 tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
sewardjaf44c822007-11-25 14:01:38 +0000344
bart3772a982008-03-15 08:11:03 +0000345 for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
346 {
347 const UWord mask
348 = bm0_is_set(p1->bm0_r, b0) | bm0_is_set(p1->bm0_w, b0);
349 if (mask)
350 {
351 return mask;
352 }
sewardjaf44c822007-11-25 14:01:38 +0000353 }
bart3772a982008-03-15 08:11:03 +0000354 }
355 }
356 return 0;
sewardjaf44c822007-11-25 14:01:38 +0000357}
358
359/**
360 * Report whether an access of type access_type at address a is recorded in
361 * bitmap bm.
362 * @return != 0 means true, and == 0 means false
363 */
364UWord bm_has_1(const struct bitmap* const bm,
365 const Addr a,
366 const BmAccessTypeT access_type)
367{
bartf647d342008-03-24 19:12:12 +0000368 const struct bitmap2* p2;
369 const struct bitmap1* p1;
370 const UWord* p0;
bart3772a982008-03-15 08:11:03 +0000371 const UWord a0 = a & ADDR0_MASK;
sewardjaf44c822007-11-25 14:01:38 +0000372
bart3772a982008-03-15 08:11:03 +0000373 tl_assert(bm);
sewardjaf44c822007-11-25 14:01:38 +0000374
bart11d0b502008-03-22 16:44:03 +0000375 p2 = bm2_lookup(bm, a >> ADDR0_BITS);
bart3772a982008-03-15 08:11:03 +0000376 if (p2)
377 {
378 p1 = &p2->bm1;
379 p0 = (access_type == eLoad) ? p1->bm0_r : p1->bm0_w;
380 return bm0_is_set(p0, a0);
381 }
382 return 0;
sewardjaf44c822007-11-25 14:01:38 +0000383}
384
sewardjaf44c822007-11-25 14:01:38 +0000385void bm_clear(const struct bitmap* const bm,
386 const Addr a1,
387 const Addr a2)
388{
bart3772a982008-03-15 08:11:03 +0000389 Addr b, b_next;
sewardjaf44c822007-11-25 14:01:38 +0000390
bart3772a982008-03-15 08:11:03 +0000391 tl_assert(bm);
392 tl_assert(a1);
393 tl_assert(a1 <= a2);
sewardjaf44c822007-11-25 14:01:38 +0000394
bart3772a982008-03-15 08:11:03 +0000395 for (b = a1; b < a2; b = b_next)
396 {
bartf647d342008-03-24 19:12:12 +0000397 struct bitmap2* const p2 = bm2_lookup_exclusive(bm, b >> ADDR0_BITS);
sewardjaf44c822007-11-25 14:01:38 +0000398
bart3772a982008-03-15 08:11:03 +0000399 b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
400 if (b_next > a2)
401 {
402 b_next = a2;
403 }
404
405 if (p2)
406 {
407 Addr c = b;
bartf647d342008-03-24 19:12:12 +0000408 /* If the first address in the bitmap that must be cleared does not */
bart5955f332008-03-25 17:19:20 +0000409 /* start on an UWord boundary, start clearing the first addresses. */
bart3772a982008-03-15 08:11:03 +0000410 if (UWORD_LSB(c))
sewardjaf44c822007-11-25 14:01:38 +0000411 {
bart3772a982008-03-15 08:11:03 +0000412 Addr c_next = UWORD_MSB(c) + BITS_PER_UWORD;
413 if (c_next > b_next)
414 c_next = b_next;
bart5955f332008-03-25 17:19:20 +0000415 bm0_clear_range(p2->bm1.bm0_r, c & ADDR0_MASK, c_next - c);
416 bm0_clear_range(p2->bm1.bm0_w, c & ADDR0_MASK, c_next - c);
bart3772a982008-03-15 08:11:03 +0000417 c = c_next;
sewardjaf44c822007-11-25 14:01:38 +0000418 }
bartf647d342008-03-24 19:12:12 +0000419 /* If some UWords have to be cleared entirely, do this now. */
bart3772a982008-03-15 08:11:03 +0000420 if (UWORD_LSB(c) == 0)
sewardjaf44c822007-11-25 14:01:38 +0000421 {
bart3772a982008-03-15 08:11:03 +0000422 const Addr c_next = UWORD_MSB(b_next);
423 tl_assert(UWORD_LSB(c) == 0);
424 tl_assert(UWORD_LSB(c_next) == 0);
425 tl_assert(c_next <= b_next);
426 tl_assert(c <= c_next);
427 if (c_next > c)
428 {
429 UWord idx = (c & ADDR0_MASK) >> BITS_PER_BITS_PER_UWORD;
430 VG_(memset)(&p2->bm1.bm0_r[idx], 0, (c_next - c) / 8);
431 VG_(memset)(&p2->bm1.bm0_w[idx], 0, (c_next - c) / 8);
432 c = c_next;
433 }
sewardjaf44c822007-11-25 14:01:38 +0000434 }
bartf647d342008-03-24 19:12:12 +0000435 /* If the last address in the bitmap that must be cleared does not */
bart5955f332008-03-25 17:19:20 +0000436 /* fall on an UWord boundary, clear the last addresses. */
437 /* tl_assert(c <= b_next); */
438 bm0_clear_range(p2->bm1.bm0_r, c & ADDR0_MASK, b_next - c);
439 bm0_clear_range(p2->bm1.bm0_w, c & ADDR0_MASK, b_next - c);
bart3772a982008-03-15 08:11:03 +0000440 }
441 }
sewardjaf44c822007-11-25 14:01:38 +0000442}
sewardjaf44c822007-11-25 14:01:38 +0000443
bart9c4224c2008-03-29 14:40:08 +0000444/** Clear all references to loads in bitmap bm starting at address a1 and
445 * up to but not including address a2.
446 */
447void bm_clear_load(const struct bitmap* const bm,
448 const Addr a1, const Addr a2)
449{
450 Addr a;
451
452 for (a = a1; a < a2; a++)
453 {
454 struct bitmap2* const p2 = bm2_lookup_exclusive(bm, a >> ADDR0_BITS);
455 if (p2)
456 {
457 bm0_clear(p2->bm1.bm0_r, a & ADDR0_MASK);
458 }
459 }
460}
461
462/** Clear all references to stores in bitmap bm starting at address a1 and
463 * up to but not including address a2.
464 */
465void bm_clear_store(const struct bitmap* const bm,
466 const Addr a1, const Addr a2)
467{
468 Addr a;
469
470 for (a = a1; a < a2; a++)
471 {
472 struct bitmap2* const p2 = bm2_lookup_exclusive(bm, a >> ADDR0_BITS);
473 if (p2)
474 {
475 bm0_clear(p2->bm1.bm0_w, a & ADDR0_MASK);
476 }
477 }
478}
479
bart36556122008-03-13 19:24:30 +0000480Bool bm_has_conflict_with(const struct bitmap* const bm,
481 const Addr a1, const Addr a2,
482 const BmAccessTypeT access_type)
sewardjaf44c822007-11-25 14:01:38 +0000483{
bart3772a982008-03-15 08:11:03 +0000484 Addr b, b_next;
sewardjaf44c822007-11-25 14:01:38 +0000485
bart3772a982008-03-15 08:11:03 +0000486 tl_assert(bm);
sewardjaf44c822007-11-25 14:01:38 +0000487
bart3772a982008-03-15 08:11:03 +0000488 for (b = a1; b < a2; b = b_next)
489 {
bartf647d342008-03-24 19:12:12 +0000490 const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
bart36556122008-03-13 19:24:30 +0000491
bart3772a982008-03-15 08:11:03 +0000492 b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
493 if (b_next > a2)
494 {
495 b_next = a2;
496 }
bart36556122008-03-13 19:24:30 +0000497
bart3772a982008-03-15 08:11:03 +0000498 if (bm2)
499 {
500 Addr b_start;
501 Addr b_end;
502 UWord b0;
503 const struct bitmap1* const p1 = &bm2->bm1;
bart36556122008-03-13 19:24:30 +0000504
bart3772a982008-03-15 08:11:03 +0000505 if ((bm2->addr << ADDR0_BITS) < a1)
506 b_start = a1;
507 else
508 if ((bm2->addr << ADDR0_BITS) < a2)
509 b_start = (bm2->addr << ADDR0_BITS);
510 else
511 break;
512 tl_assert(a1 <= b_start && b_start <= a2);
bart36556122008-03-13 19:24:30 +0000513
bart3772a982008-03-15 08:11:03 +0000514 if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
515 b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
516 else
517 b_end = a2;
518 tl_assert(a1 <= b_end && b_end <= a2);
519 tl_assert(b_start < b_end);
520 tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
bart36556122008-03-13 19:24:30 +0000521
bart3772a982008-03-15 08:11:03 +0000522 for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
523 {
524 if (access_type == eLoad)
525 {
526 if (bm0_is_set(p1->bm0_w, b0))
527 {
528 return True;
529 }
530 }
531 else
532 {
533 tl_assert(access_type == eStore);
534 if (bm0_is_set(p1->bm0_r, b0)
535 | bm0_is_set(p1->bm0_w, b0))
536 {
537 return True;
538 }
539 }
sewardjaf44c822007-11-25 14:01:38 +0000540 }
bart3772a982008-03-15 08:11:03 +0000541 }
542 }
543 return False;
sewardjaf44c822007-11-25 14:01:38 +0000544}
545
barta79df6e2008-03-14 17:07:51 +0000546static inline
547Bool bm_aligned_load_has_conflict_with(const struct bitmap* const bm,
bartf8bc71d2008-03-15 11:42:34 +0000548 const Addr a1, const SizeT size)
barta79df6e2008-03-14 17:07:51 +0000549{
bartf647d342008-03-24 19:12:12 +0000550 const struct bitmap2* bm2;
barta79df6e2008-03-14 17:07:51 +0000551
bart11d0b502008-03-22 16:44:03 +0000552 bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS);
barta79df6e2008-03-14 17:07:51 +0000553
bartf8bc71d2008-03-15 11:42:34 +0000554 return (bm2 && bm0_is_any_set(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size));
barta79df6e2008-03-14 17:07:51 +0000555}
556
557static inline
558Bool bm_aligned_store_has_conflict_with(const struct bitmap* const bm,
bartf8bc71d2008-03-15 11:42:34 +0000559 const Addr a1, const SizeT size)
barta79df6e2008-03-14 17:07:51 +0000560{
bartf647d342008-03-24 19:12:12 +0000561 const struct bitmap2* bm2;
barta79df6e2008-03-14 17:07:51 +0000562
bart11d0b502008-03-22 16:44:03 +0000563 bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS);
barta79df6e2008-03-14 17:07:51 +0000564
bart3772a982008-03-15 08:11:03 +0000565 if (bm2)
566 {
bartf8bc71d2008-03-15 11:42:34 +0000567 if (bm0_is_any_set(bm2->bm1.bm0_r, a1 & ADDR0_MASK, size)
568 | bm0_is_any_set(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size))
bart3772a982008-03-15 08:11:03 +0000569 {
570 return True;
571 }
572 }
573 return False;
barta79df6e2008-03-14 17:07:51 +0000574}
575
bart36556122008-03-13 19:24:30 +0000576Bool bm_load_has_conflict_with(const struct bitmap* const bm,
577 const Addr a1, const Addr a2)
sewardjaf44c822007-11-25 14:01:38 +0000578{
bart3772a982008-03-15 08:11:03 +0000579 return bm_has_conflict_with(bm, a1, a2, eLoad);
bart36556122008-03-13 19:24:30 +0000580}
581
barta79df6e2008-03-14 17:07:51 +0000582Bool bm_load_1_has_conflict_with(const struct bitmap* const bm, const Addr a1)
583{
bartf8bc71d2008-03-15 11:42:34 +0000584 return bm_aligned_load_has_conflict_with(bm, a1, 1);
barta79df6e2008-03-14 17:07:51 +0000585}
586
587Bool bm_load_2_has_conflict_with(const struct bitmap* const bm, const Addr a1)
588{
bart3772a982008-03-15 08:11:03 +0000589 if ((a1 & 1) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000590 return bm_aligned_load_has_conflict_with(bm, a1, 2);
bart3772a982008-03-15 08:11:03 +0000591 else
592 return bm_has_conflict_with(bm, a1, a1 + 2, eLoad);
barta79df6e2008-03-14 17:07:51 +0000593}
594
595Bool bm_load_4_has_conflict_with(const struct bitmap* const bm, const Addr a1)
596{
bart3772a982008-03-15 08:11:03 +0000597 if ((a1 & 3) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000598 return bm_aligned_load_has_conflict_with(bm, a1, 4);
bart3772a982008-03-15 08:11:03 +0000599 else
600 return bm_has_conflict_with(bm, a1, a1 + 4, eLoad);
barta79df6e2008-03-14 17:07:51 +0000601}
602
603Bool bm_load_8_has_conflict_with(const struct bitmap* const bm, const Addr a1)
604{
bart3772a982008-03-15 08:11:03 +0000605 if ((a1 & 7) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000606 return bm_aligned_load_has_conflict_with(bm, a1, 8);
bart3772a982008-03-15 08:11:03 +0000607 else
608 return bm_has_conflict_with(bm, a1, a1 + 8, eLoad);
barta79df6e2008-03-14 17:07:51 +0000609}
610
611Bool bm_store_1_has_conflict_with(const struct bitmap* const bm, const Addr a1)
612{
bartf8bc71d2008-03-15 11:42:34 +0000613 return bm_aligned_store_has_conflict_with(bm, a1, 1);
barta79df6e2008-03-14 17:07:51 +0000614}
615
616Bool bm_store_2_has_conflict_with(const struct bitmap* const bm, const Addr a1)
617{
bart3772a982008-03-15 08:11:03 +0000618 if ((a1 & 1) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000619 return bm_aligned_store_has_conflict_with(bm, a1, 2);
bart3772a982008-03-15 08:11:03 +0000620 else
621 return bm_has_conflict_with(bm, a1, a1 + 2, eStore);
barta79df6e2008-03-14 17:07:51 +0000622}
623
624Bool bm_store_4_has_conflict_with(const struct bitmap* const bm, const Addr a1)
625{
bart3772a982008-03-15 08:11:03 +0000626 if ((a1 & 3) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000627 return bm_aligned_store_has_conflict_with(bm, a1, 4);
bart3772a982008-03-15 08:11:03 +0000628 else
629 return bm_has_conflict_with(bm, a1, a1 + 4, eStore);
barta79df6e2008-03-14 17:07:51 +0000630}
631
632Bool bm_store_8_has_conflict_with(const struct bitmap* const bm, const Addr a1)
633{
bart3772a982008-03-15 08:11:03 +0000634 if ((a1 & 7) == 0)
bartf8bc71d2008-03-15 11:42:34 +0000635 return bm_aligned_store_has_conflict_with(bm, a1, 8);
bart3772a982008-03-15 08:11:03 +0000636 else
637 return bm_has_conflict_with(bm, a1, a1 + 8, eStore);
barta79df6e2008-03-14 17:07:51 +0000638}
639
bart36556122008-03-13 19:24:30 +0000640Bool bm_store_has_conflict_with(const struct bitmap* const bm,
641 const Addr a1, const Addr a2)
642{
bart3772a982008-03-15 08:11:03 +0000643 return bm_has_conflict_with(bm, a1, a2, eStore);
sewardjaf44c822007-11-25 14:01:38 +0000644}
645
646void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2)
647{
bart3772a982008-03-15 08:11:03 +0000648 OSet* const tmp = bm1->oset;
649 bm1->oset = bm2->oset;
650 bm2->oset = tmp;
sewardjaf44c822007-11-25 14:01:38 +0000651}
652
bartf647d342008-03-24 19:12:12 +0000653/** Merge bitmaps *lhs and *rhs into *lhs. */
sewardjaf44c822007-11-25 14:01:38 +0000654void bm_merge2(struct bitmap* const lhs,
655 const struct bitmap* const rhs)
656{
bart3772a982008-03-15 08:11:03 +0000657 struct bitmap2* bm2l;
bartf647d342008-03-24 19:12:12 +0000658 struct bitmap2ref* bm2l_ref;
659 struct bitmap2* bm2r;
660 const struct bitmap2ref* bm2r_ref;
sewardjaf44c822007-11-25 14:01:38 +0000661
bart3772a982008-03-15 08:11:03 +0000662 VG_(OSetGen_ResetIter)(rhs->oset);
sewardjaf44c822007-11-25 14:01:38 +0000663
bartf647d342008-03-24 19:12:12 +0000664 for ( ; (bm2r_ref = VG_(OSetGen_Next)(rhs->oset)) != 0; )
bart3772a982008-03-15 08:11:03 +0000665 {
bartf647d342008-03-24 19:12:12 +0000666 bm2r = bm2r_ref->bm2;
667 bm2l_ref = VG_(OSetGen_Lookup)(lhs->oset, &bm2r->addr);
668 if (bm2l_ref)
bart3772a982008-03-15 08:11:03 +0000669 {
bartf647d342008-03-24 19:12:12 +0000670 bm2l = bm2l_ref->bm2;
671 if (bm2l != bm2r)
672 {
673 if (bm2l->refcnt > 1)
674 bm2l = bm2_make_exclusive(lhs, bm2l_ref);
675 bm2_merge(bm2l, bm2r);
676 }
677 }
678 else
679 {
680 bm2_insert_addref(lhs, bm2r);
681 }
bart3772a982008-03-15 08:11:03 +0000682 }
sewardjaf44c822007-11-25 14:01:38 +0000683}
684
685/**
686 * Report whether there are any RW / WR / WW patterns in lhs and rhs.
687 * @param lhs First bitmap.
688 * @param rhs Bitmap to be compared with lhs.
689 * @return !=0 if there are data races, == 0 if there are none.
690 */
691int bm_has_races(const struct bitmap* const lhs,
692 const struct bitmap* const rhs)
693{
bart3772a982008-03-15 08:11:03 +0000694 VG_(OSetGen_ResetIter)(lhs->oset);
695 VG_(OSetGen_ResetIter)(rhs->oset);
sewardjaf44c822007-11-25 14:01:38 +0000696
bart3772a982008-03-15 08:11:03 +0000697 for (;;)
698 {
bartf647d342008-03-24 19:12:12 +0000699 const struct bitmap2ref* bm2l_ref;
700 const struct bitmap2ref* bm2r_ref;
701 const struct bitmap2* bm2l;
702 const struct bitmap2* bm2r;
bart3772a982008-03-15 08:11:03 +0000703 const struct bitmap1* bm1l;
704 const struct bitmap1* bm1r;
705 unsigned k;
sewardjaf44c822007-11-25 14:01:38 +0000706
bartf647d342008-03-24 19:12:12 +0000707 bm2l_ref = VG_(OSetGen_Next)(lhs->oset);
708 bm2l = bm2l_ref->bm2;
709 bm2r_ref = VG_(OSetGen_Next)(rhs->oset);
710 bm2r = bm2r_ref->bm2;
bart3772a982008-03-15 08:11:03 +0000711 while (bm2l && bm2r && bm2l->addr != bm2r->addr)
712 {
713 if (bm2l->addr < bm2r->addr)
bartf647d342008-03-24 19:12:12 +0000714 bm2l = (bm2l_ref = VG_(OSetGen_Next)(lhs->oset))->bm2;
bart3772a982008-03-15 08:11:03 +0000715 else
bartf647d342008-03-24 19:12:12 +0000716 bm2r = (bm2r_ref = VG_(OSetGen_Next)(rhs->oset))->bm2;
bart3772a982008-03-15 08:11:03 +0000717 }
718 if (bm2l == 0 || bm2r == 0)
719 break;
720
721 bm1l = &bm2l->bm1;
722 bm1r = &bm2r->bm1;
723
724 for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
725 {
726 unsigned b;
727 for (b = 0; b < BITS_PER_UWORD; b++)
sewardjaf44c822007-11-25 14:01:38 +0000728 {
bart3772a982008-03-15 08:11:03 +0000729 UWord const access
730 = ((bm1l->bm0_r[k] & bm0_mask(b)) ? LHS_R : 0)
731 | ((bm1l->bm0_w[k] & bm0_mask(b)) ? LHS_W : 0)
732 | ((bm1r->bm0_r[k] & bm0_mask(b)) ? RHS_R : 0)
733 | ((bm1r->bm0_w[k] & bm0_mask(b)) ? RHS_W : 0);
734 Addr const a = MAKE_ADDRESS(bm2l->addr, k * BITS_PER_UWORD | b);
735 if (HAS_RACE(access) && ! drd_is_suppressed(a, a + 1))
736 {
737 return 1;
738 }
sewardjaf44c822007-11-25 14:01:38 +0000739 }
bart3772a982008-03-15 08:11:03 +0000740 }
741 }
742 return 0;
sewardjaf44c822007-11-25 14:01:38 +0000743}
744
sewardjaf44c822007-11-25 14:01:38 +0000745void bm_print(const struct bitmap* const bm)
746{
bart3772a982008-03-15 08:11:03 +0000747 struct bitmap2* bm2;
bartf647d342008-03-24 19:12:12 +0000748 struct bitmap2ref* bm2ref;
sewardjaf44c822007-11-25 14:01:38 +0000749
bart3772a982008-03-15 08:11:03 +0000750 VG_(OSetGen_ResetIter)(bm->oset);
sewardjaf44c822007-11-25 14:01:38 +0000751
bartf647d342008-03-24 19:12:12 +0000752 for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
bart3772a982008-03-15 08:11:03 +0000753 {
bartf647d342008-03-24 19:12:12 +0000754 const struct bitmap1* bm1;
bart0008f5b2008-03-22 17:07:39 +0000755 unsigned b;
bartf647d342008-03-24 19:12:12 +0000756
757 bm2 = bm2ref->bm2;
758 bm1 = &bm2->bm1;
bart0008f5b2008-03-22 17:07:39 +0000759 for (b = 0; b < ADDR0_COUNT; b++)
bart3772a982008-03-15 08:11:03 +0000760 {
bart0008f5b2008-03-22 17:07:39 +0000761 const Addr a = (bm2->addr << ADDR0_BITS) | b;
762 const Bool r = bm0_is_set(bm1->bm0_r, b) != 0;
763 const Bool w = bm0_is_set(bm1->bm0_w, b) != 0;
764 if (r || w)
sewardjaf44c822007-11-25 14:01:38 +0000765 {
bart0008f5b2008-03-22 17:07:39 +0000766 VG_(printf)("0x%08lx %c %c\n",
767 a,
768 w ? 'W' : ' ',
769 r ? 'R' : ' ');
sewardjaf44c822007-11-25 14:01:38 +0000770 }
bart3772a982008-03-15 08:11:03 +0000771 }
772 }
sewardjaf44c822007-11-25 14:01:38 +0000773}
774
775ULong bm_get_bitmap_creation_count(void)
776{
bart3772a982008-03-15 08:11:03 +0000777 return s_bitmap_creation_count;
sewardjaf44c822007-11-25 14:01:38 +0000778}
779
780ULong bm_get_bitmap2_creation_count(void)
781{
bart3772a982008-03-15 08:11:03 +0000782 return s_bitmap2_creation_count;
sewardjaf44c822007-11-25 14:01:38 +0000783}
784
bartf647d342008-03-24 19:12:12 +0000785/** Allocate and initialize a second level bitmap. */
786static struct bitmap2* bm2_new(const UWord a1)
787{
788 struct bitmap2* bm2;
789
790 bm2 = VG_(malloc)(sizeof(*bm2));
791 bm2->addr = a1;
792 bm2->refcnt = 1;
793
794 s_bitmap2_creation_count++;
795
796 return bm2;
797}
798
799/** Make a copy of a shared second level bitmap such that the copy can be
800 * modified.
801 *
802 * @param a1 client address shifted right by ADDR0_BITS.
803 * @param bm bitmap pointer.
804 */
805static
806struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
807 struct bitmap2ref* const bm2ref)
808{
809 UWord a1;
810 struct bitmap2* bm2;
811 struct bitmap2* bm2_copy;
812
813 tl_assert(bm);
814 tl_assert(bm2ref);
815 bm2 = bm2ref->bm2;
816 tl_assert(bm2);
817 tl_assert(bm2->refcnt > 1);
818 bm2->refcnt--;
819 tl_assert(bm2->refcnt >= 1);
820 a1 = bm2->addr;
821 bm2_copy = bm2_new(a1);
822 tl_assert(bm2_copy);
823 tl_assert(bm2_copy->addr == a1);
824 tl_assert(bm2_copy->refcnt == 1);
825 VG_(memcpy)(&bm2_copy->bm1, &bm2->bm1, sizeof(bm2->bm1));
826 bm2ref->bm2 = bm2_copy;
827
828 bm_update_cache(bm, a1, bm2_copy);
829
830 return bm2_copy;
831}
832
sewardjaf44c822007-11-25 14:01:38 +0000833static void bm2_merge(struct bitmap2* const bm2l,
834 const struct bitmap2* const bm2r)
835{
bart3772a982008-03-15 08:11:03 +0000836 unsigned k;
sewardjaf44c822007-11-25 14:01:38 +0000837
bart33e56c92008-03-24 06:41:30 +0000838 tl_assert(bm2l);
839 tl_assert(bm2r);
bart3772a982008-03-15 08:11:03 +0000840 tl_assert(bm2l->addr == bm2r->addr);
bartf647d342008-03-24 19:12:12 +0000841 tl_assert(bm2l->refcnt == 1);
sewardjaf44c822007-11-25 14:01:38 +0000842
bart3772a982008-03-15 08:11:03 +0000843 for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
844 {
845 bm2l->bm1.bm0_r[k] |= bm2r->bm1.bm0_r[k];
846 }
847 for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
848 {
849 bm2l->bm1.bm0_w[k] |= bm2r->bm1.bm0_w[k];
850 }
sewardjaf44c822007-11-25 14:01:38 +0000851}
852
853#if 0
854
855/* Unit test */
856static
857struct { Addr address; SizeT size; BmAccessTypeT access_type; }
bart3772a982008-03-15 08:11:03 +0000858 s_args[] = {
bart0008f5b2008-03-22 17:07:39 +0000859 { 0 + ADDR0_COUNT, 1, eLoad },
860 { 666 + ADDR0_COUNT, 4, eLoad },
861 { 667 + ADDR0_COUNT, 2, eStore },
bart33e56c92008-03-24 06:41:30 +0000862 { -2 + 2*ADDR0_COUNT, 1, eStore },
bart0008f5b2008-03-22 17:07:39 +0000863 { 0x0001ffffUL, 1, eLoad },
864 { 0x0002ffffUL, 1, eLoad },
865 { 0x00ffffffUL, 1, eLoad },
866 { 0xffffffffUL, 1, eStore },
bart3772a982008-03-15 08:11:03 +0000867 };
sewardjaf44c822007-11-25 14:01:38 +0000868
869void bm_test(void)
870{
bart3772a982008-03-15 08:11:03 +0000871 struct bitmap* bm;
872 struct bitmap* bm2;
bart0008f5b2008-03-22 17:07:39 +0000873 unsigned i, j;
sewardjaf44c822007-11-25 14:01:38 +0000874
bart3772a982008-03-15 08:11:03 +0000875 VG_(printf)("Start of DRD BM unit test.\n");
sewardjaf44c822007-11-25 14:01:38 +0000876
bart3772a982008-03-15 08:11:03 +0000877 bm = bm_new();
sewardjaf44c822007-11-25 14:01:38 +0000878
bart3772a982008-03-15 08:11:03 +0000879 for (i = 0; i < sizeof(s_args)/sizeof(s_args[0]); i++)
880 {
881 bm_access_range(bm,
882 s_args[i].address,
883 s_args[i].address + s_args[i].size,
884 s_args[i].access_type);
885 }
sewardjaf44c822007-11-25 14:01:38 +0000886
bart3772a982008-03-15 08:11:03 +0000887 VG_(printf)("Map contents -- should contain 10 addresses:\n");
888 bm_print(bm);
sewardjaf44c822007-11-25 14:01:38 +0000889
bart3772a982008-03-15 08:11:03 +0000890 for (i = 0; i < sizeof(s_args)/sizeof(s_args[0]); i++)
891 {
892 for (j = 0; j < s_args[i].size; j++)
893 {
894 tl_assert(bm_has_1(bm, s_args[i].address + j, s_args[i].access_type));
895 }
896 }
sewardjaf44c822007-11-25 14:01:38 +0000897
bart3772a982008-03-15 08:11:03 +0000898 VG_(printf)("Merge result:\n");
bart0008f5b2008-03-22 17:07:39 +0000899 bm2 = bm_new();
900 bm_merge2(bm2, bm);
901 bm_merge2(bm2, bm);
bart3772a982008-03-15 08:11:03 +0000902 bm_print(bm);
sewardjaf44c822007-11-25 14:01:38 +0000903
bart0008f5b2008-03-22 17:07:39 +0000904 VG_(printf)("Deleting bitmap bm\n");
bart3772a982008-03-15 08:11:03 +0000905 bm_delete(bm);
bart0008f5b2008-03-22 17:07:39 +0000906 VG_(printf)("Deleting bitmap bm2\n");
bart3772a982008-03-15 08:11:03 +0000907 bm_delete(bm2);
sewardjaf44c822007-11-25 14:01:38 +0000908
bart3772a982008-03-15 08:11:03 +0000909 VG_(printf)("End of DRD BM unit test.\n");
sewardjaf44c822007-11-25 14:01:38 +0000910}
911#endif