This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] improve memory use with a large number of pure virtualclass functions
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 24 Jan 2005 23:51:02 -0800
- Subject: Re: [PATCH] improve memory use with a large number of pure virtualclass functions
- References: <6525E736-6E9E-11D9-AEA7-000A95D692F4@physics.uc.edu>
Andrew Pinski <email@example.com> writes:
> In the C++ front-end we produce a vtable with pure member functions
> and we take the address of an abort function but since this abort
> function never changes, really there is no reason why we cannot
> share the ADDR_EXPR for the abort function. This saves about 6M on
> PR 19614 on powerpc-darwin (about 2% of the total allocated memory
> and about 5M left at the end of complication or about 4.8%). So this
> is not a small micro optimization for this testcase but note this
> testcase is weird in that it has more than 200 pure virtual member
> functions in one of its classes.
I wonder why we don't just use nulls, but...
> * class.c (abort_fndecl_addr): New variable.
> (build_vtbl_initializer): If we have a pure virtual function
> share the abort function's address.
> Include gt-cp-class.h at the end.
> * config-lang.in (gtfiles): Add cp/class.c.
... this is OK.