public MethodTable BuildMethodTable()
{
_halfBakedMethodTable = new MethodTable()
{
MdToken = _typeDefinition.MetadataToken,
ClassName = _typeDefinition.FullName,
ParentMethodTable = (_typeDefinition.BaseType != null) ? _classLoader.LoadTypeFromTypeRef(_typeDefinition.BaseType) : null,
EEClass = null,
Interfaces = CreateInterfacesFromTypeDef(),
MethodSlots = CreateMethodSlotsFromTypeDef(_typeDefinition),
InterfaceMethodSlotMap = _typeDefinition.HasInterfaces ? new Dictionary<MethodReference, int>() : null,
};
_halfBakedMethodTable.EEClass = new EEClass()
{
ParentMethodTable = ParentMethodTable,
};
if (_typeDefinition.HasInterfaces)
{
CreateInterfaceVtableMap();
}
// Go thru all fields and initialize their FieldDescs.
InitializeFieldDescs();
// Place regular static fields
PlaceRegularStaticFields();
// Place thread static fields
PlaceThreadStaticFields();
// Create static field slots
_halfBakedMethodTable.StaticFields = new ObjectInstance[HalfBakedClass.NumStaticFields + HalfBakedClass.NumThreadStaticFields];
for (var i = 0; i < _halfBakedMethodTable.StaticFields.Length; i++)
{
_halfBakedMethodTable.StaticFields[i] = ObjectInstance.Null;
}
if (false /* IsBlittable || IsManagedSequential */)
{
// TODO: not implemented yet
}
else
{
// HandleExplicitLayout fails for the GenericTypeDefinition when
// it will succeed for some particular instantiations.
// Thus we only do explicit layout for real instantiations, e.g. C<int>, not
// the open types such as the GenericTypeDefinition C<!0> or any
// of the "fake" types involving generic type variables which are
// used for reflection and verification, e.g. C<List<!0>>.
//
if (false /* !bmtGenerics->fContainsGenericVariables && HasExplicitFieldOffsetLayout */)
{
//HandleExplicitLayout(pByValueClassCache);
// TODO: not implemented yet
}
else
{
// Place instance fields
PlaceInstanceFields();
}
}
return _halfBakedMethodTable;
}