]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Re-enable the use of loctab (line number table) trimming, for a 5% to
authorJulian Seward <jseward@acm.org>
Mon, 26 Sep 2011 20:15:07 +0000 (20:15 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 26 Sep 2011 20:15:07 +0000 (20:15 +0000)
10% reduction in debuginfo storage requirements for large applications
on 32 bit platforms.  This code had been present since the MacOSX port
was merged but had been disabled.  Remove equivalent code for
shrinking the symbol tables since they are much (4 x) smaller than the
line number tables, trimming them is hardly worth the effort.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12050

coregrind/m_debuginfo/priv_storage.h
coregrind/m_debuginfo/storage.c

index 740e6f762cd56182e4225a779e77530f373454bb..b36c74248cc79c78ac6ae27925b1764efe1279d0 100644 (file)
@@ -813,12 +813,6 @@ void ML_(addLineInfo) ( struct _DebugInfo* di,
                         UChar*   dirname,  /* NULL is allowable */
                         Addr this, Addr next, Int lineno, Int entry);
 
-/* Shrink completed tables to save memory. */
-extern 
-void ML_(shrinkSym) ( struct _DebugInfo *di );
-extern 
-void ML_(shrinkLineInfo) ( struct _DebugInfo *di );
-
 /* Add a CFI summary record.  The supplied DiCfSI is copied. */
 extern void ML_(addDiCfSI) ( struct _DebugInfo* di, DiCfSI* cfsi );
 
index 6142cb061afae38d0b694a89c31aee54184eb9cd..5391552cf66d0522ab53a3944a9942bcac3dbaf7 100644 (file)
@@ -281,24 +281,6 @@ void ML_(addSym) ( struct _DebugInfo* di, DiSym* sym )
 }
 
 
-/* Resize the symbol table to save memory.
-*/
-void ML_(shrinkSym)( struct _DebugInfo* di )
-{
-   DiSym* new_tab;
-   UInt new_sz = di->symtab_used;
-   if (new_sz == di->symtab_size) return;
-
-   new_tab = ML_(dinfo_zalloc)( "di.storage.shrinkSym", 
-                                new_sz * sizeof(DiSym) );
-   VG_(memcpy)(new_tab, di->symtab, new_sz * sizeof(DiSym));
-
-   ML_(dinfo_free)(di->symtab);
-   di->symtab = new_tab;
-   di->symtab_size = new_sz;
-}
-
-
 /* Add a location to the location table. 
 */
 static void addLoc ( struct _DebugInfo* di, DiLoc* loc )
@@ -329,15 +311,18 @@ static void addLoc ( struct _DebugInfo* di, DiLoc* loc )
 }
 
 
-/* Resize the lineinfo table to save memory.
+/* Resize the LocTab (line number table) to save memory, by removing
+   (and, potentially, allowing m_mallocfree to unmap) any unused space
+   at the end of the table.
 */
-void ML_(shrinkLineInfo)( struct _DebugInfo* di )
+static void shrinkLocTab ( struct _DebugInfo* di )
 {
    DiLoc* new_tab;
-   UInt new_sz = di->loctab_used;
+   UWord new_sz = di->loctab_used;
    if (new_sz == di->loctab_size) return;
+   vg_assert(new_sz < di->loctab_size);
 
-   new_tab = ML_(dinfo_zalloc)( "di.storage.shrinkLineInfo", 
+   new_tab = ML_(dinfo_zalloc)( "di.storage.shrinkLocTab", 
                                 new_sz * sizeof(DiLoc) );
    VG_(memcpy)(new_tab, di->loctab, new_sz * sizeof(DiLoc));
 
@@ -1648,6 +1633,9 @@ static void canonicaliseLoctab ( struct _DebugInfo* di )
                 < di->loctab[i+1].addr);
    }
 #  undef SWAP
+
+   /* Free up unused space at the end of the table. */
+   shrinkLocTab(di);
 }