|
From: <sv...@va...> - 2011-09-26 20:19:53
|
Author: sewardj
Date: 2011-09-26 21:15:07 +0100 (Mon, 26 Sep 2011)
New Revision: 12050
Log:
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.
Modified:
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/storage.c
Modified: trunk/coregrind/m_debuginfo/priv_storage.h
===================================================================
--- trunk/coregrind/m_debuginfo/priv_storage.h 2011-09-26 17:50:46 UTC (rev 12049)
+++ trunk/coregrind/m_debuginfo/priv_storage.h 2011-09-26 20:15:07 UTC (rev 12050)
@@ -813,12 +813,6 @@
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 );
Modified: trunk/coregrind/m_debuginfo/storage.c
===================================================================
--- trunk/coregrind/m_debuginfo/storage.c 2011-09-26 17:50:46 UTC (rev 12049)
+++ trunk/coregrind/m_debuginfo/storage.c 2011-09-26 20:15:07 UTC (rev 12050)
@@ -281,24 +281,6 @@
}
-/* 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 @@
}
-/* 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 @@
< di->loctab[i+1].addr);
}
# undef SWAP
+
+ /* Free up unused space at the end of the table. */
+ shrinkLocTab(di);
}
|