I am sorry, there's a lot of Swift reflection questions I have here. Feel free to only answer a subset. Thank you in advance for your help.
-
Looking at the Swift C++ APIs for reflection on Swift structs descriptors, I am having a hard time seeing if it's possible to find a way to access a
StructDescriptor
's methods (read: just methods, not ivars) via the C++ reflection APIs in__swift_reflection_version
3Just for reference, going after a
ClassDescriptor
's methods have been very straightforward as I'll usegetMethodDescriptors
found here: swift/Metadata.h at 6295cecfa77ac4f10a5569930bba26d1934972ff · apple/swift · GitHub I don't see a clear way to do the equivalent for aStructDescriptor
-
Can you explain the use of
FieldOffsetVectorOffset
inStructDescriptor
? I am having a hard time understanding it and how to practically apply it via the C++ APIs. I am aware ofTrailingGenericContextObjects
, but don't know ifFieldOffsetVectorOffset
applies to this or not or how it's used. -
swift/TypeMetadata.rst at main · apple/swift · GitHub has the following statement: "The value witness table pointer is at offset -1 from the metadata pointer, that is, the pointer-sized word immediately before the pointer's referenced address."
How to I programmatically obtain the "value witness table" if I have a reference to a
StructDescriptor*?
. I thought theFields.get()
route might be the way to do it, but I am second guessing myself now... -
What's the point to the Mach-O section __swift5_typeref? I totally understand the
__swift5_types
, which I'd say equates to Objective-C's__DATA.__objc_classlist
, but I don't get the purpose to__swift5_typeref
, which seems like it's already taken care of by__swift5_types
. I know there's more data packed into a__swift5_typeref
index (6 bytes on 64bit) vs __swift5_types 4 bytes, but can't deduce the use of those extra 2 bytes.
Thank you. Sorry again for the question count. Y'all are awesome