Boost logo

Boost :

From: Iain K. Hanson (ikh_at_[hidden])
Date: 2003-09-07 14:37:25


[snip]

> What does "active instructions" mean?

My term. Not general jargon. I mean instructions that require clock cycles to
excute. Data declarations in assembler simply name a region of memory
that a program wants to use and do not require any clock cycles.

> Are these instructions executed
> when no exception is thrown?

Some of them, almost certainly but I suspect the majority would not be. I
would need to do a lot more analysis and testing before I could answer
definatively. It would be nice to here from some of the compiler writers
who could answer this much more easily.

>Are these instructions generated even
> when the class is not used as an exception?

Not sure what you are trying to get at here? I suspect that some of it is
generic to an MI class and some of it specific to exceptions.

> Are they in functions
> which are linked away unless used?

I don't know enough about linker technology to be sure of this. If a symbol is
not referenced then it should not be linked. But is an exception specification
sufficent to require linking even if the exception is never thrown? I don't
know. Code will also be generated by declaring the try/catch blocks. I would
have to do the detailed analysis to find out how much additionls code is
specific to declaring an MI exception.

> Are the functions used by
> exception hanlding, RTTI, or something else?

I don't know. Would require detailed analysis.

>
> > I have no idea without doing a full analysis what proportion of the
> > instructions actually execute and what are just code bloat.
> >
> > Which ever way you cut it, virtually inheriting from std::exception
> > has a real cost to support an outside case of using MI for
> > exceptions.
>
> I'm open to the idea that MI should be banned in exception hierarchies
> as an alternative to using virtual inheritance. I don't think
> non-virtual multiple inheritance can be justified, though.

Ouch! Lets not throw the baby out with the bath water. ( if you'll excuse
the pun :-). ). I'm very definately *not* anti MI. I find the netfile_err
example a very natural and intuitive use of MI. What I am unsure of is
the recommendation that we should always virtualy inherit from std::exception.

Which leads me to the realisation that I have been testing the wrong thing.
I should have been testing virtual versus non-virtual SI and not SI versus
MI.

I'll do some more tests tomorrow and post preliminary results but to answer
definatively and in detail would require a large amount of work on my
part and would be specific to a particular version of gcc and a specific
optimisation level.

What I would really like is to here from some of the compiler writers that
lurk here and preferably several so that we could understand the general cost
of virtual inheritance when there is only SI and in the context of exceptions.

Is there any way you could prod some of them?

/ikh


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk