Commit Graph

3514 Commits

Author SHA1 Message Date
Nicholas Nethercote
3b0f062e58 Trim some fat; removing this assertion makes Remove() about 5% faster.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4413
2005-08-14 23:00:57 +00:00
Nicholas Nethercote
756f513b51 Add a thorough unit test for m_oset. Note that this is Memcheck
testing code that's part of Valgrind, which is a good thing.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4412
2005-08-14 22:43:53 +00:00
Nicholas Nethercote
9741f60c1f Forgot this file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4411
2005-08-14 22:14:55 +00:00
Nicholas Nethercote
89163ecf45 Added new module, m_oset, which provides a generic data structure, OSet,
which is a sorted set with no duplicates.  This is derived from
m_skiplist, which it will hopefully replace.  The interface has the
following improvements:

- Avoided all mention of how the data structure is implemented in the
  interface, so it could be replaced with another data structure without
  changing external code.
- Two kinds of comparison:  fast -- use the first word of each element
  for comparison;  slow -- use a custom function.  The custom function
  compares a key with an element, so non-overlapping interval lists can
  be supported easily.  m_skiplist only supports the slow variant, and it
  makes things almost 2x faster.
- Users pass in malloc() and free() functions, so m_oset.c it doesn't
  rely on any particular allocator.
- It has a Destroy() function which will deallocate all the nodes.
- It allows variable-sized nodes.
- No static constructor;  I needed the flexibility of being able to
  execute arbitrary code in the constructor.  This also means no type
  internals are exposed.

No part of Valgrind actually uses OSet yet, although I've privately
converted several data structures, and so I'm confident that the
interface is basically sound.  Some functions may be added later.
  
The implementation uses AVL trees, and has the following
characteristics:

- Lookup is much faster than for skiplists -- around 3x.  This is
  because the inner lookup loop is much tighter.
- Insertion and removal is similar speed to skiplists, maybe a little
  slower, but there's still some fat to be trimmed.
- The code is a bit longer and more complex than the skiplist code.

