comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@brighton.ac.uk>
Subject: Re: Ada and embedded applications
Date: Tue, 05 Jun 2001 15:24:34 +0100
Date: 2001-06-05T14:30:36+00:00	[thread overview]
Message-ID: <3B1CEBA2.E868929D@brighton.ac.uk> (raw)
In-Reply-To: 3b1c8cb0$1@pull.gecm.com

Martin Dowie wrote:
> A few compilers I've come across offer 'zero cost' exception handling. By
> this
> they mean that it will have no affect on %CPU usage if there are no
> exceptions.
> The price you pay for that tends to be *slightly* slower exception handling
> if/
> when it does happen.

Hmm, the "obvious" way to handle exceptions involves one extra word
in the stack frame (a pointer to the start of the exception handling
code) which costs (typically) 4 bytes per handled block and 1 extra
word to pop on exit, which may or may not cost nothing, but is certainly
pretty cheap. For example, i386 processors have POPA/POPAD (pop all)
instructions, 680x0 have MOVEM (move multiple registers) where the
cost of an extra register is an extra memory cycle, and Vaxen of
fond memory had a word for the exception handler as a standard part
of the stack frame created by CALL.

Detecting exceptions can be more expensive -- e.g. on a processor that
doesn't generate an exception on arithmetic overflow, checking for
constraint errors can add quite a bit to the overall code cost.

The other complication is controlled types and the sequence of object
destruction that block exit can entail.

Does anyone have any references to alternative ways of implementing
exception handling?

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.comp.it.bton.ac.uk/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



  reply	other threads:[~2001-06-05 14:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 18:59 Ada and embedded applications Chris Campbell
2001-06-04 19:34 ` Marin David Condic
2001-06-04 21:12   ` Chris Campbell
2001-06-04 21:33     ` Matthew Woodcraft
2001-06-04 21:33     ` Ted Dennison
2001-06-04 22:33       ` Chris Campbell
2001-06-05  7:55         ` Chris Campbell
2001-06-05 15:03           ` Ted Dennison
2001-06-04 22:09     ` Marin David Condic
2001-06-05  2:18       ` tmoran
2001-06-05 13:38         ` Marin David Condic
2001-06-06  4:09           ` Jeffrey Carter
2001-06-05 18:23         ` Randy Brukardt
2001-06-05 18:25         ` Randy Brukardt
2001-06-05 20:18           ` Marin David Condic
2001-06-05  7:45     ` Martin Dowie
2001-06-05 13:49       ` Marin David Condic
2001-06-05 20:47         ` Martin Dowie
2001-06-05 10:15     ` Rod Chapman
2001-06-04 21:02 ` Larry Kilgallen
2001-06-04 20:06   ` Ehud Lamm
2001-06-04 21:18     ` Ted Dennison
2001-06-05 12:35     ` Marc A. Criley
2001-06-05 19:00       ` Pascal Obry
2001-06-04 21:15 ` Robert A Duff
2001-06-04 21:30   ` Chris Campbell
2001-06-05  2:06     ` Jeffrey Carter
2001-06-05 14:04     ` Marin David Condic
2001-06-05  7:50 ` Martin Dowie
2001-06-05 14:24   ` John English [this message]
2001-06-08 23:55     ` Robert A Duff
2001-06-09 12:47       ` Ehud Lamm
2001-06-14 16:27       ` Pat Rogers
2001-06-06  2:31 ` Ken Garlington
2001-06-06 11:14   ` Chris Campbell
2001-06-06 15:47     ` Marin David Condic
2001-06-06 17:57     ` Jerry van Dijk
2001-06-06 22:32       ` Chris Campbell
2001-06-06 22:37         ` Chris Campbell
2001-06-06 15:42   ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox