]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove useless arguments in sparsewa, that were inheritated from WordFM
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 11 Apr 2015 11:42:22 +0000 (11:42 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 11 Apr 2015 11:42:22 +0000 (11:42 +0000)
These arguments are not needed for sparsewa, as they can only
return the key given in input.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15083

coregrind/m_sparsewa.c
helgrind/libhb_core.c
include/pub_tool_sparsewa.h

index 94a3cec2ddf193e66b45038d5c788882cf4253ce..3f111c411df6e0ebddc6a86909ad38b09f164fc3 100644 (file)
@@ -274,7 +274,7 @@ void VG_(deleteSWA) ( SparseWA* swa )
 
 
 Bool VG_(lookupSWA) ( const SparseWA* swa,
-                      /*OUT*/UWord* keyP, /*OUT*/UWord* valP,
+                      /*OUT*/UWord* valP,
                       UWord key )
 {
    Int     i;
@@ -302,7 +302,6 @@ Bool VG_(lookupSWA) ( const SparseWA* swa,
    vg_assert(level0->nInUse > 0);
    ix = key & 0xFF;
    if (swa_bitarray_read(level0->inUse, ix) == 0) return False;
-   *keyP = key; /* this is stupid.  only here to make it look like WordFM */
    *valP = level0->words[ix];
    return True;
 }
@@ -366,7 +365,7 @@ Bool VG_(addToSWA) ( SparseWA* swa, UWord key, UWord val )
 
 
 Bool VG_(delFromSWA) ( SparseWA* swa,
-                       /*OUT*/UWord* oldK, /*OUT*/UWord* oldV, UWord key )
+                       /*OUT*/UWord* oldV, UWord key )
 {
    Int     i;
    UWord   ix;
@@ -403,7 +402,6 @@ Bool VG_(delFromSWA) ( SparseWA* swa,
    if (swa_bitarray_read_then_clear(level0->inUse, ix) == 0)
       return False;
 
-   *oldK = key; /* this is silly */
    *oldV = level0->words[ix];
 
    level0->nInUse--;
index 1bd771d4be00eec27e01e58b278c286178e3e120..b9c806480fe2d3ad31bbf7f4497f7153ceeb31c9 100644 (file)
@@ -4149,7 +4149,7 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr )
    OldRef* ref;
    RCEC*   rcec;
    Word    i, j;
-   UWord   keyW, valW;
+   UWord   valW;
    Bool    b;
 
    tl_assert(thr);
@@ -4173,14 +4173,13 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr )
 
    /* Look in the map to see if we already have a record for this
       address. */
-   b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, a );
+   b = VG_(lookupSWA)( oldrefTree, &valW, a );
 
    if (b) {
 
       /* We already have a record for this address.  We now need to
          see if we have a stack trace pertaining to this (thrid, R/W,
          size) triple. */
-      tl_assert(keyW == a);
       ref = (OldRef*)valW;
       tl_assert(ref->magic == OldRef_MAGIC);
 
@@ -4287,7 +4286,7 @@ Bool libhb_event_map_lookup ( /*OUT*/ExeContext** resEC,
 {
    Word    i, j;
    OldRef* ref;
-   UWord   keyW, valW;
+   UWord   valW;
    Bool    b;
 
    ThrID     cand_thrid;
@@ -4319,12 +4318,11 @@ Bool libhb_event_map_lookup ( /*OUT*/ExeContext** resEC,
       cand_a = toCheck[j];
       //      VG_(printf)("test %ld %p\n", j, cand_a);
 
-      b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, cand_a );
+      b = VG_(lookupSWA)( oldrefTree, &valW, cand_a );
       if (!b)
          continue;
 
       ref = (OldRef*)valW;
-      tl_assert(keyW == cand_a);
       tl_assert(ref->magic == OldRef_MAGIC);
       tl_assert(ref->accs[0].thrid != 0); /* first slot must always be used */
 
@@ -4705,9 +4703,8 @@ static void event_map_GC ( void )
    for (i = 0; i < n2del; i++) {
       Bool  b;
       Addr  ga2del = *(Addr*)VG_(indexXA)( refs2del, i );
-      b = VG_(delFromSWA)( oldrefTree, &keyW, &valW, ga2del );
+      b = VG_(delFromSWA)( oldrefTree, &valW, ga2del );
       tl_assert(b);
-      tl_assert(keyW == ga2del);
       oldref = (OldRef*)valW;
       for (j = 0; j < N_OLDREF_ACCS; j++) {
          ThrID aThrID = oldref->accs[j].thrid;
index f56e631c9cf0c7a26cac77e1b0e326c523fac5d9..8e1644dd944e40856a969650c10f1dcd3ac20fab 100644 (file)
@@ -63,21 +63,17 @@ void VG_(deleteSWA) ( SparseWA* swa );
 // overwritten.  Returned Bool is True iff a previous binding existed.
 Bool VG_(addToSWA) ( SparseWA* swa, UWord key, UWord val );
 
-// Delete key from swa, returning associated key and val if found.
-// Note: returning associated key is stupid (it can only be the
-// key you just specified).  This behaviour is retained to make it
-// easier to migrate from WordFM.  Returned Bool is True iff
-// the key was actually bound in the mapping.
+// Delete key from swa, returning val if found.
+// Returned Bool is True iff the key was actually bound in the mapping.
 Bool VG_(delFromSWA) ( SparseWA* swa,
-                       /*OUT*/UWord* oldK, /*OUT*/UWord* oldV,
+                       /*OUT*/UWord* oldV,
                        UWord key );
 
 // Indexes swa at 'key' (or, if you like, looks up 'key' in the
-// mapping), and returns the associated value, if any, in *valP.  For
-// compatibility with WordFM, 'key' is also returned in *keyP.  Returned
-// Bool is True iff a binding for 'key' actually existed.
+// mapping), and returns the associated value, if any, in *valP.
+// Returned Bool is True iff a binding for 'key' actually existed.
 Bool VG_(lookupSWA) ( const SparseWA* swa,
-                      /*OUT*/UWord* keyP, /*OUT*/UWord* valP,
+                      /*OUT*/UWord* valP,
                       UWord key );
 
 // Set up 'swa' for iteration.