Merge Helgrind from branches/YARD into the trunk.  Also includes some
minor changes to make stack unwinding on amd64-linux approximately
twice as fast as it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8707 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/hg_wordset.c b/helgrind/hg_wordset.c
index 041af2e..d5c7fba 100644
--- a/helgrind/hg_wordset.c
+++ b/helgrind/hg_wordset.c
@@ -38,10 +38,11 @@
 #include "pub_tool_libcassert.h"
 #include "pub_tool_libcbase.h"
 #include "pub_tool_libcprint.h"
+#include "pub_tool_threadstate.h"
 #include "pub_tool_wordfm.h"
 
-#define HG_(str) VGAPPEND(vgHelgrind_,str)
-#include "hg_wordset.h"
+#include "hg_basics.h"
+#include "hg_wordset.h"     /* self */
 
 //------------------------------------------------------------------//
 //--- Word Cache                                                 ---//
@@ -140,7 +141,8 @@
    corresponding ix2vec entry number.  The two mappings are mutually
    redundant. */
 struct _WordSetU {
-      void*     (*alloc)(HChar*, SizeT);
+      void*     (*alloc)(HChar*,SizeT);
+      HChar*    cc;
       void      (*dealloc)(void*);
       WordFM*   vec2ix; /* WordVec-to-WordSet mapping tree */
       WordVec** ix2vec; /* WordSet-to-WordVec mapping array */
@@ -176,12 +178,12 @@
 {
    WordVec* wv;
    tl_assert(sz >= 0);
-   wv = wsu->alloc( "hg", sizeof(WordVec) );
+   wv = wsu->alloc( wsu->cc, sizeof(WordVec) );
    wv->owner = wsu;
    wv->words = NULL;
    wv->size = sz;
    if (sz > 0) {
-     wv->words = wsu->alloc( "hg", (SizeT)sz * sizeof(UWord) );
+     wv->words = wsu->alloc( wsu->cc, (SizeT)sz * sizeof(UWord) );
    }
    return wv;
 }
@@ -238,7 +240,7 @@
       return;
    new_sz = 2 * wsu->ix2vec_size;
    if (new_sz == 0) new_sz = 2;
-   new_vec = wsu->alloc( "hg", new_sz * sizeof(WordVec*) );
+   new_vec = wsu->alloc( wsu->cc, new_sz * sizeof(WordVec*) );
    tl_assert(new_vec);
    for (i = 0; i < wsu->ix2vec_size; i++)
       new_vec[i] = wsu->ix2vec[i];
@@ -306,17 +308,19 @@
 
 
 WordSetU* HG_(newWordSetU) ( void* (*alloc_nofail)( HChar*, SizeT ),
+                             HChar* cc,
                              void  (*dealloc)(void*),
                              Word  cacheSize )
 {
    WordSetU* wsu;
    WordVec*  empty;
 
-   wsu          = alloc_nofail( "hg", sizeof(WordSetU) );
+   wsu          = alloc_nofail( cc, sizeof(WordSetU) );
    VG_(memset)( wsu, 0, sizeof(WordSetU) );
    wsu->alloc   = alloc_nofail;
+   wsu->cc      = cc;
    wsu->dealloc = dealloc;
-   wsu->vec2ix  = VG_(newFM)( alloc_nofail, "hg", 
+   wsu->vec2ix  = VG_(newFM)( alloc_nofail, cc,
                               dealloc, cmp_WordVecs_for_FM );
    wsu->ix2vec_used = 0;
    wsu->ix2vec_size = 0;