IRGen/Runtime: Mark indirect cases in an enum's field type infos.

And use this information in EnumMirror to project boxed payloads when we encounter them.

Swift SVN r29866
This commit is contained in:
Joe Groff
2015-07-02 00:00:42 +00:00
parent 59b6dff24e
commit a9e69dda79
9 changed files with 211 additions and 33 deletions

View File

@@ -259,6 +259,11 @@ void swift::swift_deallocBox(HeapObject *o) {
}
OpaqueValue *swift::swift_projectBox(HeapObject *o) {
// The compiler will use a nil reference as a way to avoid allocating memory
// for boxes of empty type. The address of an empty value is always undefined,
// so we can just return nil back in this case.
if (!o)
return reinterpret_cast<OpaqueValue*>(o);
auto metadata = static_cast<const GenericBoxHeapMetadata *>(o->metadata);
return metadata->project(o);
}