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 giovannibajo at libero dot it  2004-09-23 01:00 -------
(In reply to comment #27)

> 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.

Ah right. I did forget that this cleanup was already done. I can confirm this 
is not a bottleneck on the mainline anymore.

BTW, preliminar testing of my patch to process_init_constructor is *very* 
promising: on the mainline, compared to comment #16, we now save an additional 
100MB of RAM. We can compile the quarter of the testcase with 120MB of RAM (and 
GCC 2.95 uses 175MB)!



>>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? 

> 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.  

It turned out I was wrong, and we don't need to do this on mainline.

> 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); }

Yes, but the problem is that also default promotions are very common:

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

and this is what we need to short-circuit for the testcase to start saving 
memory. I tried something like:

  if (INTEGRAL_TYPE_P (to) && INTEGRAL_TYPE_P (from)
      && same_type_p (type_promotes_to (to), type_promotes_to (from)))
      return ocp_convert (to, expr, CONV_IMPLICIT, flags);

but I'm not sure about those type_promotes_to, plus it segfaults for some 
reason I'm investigating...



-- 


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]