mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We cannot use field offset globals if *any* field of a generic class with Objective-C ancestry is dependent. This is because the Swift runtime first performs layout starting from a static instance start offset, and then asks the Objective-C runtime to slide the offsets based on the dynamic superclass size. So if the class has a field of generic type, the alignment of that type can change the offsets of fields *before* it as well as after. So we cannot assuem that any fields in such a class have the same offset across instantiations at all. The previous fix captured the intent of the above, but it only kicked in if the immediate superclass of the class was imported from Objective-C. But really we need to do this for any class with Objective-C ancestry. While fixing this, re-organize the code in ClassLayoutBuilder a little bit to untangle the stored property iteration from the interesting FieldAccess adjustments that take place after.
6.7 KiB
6.7 KiB