From 528046b53712dd8fa435a2e2be51d6f1d1d4bf9a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 4 Nov 2004 16:39:43 +0000 Subject: [PATCH] 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 --- coregrind/vg_hashtable.c | 2 +- helgrind/hg_main.c | 4 ++-- include/tool.h.base | 4 ++-- massif/ms_main.c | 2 +- memcheck/mac_malloc_wrappers.c | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/coregrind/vg_hashtable.c b/coregrind/vg_hashtable.c index 8b19cf73a..9df208072 100644 --- a/coregrind/vg_hashtable.c +++ b/coregrind/vg_hashtable.c @@ -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; diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 256ae3300..8200f5ed1 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -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) { diff --git a/include/tool.h.base b/include/tool.h.base index ec0460f7e..90727a166 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -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 diff --git a/massif/ms_main.c b/massif/ms_main.c index e88edbd35..9ce8d0e6c 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -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 ); } diff --git a/memcheck/mac_malloc_wrappers.c b/memcheck/mac_malloc_wrappers.c index 23f59b65b..17c47acac 100644 --- a/memcheck/mac_malloc_wrappers.c +++ b/memcheck/mac_malloc_wrappers.c @@ -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) {