This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: implementing exception handlers in a front end
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Gaius Mulley" <gaius at glam dot ac dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 9 Jul 2008 16:00:47 +0200
- Subject: Re: implementing exception handlers in a front end
- References: <87wsjv2nel.fsf@j228-gm.comp.glam.ac.uk>
On Wed, Jul 9, 2008 at 3:32 PM, Gaius Mulley <gaius@glam.ac.uk> wrote:
>
> Hi,
>
> I'm currently trying to implement the exception handling in GNU
> Modula-2 and was wondering which of the following two routes to use.
> I was initially enthusiastic about using __builtin_setjmp/
> __builtin_longjmp as Modula-2 exceptions can be implemented with these
> mechanisms - and it would also be tantalisingly easy to code..
>
> However, upon searching this list I see that there are a number of
> problems with __builtin_setjmp and __builtin_longjmp and have begun
> to examine TRY_CATCH_EXPR nodes instead. It seems that if this later
> route is taken then the front end also needs to add:
>
> DEFTREECODE (THROW_EXPR, "throw", tcc_unary, 1)
>
> to its language tree.def and gimplify this. Before I embark on this
> I'd like to ask whether using __builtin_longjmp/__builtin_setjmp is
> definitely the wrong way to go?
Definitely. You will be not able to handle/throw exceptions from other
languages if the target ABI doesn't use sjlj exceptions (which only
a few use).
Richard.