Runtime: Generalize TypeMetadataRecords to non-type contexts.

We could introduce non-nominal-type context descriptors, such as those for opaque declarations,
which are also interesting to be able to look up for reflection or remote purposes. This should be
a backward compatible change with old runtimes, which always ignore any context descriptor kind
they don't know about.
This commit is contained in:
Joe Groff
2019-04-29 11:30:11 -07:00
parent d044696b30
commit 9c6bc9ccd7
2 changed files with 21 additions and 20 deletions

View File

@@ -457,6 +457,7 @@ template <typename Runtime> struct TargetStructMetadata;
template <typename Runtime> struct TargetOpaqueMetadata;
template <typename Runtime> struct TargetValueMetadata;
template <typename Runtime> struct TargetForeignClassMetadata;
template <typename Runtime> struct TargetContextDescriptor;
template <typename Runtime> class TargetTypeContextDescriptor;
template <typename Runtime> class TargetClassDescriptor;
template <typename Runtime> class TargetValueTypeDescriptor;
@@ -2085,12 +2086,12 @@ struct TargetTypeMetadataRecord {
private:
union {
/// A direct reference to a nominal type descriptor.
RelativeDirectPointerIntPair<TargetTypeContextDescriptor<Runtime>,
RelativeDirectPointerIntPair<TargetContextDescriptor<Runtime>,
TypeReferenceKind>
DirectNominalTypeDescriptor;
/// An indirect reference to a nominal type descriptor.
RelativeDirectPointerIntPair<TargetTypeContextDescriptor<Runtime> * const,
RelativeDirectPointerIntPair<TargetContextDescriptor<Runtime> * const,
TypeReferenceKind>
IndirectNominalTypeDescriptor;
@@ -2103,8 +2104,8 @@ public:
return DirectNominalTypeDescriptor.getInt();
}
const TargetTypeContextDescriptor<Runtime> *
getTypeContextDescriptor() const {
const TargetContextDescriptor<Runtime> *
getContextDescriptor() const {
switch (getTypeKind()) {
case TypeReferenceKind::DirectTypeDescriptor:
return DirectNominalTypeDescriptor.getPointer();