We were computing these as the minimum object size. This number is meaningless because they don't get allocated on the GC heap. A zero compresses better. Surprisingly saves like 0.1% on Hello World despite being such an insignificant thing.
int pointerSize = _type.Context.Target.PointerSize;
int objectSize;
- if (_type.IsDefType)
+ if (_type.IsInterface)
+ {
+ // Interfaces don't live on the GC heap. Don't bother computing a number.
+ // Zero compresses better than any useless number we would come up with.
+ return 0;
+ }
+ else if (_type.IsDefType)
{
LayoutInt instanceByteCount = ((DefType)_type).InstanceByteCount;