This is the mail archive of the gcc-bugs@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]

[Bug c++/14179] [3.3/3.4/4.0 Regression] out of memory


------- Additional Comments From mark at codesourcery dot com  2004-09-23 00:16 -------
Subject: Re:  [3.3/3.4/4.0 Regression] out of memory

giovannibajo at libero dot it wrote:

>------- Additional Comments From giovannibajo at libero dot it  2004-09-23 00:01 -------
>Mark: process_init_constructor builds new TREE_LISTs for each new initializer. 
>This is pretty easy to get rid of, at least for arrays, and will be taken of 
>with a patch I will be testing soon. The mainline version will likely extract 
>and cleanup array handling into a separate function.
>
>But process_init_constructor also calls digest_init for each and every 
>initializer, which makes the initializer goes through the conversion machinery. 
>For the example in this PR, we build an IDENTITY_CONV and a couple of 
>STANDARD_CONV for each initializer.
>  
>
On the mainline, this should be much cheaper because we do not build any 
trees for conversions.  We build "struct conversion" instead, and those 
are allocated on an obstack.  So, you should confirm that this is still 
a bottleneck on the mainline.

>For 3.4/3.3, is there a way to avoid calling digest_init if we detect that we 
>can just fold_convert (or similar) the initializer? Or maybe put such a speedup 
>check within digest_init directly? I am thinking of simple default promotions, 
>for which building 3-4 trees and throwing them away doesn't look too smart. I 
>am not expert in this kind of type conversions stuff, so I can't devise what a 
>correct check for this would be, without making it too specific for the case in 
>this PR. Can you suggest me something to get me started?
>  
>
I think it would be better to try to do this in a way that could be used 
on the mainline too.  If conversions are still a bottleneck,  then we 
could try to optimize.  The most common case is probably that the "from" 
and "to" types are the same.  So, you could try having 
implicit_conversion do "if same_type_p (to, from) && !class_type return 
identity conversion".  (Might even be better just to check pointer 
equality of "to" and "from", so as to avoid the cost of same_type_p if 
they are *not* the same.)  That would short-circuit a lot of the work, 
and might win for other test cases as well, because you save not only on 
digest_init, but with function calls like:

  void f(int);
  void g() { f(3); }



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14179


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