Commits

Slava Pestov committed 95bc009e3e1
Reflection: Multi-payload enum layout The approach here is to split this into two cases: - If all case payloads have a fixed size, spare bits may be potentially used to differentiate between cases, and the remote reflection library does not have enough information to compute the layout itself. However, the total size must be fixed, so IRGen just emits a builtin type descriptor (which I need to rename to 'fixed type descriptor' since these are also used for imported value types, and now, certain enums). - If at least one case has a size that depends on a generic parameter or is a resilient type, IRGen does not know the size, but this means fancy tricks with spare bits cannot be used either. The remote reflection library uses the same approach as the runtime, basically taking the maximum of the payload size and alignment, and adding a tag byte. As with single-payload enums, we produce a new kind of RecordTypeInfo, this time with a field for every enum case. All cases start at offset zero (but of course this might change, if for example we put the enum tag before the address point). Also, just as with single-payload enums, there is no remote 'project case index' operation on ReflectionContext yet. So the the main benefit from this change is that we don't entirely give up when doing layout of class instances containing enums; however, tools still cannot look inside the enum values themselves, except in the simplest cases involving optionals. Notably, the remote reflection library finally understands all of the standard library's collection types -- Array, Character, Dictionary, Set, and String.