This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reducing the size of C++ executables - eliminating malloc


On Sunday 12 November 2006 22:46, Michael Eager wrote:
> Mark Mitchell wrote:
> > Michael Eager wrote:
> >> Why should the personality routine be included in all C++ programs?
> >
> > Because all non-trivial, exceptions-enabled programs, may need to do
> > stack unwinding.
>
> It would seem that the place to require the personality
> routine would be in the routine which causes the stack
> unwinding, not in every C++ object file, whether needed
> or not.

The problem is that the places that knows we're using exceptions don't know 
how to do the stack unwinding, or what we're unwinding through. Only the code 
being unwound knows how to do the unwinding. 

The frame unwind information contains a function pointer that is called to 
interpret the rest of the frame data. eg. C, C++ and Java all have different 
exception table formats, and different personality routines to interpret 
those tables. The code that calls throw(), and the implementation of thow() 
don't know which of these routines are needed.

The code being unwound through (ie. with frame data) needs to be able to 
say "I need routine X if __Unwind_Raise is used anywhere in this program".
I'm not aware of any way of doing this, other than trying it and starting 
again if you guessed wrong.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]