Why do we emit vtables for abstract classes?

Tom Tromey tromey@redhat.com
Sun Mar 12 22:45:00 GMT 2006


>>>>> "David" == David Daney <ddaney@avtrex.com> writes:

David> I am looking at the assembly output of jc1 (recent svn trunk) and am
David> wondering why there are vtables for abstract classes.
David> There can never be an instance of an abstract class, so we should
David> never have to access its vtable.
David> Am I missing something, or is the vtable unneeded?
I have a vague memory that we changed to do this on purpose. And
there is a comment in link.cc about this... but all I can remember
right now is that we must lay out a vtable for an abstract class (so
that all the subclasses agree on the layout), not that we must
actually have the vtable available. (The layout info is available in
the 'methods' table.)
So, yeah, perhaps the vtable itself is unneeded. Maybe it is a relic
of some old form of the runtime linker. You'd need testing and
perhaps digging in the history to see, I think.
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /