Strange behaviour in C++...
Joe Buck
jbuck@synopsys.COM
Wed Aug 25 17:42:00 GMT 1999
David Edelsohn writes:
> Thunks are bad on most any advanced architecture because it
> involves branches to branches with almost no computation, so instruction
> pre-fetch never catches up.
Yes, I understand this. However, C++ programmers very rarely use multiple
inheritance (because it isn't that well designed in the language and
generally more trouble than it is worth). Let's say that the
penalty for a thunk is 20-30 cycles. It would still be better than the
alternative, because without thunks you must pay, on every virtual
function table, for the possibility that multiple inheritance is involved,
and the offset that is added is zero in almost all cases (including
many of the MI cases).
The other thing that may be missed is that a single cache miss would be
more expensive in most cases than this loss of instruction pre-fetch.
More information about the Gcc
mailing list