@@ -119,27 +119,14 @@ void _destroy_temporary_continuation(YieldOnceBuffer *buffer, bool forUnwind) {
119119 YieldOnceTemporary::destroyAndDeallocateIn (buffer);
120120}
121121
122- // The resilient offset to the start of KeyPath's class-specific data.
123- extern " C" size_t MANGLE_SYM (s7KeyPathCMo);
124-
125122YieldOnceResult<const OpaqueValue*>
126123swift::swift_readAtKeyPath (YieldOnceBuffer *buffer,
127124 const OpaqueValue *root, void *keyPath) {
128125 // The Value type parameter is passed in the class of the key path object.
129126 // KeyPath is a native class, so we can just load its metadata directly
130127 // even on ObjC-interop targets.
131128 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 ();
143130 const Metadata *valueTy = keyPathGenericArgs[1 ];
144131
145132 // Allocate the buffer.
0 commit comments