Re: handling exceptions

Laurent Guerby <guerby@acm.org>
29 Oct 1999 02:36:03 -0400

          From comp.compilers

Related articles
handling exceptions m.w.m.pennings@twi.tudelft.nl (Maikel Pennings) (1999-10-27)
Re: handling exceptions jjones@cs.uiuc.edu (1999-10-28)
Re: handling exceptions chstapfer@bluewin.ch (Christian Stapfer) (1999-10-28)
Re: handling exceptions andi@complang.tuwien.ac.at (1999-10-29)
Re: handling exceptions Gautier.deMontmollin@maths.unine.ch (Gautier) (1999-10-29)
Re: handling exceptions guerby@acm.org (Laurent Guerby) (1999-10-29)
Re: handling exceptions mslamm@mscc.huji.ac.il (Ehud Lamm) (1999-10-31)
| List of all articles for this month |
From: Laurent Guerby <guerby@acm.org>
Newsgroups: comp.compilers
Date: 29 Oct 1999 02:36:03 -0400
Organization: Club-Internet (France)
References: 99-10-127
Keywords: errors

Maikel Pennings <m.w.m.pennings@twi.tudelft.nl> writes:
> Does anyone know how a compiler (e.g. ada95 compiler) handles
> exceptions. I have to add exception handling to a compiler for a
> project, and I'm wondering how this is done in real compilers


Well you can always grab the latest source release of the GNAT, the
GNU Ada 95 compiler and look at the comments (the exception stuff is
heavily commented both in the front-end and in the run-time).


<ftp://ftp.cs.nyu.edu/pub/gnat/gnat-3.12p-src.tar.gz>


Right now, AFAIK, GNAT offers two mechanisms for handling exceptions,
one based on setjmp/longjmp, which is very portable but induces
run-time overhead when entering scopes with exception handlers, and a
new one, the so-called "zero-cost exception scheme", which has no
run-time overhead when entering scopes with exception handlers and use
code-tables to know what to do when an exception is raised, and
usually needs some platform specific code (it is nicely abstracted
though, see the code for the Ada.Exceptions package).


If you want to study high-level to low-level code transformation, GNAT
is very interesting since it has a flag (-gnatdg) that shows the
"low-level" Ada code when the front-end expander has done its job, so
you can see how "high-level" constructs are broken down into run-time
calls. (One of the latest gizmo with 3.12 is that you can set a flag
to be able to debug into the generated low-level Ada code instead of
the original programmer-written one ;-).


If you want more help, you can subscribe to the GNAT chat mailing-list
and ask questions there, GNAT knowledgeable people are looking there.


<http://www.gnat.com> for subscription information.


--LG


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.