This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining vs the stack
> >>>>> "Mike" == Mike Stump <mrs@apple.com> writes:
>
> Mike> On Aug 12, 2005, at 10:39 AM, Dale Johannesen wrote:
> >> We had a situation come up here where things are like this
> >> (simplified, obviously):
> >>
> >> c() { char x[1000000]; }
>
> Mike> I think we should turn off inlining for functions > 100k stack
> Mike> size. (Or maybe 500k, if you want).
>
> Why should stack size be a consideration? Code size I understand, but
> stack size doesn't seem to matter.
The problem is that the function you inline into starts consuming a lot
of stack space even when it didn't previously. This showed up in the
past in glibc where inlining some subfunction of printf caused printf to
kill some threading library testsuite tests and linux kernel.
Unforutnately the actual size we want to limit is somewhat variable (for
kernel it is pretty small, in usual case few hounderd K is probably good
choice). So I guess we can add command line flag for this. Other
problem is how to realistically estimate stack consumption in current
tree representation, but perhaps just summing size of all temporaries
would work....
Honza
>
> paul
>