@@ -119,27 +119,14 @@ void _destroy_temporary_continuation(YieldOnceBuffer *buffer, bool forUnwind) {
119
119
YieldOnceTemporary::destroyAndDeallocateIn (buffer);
120
120
}
121
121
122
- // The resilient offset to the start of KeyPath's class-specific data.
123
- extern " C" size_t MANGLE_SYM (s7KeyPathCMo);
124
-
125
122
YieldOnceResult<const OpaqueValue*>
126
123
swift::swift_readAtKeyPath (YieldOnceBuffer *buffer,
127
124
const OpaqueValue *root, void *keyPath) {
128
125
// The Value type parameter is passed in the class of the key path object.
129
126
// KeyPath is a native class, so we can just load its metadata directly
130
127
// even on ObjC-interop targets.
131
128
const Metadata *keyPathType = static_cast <HeapObject*>(keyPath)->metadata ;
132
-
133
- // To find the generic arguments, we just have to find the class-specific
134
- // data section of the class; the generic arguments are always at the start
135
- // of that.
136
- //
137
- // We use the resilient access pattern because it's easy; since we're within
138
- // KeyPath's resilience domain, that's not really necessary, and it would
139
- // be totally valid to hard-code an offset.
140
- auto keyPathGenericArgs =
141
- reinterpret_cast <const Metadata * const *>(
142
- reinterpret_cast <const char *>(keyPathType) + MANGLE_SYM (s7KeyPathCMo));
129
+ auto keyPathGenericArgs = keyPathType->getGenericArgs ();
143
130
const Metadata *valueTy = keyPathGenericArgs[1 ];
144
131
145
132
// Allocate the buffer.
0 commit comments