-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[metadata prespecialization] Support for classes. #30089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[metadata prespecialization] Support for classes. #30089
Conversation
@swift-ci please benchmark |
Build failed before running benchmark. |
e469b54
to
ad7b89e
Compare
@swift-ci please benchmark |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Is it surprising we didn't see improvement at -Onone like we did with the struct metadata? |
ad7b89e
to
821659b
Compare
@swift-ci please benchmark |
@airspeedswift This isn't quite done yet, but even when it is, we may need to directly refer to some specializations of generic classes to see similar performance changes. |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
232cc58
to
35a6172
Compare
cbd1d12
to
d3cfca1
Compare
@swift-ci please test |
Build failed |
Build failed |
bd8d35a
to
1f8bdd4
Compare
@swift-ci please test |
Build failed |
Build failed |
1f8bdd4
to
da6a524
Compare
@swift-ci please test |
Build failed |
71bb637
to
3cbed7b
Compare
@swift-ci please test |
3cbed7b
to
da20de1
Compare
Build failed |
Build failed |
da20de1
to
668b088
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please clean test linux platform |
Build failed |
668b088
to
a8e949c
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test macos platform |
When generic metadata for a class is requested in the same module where the class is defined, rather than a call to the generic metadata accessor or to a variant of typeForMangledNode, a call to a new accessor--a canonical specialized generic metadata accessor--is emitted. The new function is defined schematically as follows: MetadataResponse `canonical specialized metadata accessor for C<K>`(MetadataRequest request) { (void)`canonical specialized metadata accessor for superclass(C<K>)`(::Complete) (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, 1)`(::Complete) ... (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, count)`(::Complete) auto *metadata = objc_opt_self(`canonical specialized metadata for C<K>`); return {metadata, MetadataState::Complete}; } where generic_argument_class(C<K>, N) denotes the Nth generic argument which is both (1) itself a specialized generic type and is also (2) a class. These calls to the specialized metadata accessors for these related types ensure that all generic class types are registered with the Objective-C runtime. To enable these new canonical specialized generic metadata accessors, metadata for generic classes is prespecialized as needed. So are the metaclasses and the corresponding rodata. Previously, the lazy objc naming hook was registered during process execution when the first generic class metadata was instantiated. Since that instantiation may occur "before process launch" (i.e. if the generic metadata is prespecialized), the lazy naming hook is now installed at process launch.
a8e949c
to
bdef1ce
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test macos platform |
@swift-ci please test linux platform |
This breaks the Windows bots because the test case file names are far too long. The file system limits files to 260 characters. Could you please rename the files? |
@compnerd as mentioned there, let's just fix the filename, rather than reverting and recommitting. |
@nate-chandler responded there as well, but renaming definitely is better. |
When generic metadata for a class is requested in the same module where the class is defined, rather than a call to the generic metadata accessor or to a variant of
typeForMangledNode
, a call to a new accessor--a canonical specialized generic metadata accessor--is emitted.The new function is defined schematically as follows:
To enable these new canonical specialized generic metadata accessors, metadata for generic classes is prespecialized as needed. So are the metaclasses and the corresponding rodata.
Previously, the lazy objc naming hook was registered during process execution when the first generic class metadata was instantiated. Since that instantiation may occur "before process launch" (i.e. if the generic metadata is prespecialized), the lazy naming hook is now
installed at process launch.