Thunks, vol. XXII

Martin von Loewis loewis at informatik.hu-berlin.de
Wed Sep 1 16:49:29 UTC 1999


> It gets complicated, because you need different variants
> if there are more than 3 adjustments, or if any of them
> don't fit into 14 bits, but a moderately parallel
> implementation handle a lot of common nonvirtual
> cases with only one extra cycle, wouldn't it?

For the non-virtual case, there is also another non-branching variant:

struct A{virtual void f();};
struct B:A{members};
struct C:A{members};
struct D:X,B,C{void f();};

With thunks preceding D::f, we need three entries: D::f, D::B::f
(adjust by, say, -16), and D::C::f (adjust by -28):

D::C::f:  this -= 12 ; fall through
D::B::f:  this -= 16 ; fall through
D::f:     start code

If branching is really that expensive, such accumulation of adjustment
might be cheaper, no?

Regards,
Martin




More information about the cxx-abi-dev mailing list