This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: turning throw into a jump
- To: Richard Henderson <rth at redhat dot com>, Sylvain Pion <Sylvain dot Pion at sophia dot inria dot fr>, gcc at gcc dot gnu dot org
- Subject: Re: turning throw into a jump
- From: Sylvain Pion <Sylvain dot Pion at sophia dot inria dot fr>
- Date: Tue, 24 Jul 2001 09:48:14 +0200
- References: <20010723215840.A30527@zosma.inria.fr> <20010723171824.A17777@redhat.com>
On Mon, Jul 23, 2001 at 05:18:24PM -0700, Richard Henderson wrote:
> > I noticed that throw() seems slower with GCC 3.0 rather than 2.95 :(
> > I wonder if it would be possible to turn a throw() which is local inside a
> > try{} block (including after inlining) into a simple jump, which would make
> > it much faster... Maybe something else also useful would be get rid of the
> > whole exception code when the compiler can show that the code inside a try
> > block cannot throw. Is this doable ?
>
> Not only doable, but all of what you suggest is already done.
??? What I was talking about is the following program, for example, for which
I would expect f() to be optimized to an empty function like g(). Running it
with GCC 3.0 on i686-linux with -O2 or -O3 clearly shows that it is not
optimized the same. Are there special -f* options to enable these
optimizations ? What did I miss ?
void f()
{
try
{
throw int();
}
catch (int i)
{
}
}
void g()
{
}
int main()
{
for (int i=0; i<1000000 ; i++)
f();
// g();
}
--
Sylvain