mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When an @objc @implementation class requires the use of `ClassMetadataStrategy::Update` because some of its stored properties do not have fixed sizes, we adjust the direct field offsets during class realization by emitting a custom metadata update function which calls a new entry point in the Swift runtime. That entry point adjusts field offsets like `swift_updateClassMetadata2()`, but it only assumes that the class has Objective-C metadata, not Swift metadata. This commit introduces an alternative mechanism which does the same thing without using any Swift-only metadata. It’s a rough implementation with important limitations: • We’re currently using the field offset vector, which means that field offsets are being emitted into @objc @implementation classes; these will be removed. • The new Swift runtime entry point duplicates a lot of `swift_updateClassMetadata2()`’s implementation; it will be refactored into something much smaller and more compact. • Availability bounds for this feature have not yet been implemented. Future commits in this PR will correct these issues.
33 lines
611 B
Objective-C
33 lines
611 B
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class ImplClassWithResilientStoredProperty;
|
|
|
|
@interface ImplClass : NSObject
|
|
|
|
- (instancetype)init;
|
|
|
|
@property (assign) NSInteger implProperty;
|
|
@property (assign) NSInteger defaultIntProperty;
|
|
|
|
+ (void)runTests;
|
|
+ (ImplClassWithResilientStoredProperty *)makeResilientImpl;
|
|
|
|
- (void)testSelf;
|
|
- (void)printSelfWithLabel:(int)label;
|
|
- (nonnull NSString *)someMethod;
|
|
|
|
@end
|
|
|
|
@interface ImplClassWithResilientStoredProperty : NSObject
|
|
|
|
- (void)printSelfWithLabel:(int)label;
|
|
- (void)mutate;
|
|
|
|
@end
|
|
|
|
extern void implFunc(int param);
|
|
|
|
NS_ASSUME_NONNULL_END
|