Related articles |
---|
Implementation of C++ exceptions ? mmc@wagner.imada.ou.dk (1994-04-05) |
Re: Implementation of C++ exceptions ? vinoski@srv.ch.apollo.hp.com (Steve Vinoski) (1994-04-05) |
Re: Implementation of C++ exceptions ? mw@ipx2.rz.uni-mannheim.de (1994-04-05) |
Re: Implementation of C++ exceptions ? chase@Think.COM (1994-04-05) |
Re: Implementation of C++ exceptions ? schmidt@tango.ICS.UCI.EDU (Douglas C. Schmidt) (1994-04-06) |
Re: Implementation of C++ exceptions ? mmc@wagner.imada.ou.dk (1994-04-07) |
Implementation of C++ exceptions ? ssimmons@convex.com (1994-04-08) |
Re: Implementation of C++ exceptions ? davis@ilog.ilog.fr (1994-04-11) |
Re: Implementation of C++ exceptions ? chase@Think.COM (1994-04-11) |
Re: Implementation of C++ exceptions ? sean@PICARD.TAMU.EDU (1994-04-12) |
Newsgroups: | comp.compilers |
From: | ssimmons@convex.com (Steve Simmons) |
Keywords: | C++, design |
Organization: | CONVEX News Network, Engineering (cnn.eng), Richardson, Tx USA |
References: | 94-04-019 94-04-026 |
Date: | Fri, 8 Apr 1994 13:14:57 GMT |
> Unfortunately I have not yet had the pleasure of trying SunPro C++ 4.0,
> but in IBM PC C++ compilers as Borland C++ and Watcom exceptions means a
> lot of overhead including calls of init_except_block / exit_except_black
> functions for each C++ function compiled with exceptions enabled etc.
>
> This clearly does not compute with statements from Bjarne S. and others
> that exceptions should introduce no/very little overhead in a normal
> running program (as long as no exceptions are thrown)!
OK... I am going to take a couple of WAGs. First, exception handlers are
defined to be active over a region of code (like PC=100 to PC=200). When
an exception is raised within that region or code called within that
region, the exception handler must be invoked....
In order to do this, a global runtime exception handler must exist do this
resolution. When an exception is raised, this handler gets called with
the PC of the exception. The runtime exception handler must then see what
regions contain this PC and execute the respective exception handler for
that region. It must also walk the stack backwards and find all of the
return addresses and perform a similar arbitration. That is why you had
the PC-exception handling table as David Chase described. It looks kinda
like this...
Beginning Address
End Address
Address of Exception Handler to execute.
>From what you are saying, it appears that those compilers do not use a PC.
It may be that they define their regions with a runtime call marking the
beginning and the end of the respective region. If this is so, Bjarne
Stroustrop would cringe because this is a very expensive implementation of
exceptions. However, they may be exception handling restrictions within
MS-DOS that force these restrictions like an undefined call frame
definition or an poor OS exception handling mechanism.
The only real bad costs for exception handling is that you cannot do many
global/loop/interprocedural optimizations across the boundary of an
exception region. Usually, that is not a big loss...
Thank you.
Steve Simmons
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.