This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: handling setjmp/longjmp in new front-end


> Which is likely to be more efficient, __builtin_{setjmp,longjmp} or
> exception handling?

Yeesh.  Hard to say.  Surely it will depend on how many call-saved
registers the target has.  For ia32, it's fairly certain that
__builtin_setjmp will be faster.  For ia64, perhaps the other
way around.  You'd have to experiment.

Another factor perhaps to consider, depending on the nature of the
code you generate, is that exception handling will likely give you
more accurate CFGs.  This because exception handlers have known
structure, whereas there's no description of where a jmpbuf goes
out of scope.

Actually, it ought to be possible to get the best of both worlds here:
Assuming that you have a single "catch" type, that is, a "throw"
is always caught by the inner-most nested "handler", you should
be able to resolve a throw/catch pair within a function to a
simple goto.  Between functions, we ought to be able to use the
current exception handling markup to describe control flow even
if you're not doing "real" exception handling.  Something to fool
with once you're far enough along...



r~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]