64-bit cleanness: make the hash-table have UWord keys instead of UInt keys.

Allows addresses as keys.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2916
This commit is contained in:
Nicholas Nethercote 2004-11-04 16:39:43 +00:00
parent 4582acb198
commit 528046b537
5 changed files with 12 additions and 12 deletions

View File

@ -73,7 +73,7 @@ void VG_(HT_add_node) ( VgHashTable table, VgHashNode* node )
/* Looks up a VgHashNode in the table. Also returns the address of
the previous node's `next' pointer which allows it to be removed from the
list later without having to look it up again. */
VgHashNode* VG_(HT_get_node) ( VgHashTable table, UInt key,
VgHashNode* VG_(HT_get_node) ( VgHashTable table, UWord key,
/*OUT*/VgHashNode*** next_ptr )
{
VgHashNode *prev, *curr;

View File

@ -1920,7 +1920,7 @@ void handle_free ( void* p )
HG_Chunk* hc;
HG_Chunk** prev_chunks_next_ptr;
hc = (HG_Chunk*)VG_(HT_get_node) ( hg_malloc_list, (UInt)p,
hc = (HG_Chunk*)VG_(HT_get_node) ( hg_malloc_list, (UWord)p,
(VgHashNode***)&prev_chunks_next_ptr );
if (hc == NULL) {
return;
@ -1952,7 +1952,7 @@ void* SK_(realloc) ( void* p, SizeT new_size )
ThreadId tid = VG_(get_current_or_recent_tid)();
/* First try and find the block. */
hc = (HG_Chunk*)VG_(HT_get_node) ( hg_malloc_list, (UInt)p,
hc = (HG_Chunk*)VG_(HT_get_node) ( hg_malloc_list, (UWord)p,
(VgHashNode***)&prev_chunks_next_ptr );
if (hc == NULL) {

View File

@ -1586,7 +1586,7 @@ extern VgSectKind VG_(seg_sect_kind)(Addr);
typedef
struct _VgHashNode {
struct _VgHashNode * next;
UInt key;
UWord key;
}
VgHashNode;
@ -1606,7 +1606,7 @@ extern void VG_(HT_add_node) ( VgHashTable t, VgHashNode* node );
/* Looks up a node in the hash table. Also returns the address of the
previous node's `next' pointer which allows it to be removed from the
list later without having to look it up again. */
extern VgHashNode* VG_(HT_get_node) ( VgHashTable t, UInt key,
extern VgHashNode* VG_(HT_get_node) ( VgHashTable t, UWord key,
/*OUT*/VgHashNode*** next_ptr );
/* Allocates an array of pointers to all the shadow chunks of malloc'd

View File

@ -648,7 +648,7 @@ void add_HP_Chunk(HP_Chunk* hc)
static __inline__
HP_Chunk* get_HP_Chunk(void* p, HP_Chunk*** prev_chunks_next_ptr)
{
return (HP_Chunk*)VG_(HT_get_node) ( malloc_list, (UInt)p,
return (HP_Chunk*)VG_(HT_get_node) ( malloc_list, (UWord)p,
(VgHashNode***)prev_chunks_next_ptr );
}

View File

@ -304,7 +304,7 @@ void MAC_(handle_free) ( Addr p, UInt rzB, MAC_AllocKind kind )
cmalloc_n_frees++;
mc = (MAC_Chunk*)VG_(HT_get_node) ( MAC_(malloc_list), (UInt)p,
mc = (MAC_Chunk*)VG_(HT_get_node) ( MAC_(malloc_list), (UWord)p,
(void*)&prev_chunks_next_ptr );
if (mc == NULL) {
MAC_(record_free_error) ( tid, p );
@ -353,7 +353,7 @@ void* SK_(realloc) ( void* p, SizeT new_size )
return NULL;
/* First try and find the block. */
mc = (MAC_Chunk*)VG_(HT_get_node) ( MAC_(malloc_list), (UInt)p,
mc = (MAC_Chunk*)VG_(HT_get_node) ( MAC_(malloc_list), (UWord)p,
(void*)&prev_chunks_next_ptr );
if (mc == NULL) {
@ -460,7 +460,7 @@ void MAC_(destroy_mempool)(Addr pool)
MAC_Mempool** prev_next;
mp = (MAC_Mempool*)VG_(HT_get_node) ( MAC_(mempool_list),
(UInt)pool,
(UWord)pool,
(void*)&prev_next );
if (mp == NULL) {
@ -482,7 +482,7 @@ void MAC_(mempool_alloc)(Addr pool, Addr addr, SizeT size)
MAC_Mempool* mp;
MAC_Mempool** prev_next;
mp = (MAC_Mempool*)VG_(HT_get_node) ( MAC_(mempool_list), (UInt)pool,
mp = (MAC_Mempool*)VG_(HT_get_node) ( MAC_(mempool_list), (UWord)pool,
(void*)&prev_next );
if (mp == NULL) {
@ -505,7 +505,7 @@ void MAC_(mempool_free)(Addr pool, Addr addr)
ThreadId tid = VG_(get_current_or_recent_tid)();
mp = (MAC_Mempool*)VG_(HT_get_node)(MAC_(mempool_list), (UInt)pool,
mp = (MAC_Mempool*)VG_(HT_get_node)(MAC_(mempool_list), (UWord)pool,
(void*)&prev_pool);
if (mp == NULL) {
@ -513,7 +513,7 @@ void MAC_(mempool_free)(Addr pool, Addr addr)
return;
}
mc = (MAC_Chunk*)VG_(HT_get_node)(mp->chunks, (UInt)addr,
mc = (MAC_Chunk*)VG_(HT_get_node)(mp->chunks, (UWord)addr,
(void*)&prev_chunk);
if (mc == NULL) {