Skip to content

Commit 6aa104a

Browse files
author
philippe
committed
Remove useless arguments in sparsewa, that were inheritated from WordFM
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 1eed88b commit 6aa104a

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

coregrind/m_sparsewa.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void VG_(deleteSWA) ( SparseWA* swa )
274274

275275

276276
Bool VG_(lookupSWA) ( const SparseWA* swa,
277-
/*OUT*/UWord* keyP, /*OUT*/UWord* valP,
277+
/*OUT*/UWord* valP,
278278
UWord key )
279279
{
280280
Int i;
@@ -302,7 +302,6 @@ Bool VG_(lookupSWA) ( const SparseWA* swa,
302302
vg_assert(level0->nInUse > 0);
303303
ix = key & 0xFF;
304304
if (swa_bitarray_read(level0->inUse, ix) == 0) return False;
305-
*keyP = key; /* this is stupid. only here to make it look like WordFM */
306305
*valP = level0->words[ix];
307306
return True;
308307
}
@@ -366,7 +365,7 @@ Bool VG_(addToSWA) ( SparseWA* swa, UWord key, UWord val )
366365

367366

368367
Bool VG_(delFromSWA) ( SparseWA* swa,
369-
/*OUT*/UWord* oldK, /*OUT*/UWord* oldV, UWord key )
368+
/*OUT*/UWord* oldV, UWord key )
370369
{
371370
Int i;
372371
UWord ix;
@@ -403,7 +402,6 @@ Bool VG_(delFromSWA) ( SparseWA* swa,
403402
if (swa_bitarray_read_then_clear(level0->inUse, ix) == 0)
404403
return False;
405404

406-
*oldK = key; /* this is silly */
407405
*oldV = level0->words[ix];
408406

409407
level0->nInUse--;

helgrind/libhb_core.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,7 +4149,7 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr )
41494149
OldRef* ref;
41504150
RCEC* rcec;
41514151
Word i, j;
4152-
UWord keyW, valW;
4152+
UWord valW;
41534153
Bool b;
41544154

41554155
tl_assert(thr);
@@ -4173,14 +4173,13 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr )
41734173

41744174
/* Look in the map to see if we already have a record for this
41754175
address. */
4176-
b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, a );
4176+
b = VG_(lookupSWA)( oldrefTree, &valW, a );
41774177

41784178
if (b) {
41794179

41804180
/* We already have a record for this address. We now need to
41814181
see if we have a stack trace pertaining to this (thrid, R/W,
41824182
size) triple. */
4183-
tl_assert(keyW == a);
41844183
ref = (OldRef*)valW;
41854184
tl_assert(ref->magic == OldRef_MAGIC);
41864185

@@ -4287,7 +4286,7 @@ Bool libhb_event_map_lookup ( /*OUT*/ExeContext** resEC,
42874286
{
42884287
Word i, j;
42894288
OldRef* ref;
4290-
UWord keyW, valW;
4289+
UWord valW;
42914290
Bool b;
42924291

42934292
ThrID cand_thrid;
@@ -4319,12 +4318,11 @@ Bool libhb_event_map_lookup ( /*OUT*/ExeContext** resEC,
43194318
cand_a = toCheck[j];
43204319
// VG_(printf)("test %ld %p\n", j, cand_a);
43214320

4322-
b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, cand_a );
4321+
b = VG_(lookupSWA)( oldrefTree, &valW, cand_a );
43234322
if (!b)
43244323
continue;
43254324

43264325
ref = (OldRef*)valW;
4327-
tl_assert(keyW == cand_a);
43284326
tl_assert(ref->magic == OldRef_MAGIC);
43294327
tl_assert(ref->accs[0].thrid != 0); /* first slot must always be used */
43304328

@@ -4705,9 +4703,8 @@ static void event_map_GC ( void )
47054703
for (i = 0; i < n2del; i++) {
47064704
Bool b;
47074705
Addr ga2del = *(Addr*)VG_(indexXA)( refs2del, i );
4708-
b = VG_(delFromSWA)( oldrefTree, &keyW, &valW, ga2del );
4706+
b = VG_(delFromSWA)( oldrefTree, &valW, ga2del );
47094707
tl_assert(b);
4710-
tl_assert(keyW == ga2del);
47114708
oldref = (OldRef*)valW;
47124709
for (j = 0; j < N_OLDREF_ACCS; j++) {
47134710
ThrID aThrID = oldref->accs[j].thrid;

include/pub_tool_sparsewa.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,17 @@ void VG_(deleteSWA) ( SparseWA* swa );
6363
// overwritten. Returned Bool is True iff a previous binding existed.
6464
Bool VG_(addToSWA) ( SparseWA* swa, UWord key, UWord val );
6565

66-
// Delete key from swa, returning associated key and val if found.
67-
// Note: returning associated key is stupid (it can only be the
68-
// key you just specified). This behaviour is retained to make it
69-
// easier to migrate from WordFM. Returned Bool is True iff
70-
// the key was actually bound in the mapping.
66+
// Delete key from swa, returning val if found.
67+
// Returned Bool is True iff the key was actually bound in the mapping.
7168
Bool VG_(delFromSWA) ( SparseWA* swa,
72-
/*OUT*/UWord* oldK, /*OUT*/UWord* oldV,
69+
/*OUT*/UWord* oldV,
7370
UWord key );
7471

7572
// Indexes swa at 'key' (or, if you like, looks up 'key' in the
76-
// mapping), and returns the associated value, if any, in *valP. For
77-
// compatibility with WordFM, 'key' is also returned in *keyP. Returned
78-
// Bool is True iff a binding for 'key' actually existed.
73+
// mapping), and returns the associated value, if any, in *valP.
74+
// Returned Bool is True iff a binding for 'key' actually existed.
7975
Bool VG_(lookupSWA) ( const SparseWA* swa,
80-
/*OUT*/UWord* keyP, /*OUT*/UWord* valP,
76+
/*OUT*/UWord* valP,
8177
UWord key );
8278

8379
// Set up 'swa' for iteration.

0 commit comments

Comments
 (0)