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 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index e273cf8..159c5f8 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -358,10 +358,9 @@
static
BB_info* get_BB_info(IRBB* bbIn, Addr origAddr, Bool* bbSeenBefore)
{
- Int i, n_instrs;
- IRStmt* st;
- BB_info* bbInfo;
- VgHashNode** dummy;
+ Int i, n_instrs;
+ IRStmt* st;
+ BB_info* bbInfo;
// Count number of original instrs in BB
n_instrs = 0;
@@ -371,7 +370,7 @@
}
// Get the BB_info
- bbInfo = (BB_info*)VG_(HT_get_node)(instr_info_table, origAddr, &dummy);
+ bbInfo = (BB_info*)VG_(HT_lookup)(instr_info_table, origAddr);
*bbSeenBefore = ( NULL == bbInfo ? False : True );
if (*bbSeenBefore) {
// BB must have been translated before, but flushed from the TT
@@ -1078,15 +1077,13 @@
// Called when a translation is invalidated due to code unloading.
static void cg_discard_basic_block_info ( Addr a, SizeT size )
{
- VgHashNode** prev_next_ptr;
VgHashNode* bbInfo;
if (0) VG_(printf)( "discard_basic_block_info: %p, %llu\n", a, (ULong)size);
// Get BB info, remove from table, free BB info. Simple!
- bbInfo = VG_(HT_get_node)(instr_info_table, a, &prev_next_ptr);
+ bbInfo = VG_(HT_remove)(instr_info_table, a);
tl_assert(NULL != bbInfo);
- *prev_next_ptr = bbInfo->next;
VG_(free)(bbInfo);
}