[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: needless deep recursion in gt-c-decl.h
From:       Per Bothner <per () bothner ! com>
Date:       2002-07-31 0:42:00
[Download RAW message or body]

Geoff Keating wrote:
>>Date: Thu, 25 Jul 2002 16:35:19 -0700
> One problem is that to make this change:

>>@@ -50,44 +52,36 @@
>>       {
>>         unsigned int tag2 = (tree_node_structure (&((*x).generic)));
>>         if (tag2 == (TS_COMMON)) {
>>-          gt_ggc_m_tree_node ((*x).generic.common.chain);
>>           gt_ggc_m_tree_node ((*x).generic.common.type);
>>         }
>>         if (tag2 == (TS_INT_CST)) {
>>-          gt_ggc_m_tree_node ((*x).generic.int_cst.common.chain);
>>           gt_ggc_m_tree_node ((*x).generic.int_cst.common.type);
>>           gt_ggc_m_rtx_def ((*x).generic.int_cst.rtl);
>>         }
> ...
> 
> would require teaching gengtype that common.chain is the same as
> int_cst.common.chain and so on.

An alternative: Annotate the chain fields with GTY((chain)) or somesuch.
This tells gengtype that this is the field that it should iterate on,
rather than recurse.  Then just generate in each branch code that
sets x to whater fields has the chain annotation and does a continue.
If there is no field with the 'chain' annotation, return.

This is more general, since it doesn't special-vase 'chain' - though the
resulting code is needlessly less compact.

> Do you know what the actual stack limits are on Darwin?

512k is the default size.  You can increase the stack limit, but I
really think 512k should be more than enough, and I think it would be,
if we made this fix.

> I now have an
> instrumented GCC that reports the maximum recursion, but each stack
> frame is small (I would expect 32 bytes on powerpc) so you can fit an
> awful lot of them in a few MB of stack.

If you use a few Mb of stack space, you're increasing the working
set by a few MB.  We should avoid that.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic