From: Julian Seward Date: Mon, 26 Sep 2011 20:15:07 +0000 (+0000) Subject: Re-enable the use of loctab (line number table) trimming, for a 5% to X-Git-Tag: svn/VALGRIND_3_7_0~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4725b367ab7b0f4d421155e4595a55babd24fbbf;p=thirdparty%2Fvalgrind.git Re-enable the use of loctab (line number table) trimming, for a 5% to 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 --- diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h index 740e6f762c..b36c74248c 100644 --- a/coregrind/m_debuginfo/priv_storage.h +++ b/coregrind/m_debuginfo/priv_storage.h @@ -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 ); diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 6142cb061a..5391552cf6 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -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); }