From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac55ec18f7b0a53c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-05 08:11:29 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!dispose.news.demon.net!demon!colt.net!newspeer.highwayone.net!newspeer.clara.net!news.clara.net!server3.netnews.ja.net!newshost.central.susx.ac.uk!news.bton.ac.uk!not-for-mail From: John English Newsgroups: comp.lang.ada Subject: Re: Ada and embedded applications Date: Tue, 05 Jun 2001 15:24:34 +0100 Organization: University of Brighton Message-ID: <3B1CEBA2.E868929D@brighton.ac.uk> References: <3b1c8cb0$1@pull.gecm.com> NNTP-Posting-Host: pc2je.it.bton.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: saturn.bton.ac.uk 991751436 19253 193.62.183.154 (5 Jun 2001 14:30:36 GMT) X-Complaints-To: news@bton.ac.uk NNTP-Posting-Date: 5 Jun 2001 14:30:36 GMT X-Mailer: Mozilla 4.7 [en-gb] (Win95; U) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:8170 Date: 2001-06-05T14:30:36+00:00 List-Id: 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 -----------------------------------------------------------------