|
From: <sv...@va...> - 2009-06-03 19:13:08
|
Author: bart
Date: 2009-06-03 20:12:58 +0100 (Wed, 03 Jun 2009)
New Revision: 10232
Log:
Yet another performance optimization: remove cleared second-level bitmaps from the conflict set after having recalculated the conflict set.
Modified:
branches/DRDDEV/drd/drd_bitmap.c
branches/DRDDEV/drd/drd_bitmap.h
branches/DRDDEV/drd/drd_thread.c
branches/DRDDEV/drd/pub_drd_bitmap.h
Modified: branches/DRDDEV/drd/drd_bitmap.c
===================================================================
--- branches/DRDDEV/drd/drd_bitmap.c 2009-06-03 18:48:28 UTC (rev 10231)
+++ branches/DRDDEV/drd/drd_bitmap.c 2009-06-03 19:12:58 UTC (rev 10232)
@@ -1102,6 +1102,25 @@
}
}
+/** Remove all marked second-level bitmaps that do not contain any access. */
+void DRD_(bm_remove_cleared_marked)(struct bitmap* bm)
+{
+ struct bitmap2* bm2;
+
+ VG_(OSetGen_ResetIter)(&bm->oset);
+ for ( ; (bm2 = VG_(OSetGen_Next)(&bm->oset)) != 0; )
+ {
+ const UWord a1 = bm2->addr;
+ if (bm2->recalc
+ && ! DRD_(bm_has_any_access(bm, make_address(a1, 0),
+ make_address(a1 + 1, 0))))
+ {
+ bm2_remove(bm, a1);
+ VG_(OSetGen_ResetIterAt)(&bm->oset, &a1);
+ }
+ }
+}
+
/**
* Report whether there are any RW / WR / WW patterns in lhs and rhs.
* @param lhs First bitmap.
Modified: branches/DRDDEV/drd/drd_bitmap.h
===================================================================
--- branches/DRDDEV/drd/drd_bitmap.h 2009-06-03 18:48:28 UTC (rev 10231)
+++ branches/DRDDEV/drd/drd_bitmap.h 2009-06-03 19:12:58 UTC (rev 10232)
@@ -627,6 +627,21 @@
}
static __inline__
+void bm2_remove(struct bitmap* const bm, const UWord a1)
+{
+ struct bitmap2* bm2;
+
+#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
+ tl_assert(bm);
+#endif
+
+ bm2 = VG_(OSetGen_Remove)(&bm->oset, &a1);
+ VG_(OSetGen_FreeNode)(&bm->oset, bm2);
+
+ bm_update_cache(bm, a1, NULL);
+}
+
+static __inline__
void bm_access_aligned_load(struct bitmap* const bm,
const Addr a1, const SizeT size)
{
Modified: branches/DRDDEV/drd/drd_thread.c
===================================================================
--- branches/DRDDEV/drd/drd_thread.c 2009-06-03 18:48:28 UTC (rev 10231)
+++ branches/DRDDEV/drd/drd_thread.c 2009-06-03 19:12:58 UTC (rev 10232)
@@ -1394,6 +1394,8 @@
}
}
+ DRD_(bm_remove_cleared_marked)(DRD_(g_conflict_set));
+
s_conflict_set_combine_vc_count++;
tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid)));
Modified: branches/DRDDEV/drd/pub_drd_bitmap.h
===================================================================
--- branches/DRDDEV/drd/pub_drd_bitmap.h 2009-06-03 18:48:28 UTC (rev 10231)
+++ branches/DRDDEV/drd/pub_drd_bitmap.h 2009-06-03 19:12:58 UTC (rev 10232)
@@ -137,6 +137,7 @@
void DRD_(bm_mark)(struct bitmap* bm1, struct bitmap* bm2);
void DRD_(bm_clear_marked)(struct bitmap* bm);
void DRD_(bm_merge2_marked)(struct bitmap* const lhs, struct bitmap* const rhs);
+void DRD_(bm_remove_cleared_marked)(struct bitmap* bm);
int DRD_(bm_has_races)(struct bitmap* const bm1,
struct bitmap* const bm2);
void DRD_(bm_report_races)(ThreadId const tid1, ThreadId const tid2,
|