This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][C++][RFH] Improve PR29433, cut down memory usage and compile-time


On Wed, 22 Nov 2006, Richard Guenther wrote:

> any idea why this goes wrong?  One thing is that we don't seem to get
> complete types at the point of calling classtype_mangled_name, which
> is why even returning a string from TYPE_UID works for the c++ testsuite.
> Still there seem to be some invariants classtype_mangled_name needs to
> guarantee - which are unfortunately not documented and somewhat hard to
> dig out.

Just to clarify what I mean with TYPE_UID.  If you replace the 
classtype_mangled_name hunk with

*************** classtype_mangled_name (tree t)
*** 4354,4365 ****
         implicit from their surrounding context.  */
        if (PRIMARY_TEMPLATE_P (tmpl))
        {
!         tree name = DECL_NAME (tmpl);
!         char *mangled_name = mangle_class_name_for_template
!           (IDENTIFIER_POINTER (name),
!            DECL_INNERMOST_TEMPLATE_PARMS (tmpl),
!            CLASSTYPE_TI_ARGS (t));
!         tree id = get_identifier (mangled_name);
          IDENTIFIER_TEMPLATE (id) = name;
          return id;
        }
--- 4263,4274 ----
         implicit from their surrounding context.  */
        if (PRIMARY_TEMPLATE_P (tmpl))
        {
!         tree id, name = DECL_NAME (tmpl);
!         char tmp[16];
!         const char *mangled_name;
!         sprintf (tmp, "%i",  TYPE_UID (t));
!         mangled_name = xstrdup (tmp);
!         id = get_identifier (mangled_name);
          IDENTIFIER_TEMPLATE (id) = name;
          return id;
        }


then you get a few PCH failures but else bootstrap & testing is fine
(and you get even a little more memory savings).  Of course this hints
at whoever was using DECL_NAME to do something can use TYPE_UID and
we can simply leave DECL_NAME alone in the above case.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]