This was intended to replace the need for the VgHashTable type.  But my
experiments have shown that VgHashTable is really fast, faster than both
AVL trees and skiplists in all but extreme cases (eg. if the hashtable
becomes way too full):  insertion takes constant time, because you always
prepend to chains;  lookup depends on chain length, but the inner loop
is so tight that you need about 20 elements per chain before it gets
worse than the AVL tree;  removal is similar to lookup.  And because
insertion uses prepending, any locality in accesses will help things.  If
VgHashTable had its interface cleaned up to look like OSet's, and was made
to auto-resize when it got too full, it might be a better OSet (although
it's not sorted).

So, it's currently unclear exactly how the AVL tree OSet will be used.
The skiplist could be converted to the new interface (I have a 90%
complete version which I used in the comparison experiments).  If
VgHashTable was converted to the same interface (or as close as
possible) it would make direct comparison of important places (eg.
Memcheck's malloc_lists) simple.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4410
2005-08-14 22:13:00 +00:00
Nicholas Nethercote
7062ca6bc7 Remove more now-unnecessary casts, thanks to the recent VgHashTable changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4409
2005-08-14 18:32:16 +00:00
Nicholas Nethercote
8028d5a979 Remove ancient backwards compatibility code which is no longer needed, since
backwards compatibility was broken in various other ways by 3.0.0.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4408
2005-08-14 18:24:44 +00:00
Nicholas Nethercote
4f064ec81b Added an iterator to VgHashTable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4407
2005-08-14 17:42:35 +00:00
Nicholas Nethercote
c1719a4c98 Clarify comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4406
2005-08-14 17:36:07 +00:00
Nicholas Nethercote
d16a4d9638 Update for Vex.
BACKPORT TO 3_0_X?



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4405
2005-08-14 17:25:28 +00:00
Nicholas Nethercote
5d07a9ad26 Changed many, but not all, of the VgHashNode* parameters and return
types in m_hashtable.c to void*.  This requires no changes to code
already using VgHashTables, but it allows some previously-required casts
to be removed.  I also changed Memcheck and Massif by removing some of
these now-unnecessary casts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4404
2005-08-14 06:24:20 +00:00
Nicholas Nethercote
81903d273f Compactify unload_symbols().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4403
2005-08-14 04:29:12 +00:00
Nicholas Nethercote
af90765263 Partially evaluate m_stacks.c to simplify and shrink it a bit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4402
2005-08-14 04:12:40 +00:00
Julian Seward
7c26ef016c Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4401
2005-08-14 00:59:45 +00:00
Julian Seward
c38761cc3f Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4400
2005-08-14 00:31:26 +00:00
Julian Seward
96e1fc25ec Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4399
2005-08-13 23:38:26 +00:00
Dirk Mueller
19183e0892 update
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4398
2005-08-13 20:31:18 +00:00
Dirk Mueller
b7b7ba2f66 update
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4396
2005-08-13 19:47:57 +00:00
Dirk Mueller
ba73cd172e update
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4394
2005-08-13 19:46:18 +00:00
Julian Seward
173befe53d Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4392
2005-08-13 00:33:08 +00:00
Nicholas Nethercote
ec77b92b98 Cachegrind should not assert when it encounters a client request.
BACKPORT TO 3_0_X



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4391
2005-08-12 23:47:51 +00:00
Julian Seward
76cfc4175d Add regtest for x86 cmpxchg8b.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4390
2005-08-12 23:40:55 +00:00
Julian Seward
7bfa28e29c Oops, recover from race condition in updating this file :-)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4389
2005-08-12 19:41:06 +00:00
Julian Seward
dd664d30ed Track recently-arrived bugs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4388
2005-08-12 19:27:21 +00:00
Tom Hughes
3567cb76b9 Update some bug statuses.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4387
2005-08-12 19:26:00 +00:00
Tom Hughes
9631a40eb7 Make sure we have enough space for the name if the path is empty. Patch
from Jakub Jelinek to fix bug #110656.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4386
2005-08-12 19:21:29 +00:00
Nicholas Nethercote
b0887d95d2 Give informative failure messages if you try to use Helgrind or
Addrcheck.  As a results, we are now building Addrcheck again, which
required commenting out lots of code.

BACKPORT TO 3_0_X, AND POSSIBLY TO 2_4_X (the Helgrind part, with
    modifications)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4384
2005-08-12 15:23:57 +00:00
Nicholas Nethercote
c37f2349c6 fix an output for xml1
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4383
2005-08-11 02:48:11 +00:00
Nicholas Nethercote
220b4e8224 Tighten up update_extra() for Memcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4382
2005-08-11 02:46:54 +00:00
Nicholas Nethercote
024036d095 Massif cleanups.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4381
2005-08-11 02:17:07 +00:00
Nicholas Nethercote
d892f660ec Streamline handling of realloc() in Memcheck and Massif by using
the newly added VgHashTable functions.  Also some other minor changes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4380
2005-08-11 02:09:25 +00:00
Nicholas Nethercote
8515143ce8 Get rid of some stupidity:
- Added some useful hash table functions (vanilla lookup() and remove()).
  [Actually, I accidentally added them with my previous commit]
  
  Replaced various simple uses of VG_(HT_get_node) with these new functions. 

- Passing record_freemismatch_error() the MAC_Chunk of the freed heap block.
  So now we don't need to call describe_addr() to re-find that block, which
  means that we can remove the MAC_Chunk from the malloc_list earlier, rather
  than having to do a lookup and then later remove it with the stupid removal
  handle returned by VG_(HT_get_node)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4379
2005-08-11 00:47:10 +00:00
Nicholas Nethercote
7f8c275c59 Give variable a better name.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4378
2005-08-11 00:06:36 +00:00
Nicholas Nethercote
a6f1874fd2 Use memcpy() instead of a loop.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4377
2005-08-10 21:25:36 +00:00
Julian Seward
d718ce817c Track recent merging.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4376
2005-08-10 18:25:00 +00:00
Tom Hughes
d88aae8a82 Fill in some revision numbers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4375
2005-08-10 18:21:42 +00:00
Julian Seward
e2f781fd27 Reformat and update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4373
2005-08-10 17:21:30 +00:00
Tom Hughes
71c161c322 Update details of slow startup on gentoo amd64 systems.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4369
2005-08-10 13:42:50 +00:00
Julian Seward
96670a46d1 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4368
2005-08-10 12:54:53 +00:00
Julian Seward
b537ffb195 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4361
2005-08-10 11:20:44 +00:00
Cerion Armour-Brown
429d94fc43 fixed endianness bug for ppc xml output
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4358
2005-08-09 22:34:18 +00:00
Julian Seward
a31dc3adf0 Update regtest output after r4356. Will update 64-bit expected output
tomorrow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4357
2005-08-09 22:21:14 +00:00
Julian Seward
5e41090846 Print all XML output with a consistent nesting style, so as to make it
easier to compare it to the output of other XML generating tools.
Regtest expected-output changes to follow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4356
2005-08-09 22:03:08 +00:00
Julian Seward
ed702a8db4 When printing error counts, print the <unique> in the same way that
it is in the error itself.  Otherwise it's totally useless :-)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4355
2005-08-09 21:50:18 +00:00
Nicholas Nethercote
d37c5cc58d Move file to a more appropriate place.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4350
2005-08-09 00:13:48 +00:00
Tom Hughes
9ee36c69b4 Fix up the sigaction results.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4347
2005-08-08 18:32:54 +00:00
Tom Hughes
606bd75025 Fix system call name in error messages.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4346
2005-08-08 16:50:16 +00:00
Julian Seward
17609131fd Update summary.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4340
2005-08-08 00:53:45 +00:00
Julian Seward
782965122b Make Valgrind work again on x86 CPUs which don't have SSE. This is a
bit of an ugly hack (see comments in m_machine.c) which is suitable
for merging into 3_0_BRANCH, but should be cleaned up once that's
done.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4339
2005-08-08 00:35:46 +00:00
Tom Hughes
ebe67e6134 Check the fields of the new structure passed to sigaction individually
and only check sa_restorer if the SA_RESTORER flag is set.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4338
2005-08-07 15:16:59 +00:00
Julian Seward
d2b672b169 Valgrind-side stub for dealing with x86 sysenter artefacts from Vex.
Does not do anything yet.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4337
2005-08-07 14:49:27 +00:00