]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Made arguments of bitmap manipulating functions more uniform.
authorBart Van Assche <bvanassche@acm.org>
Thu, 13 Mar 2008 19:10:06 +0000 (19:10 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 13 Mar 2008 19:10:06 +0000 (19:10 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7674

exp-drd/drd_bitmap.c
exp-drd/drd_main.c
exp-drd/drd_suppression.c
exp-drd/pub_drd_bitmap.h

index d0160e735004f83effc2457c7c86c2015da0b3e1..61aca8526744adf56098c85fb3bb5390ffa42650 100644 (file)
@@ -147,25 +147,24 @@ void bm_access_4(struct bitmap* const bm,
 }
 
 /**
- * Record an access of type access_type at addresses a .. a + size - 1 in
+ * Record an access of type access_type at addresses a1 .. a2 - 1 in
  * bitmap bm.
  */
 void bm_access_range(struct bitmap* const bm,
-                     const Addr a,
-                     const SizeT size,
+                     const Addr a1, const Addr a2,
                      const BmAccessTypeT access_type)
 {
    tl_assert(bm);
-   tl_assert(size > 0);
+   tl_assert(a1 < a2);
 
-   if (size == 4)
-      bm_access_4(bm, a, access_type);
-   else if (size == 1)
-      bm_access_1(bm, a, access_type);
+   if (a2 - a1 == 4)
+      bm_access_4(bm, a1, access_type);
+   else if (a2 - a1 == 1)
+      bm_access_1(bm, a1, access_type);
    else
    {
       Addr b;
-      for (b = a; b != a + size; b++)
+      for (b = a1; b != a2; b++)
       {
          bm_access_1(bm, b, access_type);
       }
@@ -614,8 +613,10 @@ void bm_test(void)
 
    for (i = 0; i < sizeof(s_args)/sizeof(s_args[0]); i++)
    {
-      bm_access_range(bm, s_args[i].address,
-                      s_args[i].size, s_args[i].access_type);
+      bm_access_range(bm,
+                      s_args[i].address,
+                      s_args[i].address + s_args[i].size,
+                      s_args[i].access_type);
    }
 
    VG_(printf)("Map contents -- should contain 10 addresses:\n");
index 8ad045f3551cdbcc215751455988fb0b6f18523d..79d6aa4ef00031e0b2d05be1a1b99bb401dcf7bf 100644 (file)
@@ -180,7 +180,7 @@ VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size)
    }
 #endif
    sg = thread_get_segment(thread_get_running_tid());
-   bm_access_range(sg->bm, addr, size, eLoad);
+   bm_access_range(sg->bm, addr, addr + size, eLoad);
    if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
        && ! drd_is_suppressed(addr, addr + size))
    {
@@ -230,7 +230,7 @@ VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size)
    }
 #endif
    sg = thread_get_segment(thread_get_running_tid());
-   bm_access_range(sg->bm, addr, size, eStore);
+   bm_access_range(sg->bm, addr, addr + size, eStore);
    if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
        && ! drd_is_suppressed(addr, addr + size))
    {
index 71a4c608e7887443a107af32b3797991ec9ceab1..6aab43aac2bf69dc3f7b4e28ec05658702f1af61 100644 (file)
@@ -62,7 +62,7 @@ void drd_start_suppression(const Addr a1, const Addr a2,
 
   tl_assert(a1 < a2);
   tl_assert(! drd_is_any_suppressed(a1, a2));
-  bm_access_range(s_suppressed, a1, a2 - a1, eStore);
+  bm_access_range(s_suppressed, a1, a2, eStore);
 }
 
 void drd_finish_suppression(const Addr a1, const Addr a2)
index b706657c3221a92199fa1758b51f4e4497d5f2af..2ac1c3772d4146892ab4d3e1fea3334e762b2414 100644 (file)
@@ -57,8 +57,7 @@ typedef enum { eLoad, eStore } BmAccessTypeT;
 struct bitmap* bm_new(void);
 void bm_delete(struct bitmap* const bm);
 void bm_access_range(struct bitmap* const bm,
-                     const Addr address,
-                     const SizeT size,
+                     const Addr a1, const Addr a2,
                      const BmAccessTypeT access_type);
 void bm_access_4(struct bitmap* const bm,
                  const Addr address,
@@ -96,8 +95,6 @@ void bm_report_races(ThreadId const tid1, ThreadId const tid2,
 void bm_print(const struct bitmap* bm);
 ULong bm_get_bitmap_creation_count(void);
 ULong bm_get_bitmap2_creation_count(void);
-void bm_test(void);
-
 
 
 #endif /* __DRD_BITMAP_H */