|
From: <sv...@va...> - 2009-08-17 16:36:25
|
Author: sewardj Date: 2009-08-17 17:36:11 +0100 (Mon, 17 Aug 2009) New Revision: 10837 Log: Back out r10385 (Change demangler to not use excessive space from stack) pending further investigations, as per discussion at http://bugs.kde.org/show_bug.cgi?id=197988. Modified: trunk/coregrind/m_demangle/cp-demangle.c Modified: trunk/coregrind/m_demangle/cp-demangle.c =================================================================== --- trunk/coregrind/m_demangle/cp-demangle.c 2009-08-17 16:02:16 UTC (rev 10836) +++ trunk/coregrind/m_demangle/cp-demangle.c 2009-08-17 16:36:11 UTC (rev 10837) @@ -4426,12 +4426,17 @@ cplus_demangle_init_info (mangled, options, strlen (mangled), &di); { - /* The original demangler uses alloca here with large allocations - for template-heavy code, e.g. when using Boost. This - is bad for Valgrind tools with limited stack size */ - di.comps = xmalloc(di.num_comps * sizeof (*di.comps)); - di.subs = xmalloc(di.num_subs * sizeof (*di.subs)); +#ifdef CP_DYNAMIC_ARRAYS + __extension__ struct demangle_component comps[di.num_comps]; + __extension__ struct demangle_component *subs[di.num_subs]; + di.comps = comps; + di.subs = subs; +#else + di.comps = alloca (di.num_comps * sizeof (*di.comps)); + di.subs = alloca (di.num_subs * sizeof (*di.subs)); +#endif + if (type) dc = cplus_demangle_type (&di); else @@ -4451,9 +4456,6 @@ status = (dc != NULL) ? cplus_demangle_print_callback (options, dc, callback, opaque) : 0; - - free(di.comps); - free(di.subs); } return status; |