This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: turning throw into a jump
On Tue, Jul 24, 2001 at 03:51:00PM -0700, Richard Henderson wrote:
> On Tue, Jul 24, 2001 at 09:48:14AM +0200, Sylvain Pion wrote:
> > void f()
> > {
> > try
> > {
> > throw int();
> > }
> > catch (int i)
> > {
> > }
> > }
>
> Oh, that. No, we can't do that -- there's more going on behind
> the scenes that it looks.
Could you explain a bit more ? Is it something that cannot be done because of
some standard requirement ? Maybe it would be nice to have an option to
optimize this case, even if not enabled by default ?
> What we do now that we didn't before was handle cleanups and
> nested regions with branches. E.g.
>
> ...
I see. That's nice.
BTW, I tried to compile (with gcc 3.1, -O3 -fomit-frame-pointer) :
void f()
{
try {}
catch (int i) {}
}
It produced :
_Z1fv:
.LFB1:
subl $12, %esp
.LCFI0:
addl $12, %esp
ret
which is not exactly optimal, and not what a really empty function gets
compiled into. Is there a way to fix this ?
--
Sylvain