[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Change setjmp/longjmp to _setjmp/_longjmp

From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Change setjmp/longjmp to _setjmp/_longjmp to avoid overhead and fix signal masking bug
Date: Thu, 14 Jun 2012 09:16:52 +0200
User-agent: Mutt/

On Wed, Jun 13, 2012 at 08:34:14PM -0500, Jim Ursetto wrote:
> There won't be any improvement on Linux because _setjmp == setjmp;


> Linux doesn't save the signal mask on setjmp() unless the obscure __FAVOR_BSD
> is #defined.  The performance regression you observed could just be
> statistical noise as well -- but, sometimes gcc will inline known calls
> and it might do that for setjmp and not _setjmp, even though setjmp is
> just a macro alias for _setjmp.  Only way to be sure is to look at the
> assembly output.

If that's the case, perhaps using sigsetjmp instead might help.
Doing this would require us to use sigjmp_buf instead of jmp_buf at
all the call sites.  If it makes a big enough difference, maybe this
calls for a C_jmp_buf definition so that we can use sigjmp_buf on
systems that have sigsetjmp and jmp_buf on systems that don't.

Hopefully that'll be compiled more efficiently.  But it could just be
noise, like Jim said.  Tried running the tests in the opposite order?
(so with patch first, without last or vice versa)

"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]