This is a bit of longshot because I'm sure not a lot of people know the
major details of this, but I was wondering if anyone out there might be able
to help me in my understanding of interface maps in the runtime.
I'm learning about how classes get loaded into memory in the runtime,
specifically how the EEClass and its associated MethodTable structures get
built at runtime via the analysis of metadata by the ClassLoader. I was
going along pretty nicely until I stumbled across the insanity that is the
Interface Map, and how its used. I'm not sure if I'm being particulary
stupid with this, or if the documentation is poor, if it's just incredibly
complex, but I have the following questions -
1) Per Application Domain there exists a single Interface Map, yes?
2) Every interface type that is loaded into the application domain gets
an entry in this Interface Map, right?
3) When an EEClass is being built by the ClassLoader, the corresponding
MethodTable has a VTABLE slot at its tail end that is arranged in such a
manner that Inherited Virtuals, Introduced Virtuals and Instance and Static
Methods are neatly arranged for easier lookup.
==Warning, this is where my understanding breaks down ==
4) The ClassLoader, after having loaded all of the types of the
interfaces into an array before calling the BuildMethodTable function of
EEClass, uses this information, along with the address of the single
Interface Map in the application domain, to locate the entry for each and
every Interface Type in the Interface Map that is being implemented in
current class being loaded.
5) Each entry in the Interface Map is a structure that contains a
pointer to the Interface type's MethodTable and the offset for the interface
functions for that type. And then with the knowledge of the number of
functions and their layout in the Interface type, the functions are laid out
by the ClassLoader in the same order within the type's VTABLE as the
Interface type's VTABLE.
6) Calls to methods are then realized through the newly constructed
type's VTABLE, the JIT compilation takes place and so forth....
I know that the ClassLoader has to somehow use this information to map
out what functions are placed where in the VTABLE slots in its MethodTable,
but I'm not sure how this is done. The exact details are a bit confusing to
me and I wondered if anyone could let me know exactly how the VTABLE slots
and the Inteface Map interact, and if my assumptions here are correct.
So many pieces to keep track of!
Thanks,
Ben
Fabian Schmied - 23 Nov 2003 13:06 GMT
> This is a bit of longshot because I'm sure not a lot of people know the
> major details of this, but I was wondering if anyone out there might be able
> to help me in my understanding of interface maps in the runtime.
I cannot answer your questions, but if you don't get any answers on this
group, I would you to ask at the DOTNET-ROTOR discussion group at
discuss.develop.com, some of the people there can probably answer your
questions.
Fabian