From: Bart Van Assche Date: Wed, 11 Jun 2008 19:17:01 +0000 (+0000) Subject: - Renamed s_bitmap2_creation_count into s_bitmap2_node_creation_count. X-Git-Tag: svn/VALGRIND_3_4_0~481 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eff6ba5d1cd0a1246696eb7b4b9bbc79dc909060;p=thirdparty%2Fvalgrind.git - Renamed s_bitmap2_creation_count into s_bitmap2_node_creation_count. - Bug fix: bm_get_bitmap2_node_creation_count() now returns the correct counter. - More tl_assert() calls in drd_bitmap.h that were commented out are now surrounded by #ifdef ENABLE_DRD_CONSISTENCY_CHECKS / #endif. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8223 --- diff --git a/exp-drd/TODO.txt b/exp-drd/TODO.txt index 67dce9bc5c..0c7a0d9f44 100644 --- a/exp-drd/TODO.txt +++ b/exp-drd/TODO.txt @@ -4,7 +4,8 @@ Last updated May 14, 2008. Data-race detection algorithm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Find out why the following invocations run slowly: +- Find out why the following invocations run slowly (high number of mutex + operations ?): (cd exp-drd/splash2/codes/apps/raytrace/inputs && time ../../../../../../vg-in-place --tool=exp-drd --check-stack-var=yes ../RAYTRACE balls4.env) (cd exp-drd/splash2/codes/apps/raytrace && time ../../../../../vg-in-place --tool=exp-drd --check-stack-var=yes ./RAYTRACE inputs/teapot.env) - Test whether file with DRD client requests is installed properly. diff --git a/exp-drd/drd_bitmap.c b/exp-drd/drd_bitmap.c index ab72a0d0d3..c02bd49898 100644 --- a/exp-drd/drd_bitmap.c +++ b/exp-drd/drd_bitmap.c @@ -904,7 +904,7 @@ ULong bm_get_bitmap_creation_count(void) ULong bm_get_bitmap2_node_creation_count(void) { - return s_bitmap2_creation_count; + return s_bitmap2_node_creation_count; } ULong bm_get_bitmap2_creation_count(void) diff --git a/exp-drd/drd_bitmap.h b/exp-drd/drd_bitmap.h index 709a5a7b7b..c5b3f5ab3d 100644 --- a/exp-drd/drd_bitmap.h +++ b/exp-drd/drd_bitmap.h @@ -79,7 +79,7 @@ /* Local variables. */ static ULong s_bitmap2_creation_count; -static ULong s_node_creation_count; +static ULong s_bitmap2_node_creation_count; @@ -102,7 +102,9 @@ static __inline__ UWord bm0_mask(const Addr a) static __inline__ void bm0_set(UWord* bm0, const Addr a) { - //tl_assert(a < ADDR0_COUNT); +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS + tl_assert(a < ADDR0_COUNT); +#endif bm0[a >> BITS_PER_BITS_PER_UWORD] |= (UWord)1 << UWORD_LSB(a); } @@ -122,7 +124,9 @@ static __inline__ void bm0_set_range(UWord* bm0, static __inline__ void bm0_clear(UWord* bm0, const Addr a) { - //tl_assert(a < ADDR0_COUNT); +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS + tl_assert(a < ADDR0_COUNT); +#endif bm0[a >> BITS_PER_BITS_PER_UWORD] &= ~((UWord)1 << UWORD_LSB(a)); } @@ -142,7 +146,9 @@ static __inline__ void bm0_clear_range(UWord* bm0, static __inline__ UWord bm0_is_set(const UWord* bm0, const Addr a) { - //tl_assert(a < ADDR0_COUNT); +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS + tl_assert(a < ADDR0_COUNT); +#endif return (bm0[a >> BITS_PER_BITS_PER_UWORD] & ((UWord)1 << UWORD_LSB(a))); } @@ -213,9 +219,7 @@ void bm_cache_rotate(struct bm_cache_elem cache[], const int n) #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 2 struct bm_cache_elem t; -#if 0 tl_assert(2 <= n && n <= 8); -#endif t = cache[0]; if (n > 1) @@ -319,7 +323,9 @@ void bm_update_cache(struct bitmap* const bm, const UWord a1, struct bitmap2* const bm2) { +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm); +#endif #if N_CACHE_ELEM > 8 #error Please update the code below. @@ -362,7 +368,9 @@ const struct bitmap2* bm2_lookup(struct bitmap* const bm, const UWord a1) struct bitmap2* bm2; struct bitmap2ref* bm2ref; +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm); +#endif if (! bm_cache_lookup(bm, a1, &bm2)) { bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); @@ -406,11 +414,15 @@ bm2_lookup_exclusive(struct bitmap* const bm, const UWord a1) bm2 = bm2ref->bm2; } +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm2); +#endif if (bm2->refcnt > 1) { +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm2ref); +#endif bm2 = bm2_make_exclusive(*(struct bitmap**)&bm, bm2ref); } @@ -429,7 +441,7 @@ struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1) struct bitmap2ref* bm2ref; struct bitmap2* bm2; - s_node_creation_count++; + s_bitmap2_node_creation_count++; bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref)); bm2ref->addr = a1; bm2 = bm2_new(a1); @@ -451,10 +463,12 @@ struct bitmap2* bm2_insert_addref(struct bitmap* const bm, { struct bitmap2ref* bm2ref; +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm); - //tl_assert(VG_(OSetGen_Lookup)(bm->oset, &bm2->addr) == 0); + tl_assert(VG_(OSetGen_Lookup)(bm->oset, &bm2->addr) == 0); +#endif - s_node_creation_count++; + s_bitmap2_node_creation_count++; bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref)); bm2ref->addr = bm2->addr; bm2ref->bm2 = bm2; @@ -478,7 +492,9 @@ struct bitmap2* bm2_lookup_or_insert(struct bitmap* const bm, const UWord a1) struct bitmap2ref* bm2ref; struct bitmap2* bm2; +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm); +#endif if (bm_cache_lookup(bm, a1, &bm2)) { if (bm2 == 0) @@ -514,9 +530,13 @@ struct bitmap2* bm2_lookup_or_insert_exclusive(struct bitmap* const bm, { struct bitmap2* bm2; +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm); +#endif bm2 = (struct bitmap2*)bm2_lookup_or_insert(bm, a1); +#ifdef ENABLE_DRD_CONSISTENCY_CHECKS tl_assert(bm2); +#endif if (bm2->refcnt > 1) { struct bitmap2ref* bm2ref;