Add vtable for structures.

Instead of storing the destructor-pointer, outgoing reference count and
query function directly in every structure of a particular type, store
them as a "vtable" in some static data section of the program and store
just the vtable pointer in each structure.

This is nice on its own (saves a couple of words in each structure), but
also is necessary ground-work for interfaces which will require this
static data setup.