mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while more accurately encoding important information about nested generic contexts with same-type and layout constraints that need to be evaluated at runtime. It's also designed with an eye to forward- and backward-compatible expansion for ABI stability with future Swift versions.
This commit is contained in:
@@ -67,8 +67,12 @@ swift_reflection_readIsaMask(SwiftReflectionContextRef ContextRef,
|
||||
uintptr_t *outIsaMask) {
|
||||
auto Context = reinterpret_cast<NativeReflectionContext *>(ContextRef);
|
||||
auto isaMask = Context->readIsaMask();
|
||||
*outIsaMask = isaMask.second;
|
||||
return isaMask.first;
|
||||
if (isaMask) {
|
||||
*outIsaMask = *isaMask;
|
||||
return true;
|
||||
}
|
||||
*outIsaMask = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
swift_typeref_t
|
||||
@@ -84,9 +88,9 @@ swift_reflection_typeRefForInstance(SwiftReflectionContextRef ContextRef,
|
||||
uintptr_t Object) {
|
||||
auto Context = reinterpret_cast<NativeReflectionContext *>(ContextRef);
|
||||
auto MetadataAddress = Context->readMetadataFromInstance(Object);
|
||||
if (!MetadataAddress.first)
|
||||
if (!MetadataAddress)
|
||||
return 0;
|
||||
auto TR = Context->readTypeFromMetadata(MetadataAddress.second);
|
||||
auto TR = Context->readTypeFromMetadata(*MetadataAddress);
|
||||
return reinterpret_cast<swift_typeref_t>(TR);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user