I am working on an binary code size optimization similar to this patch for clang - some TODOs have been lying in Swift's source code for years.
Now I have encountered 2 problems:
-
I have no idea how to properly encode capture for
CanSILBlockStorageType::getCaptureType
. I found that Swift-created block have identical capture currently (just a Swift closure), so I hardcoded a fixed string temporarily for the capture type. -
I found that the names of Objective-C classes and protocols are encoded in the signature of block descriptors, and clang behaves the same with
-fencode-extended-block-signature
which is enabled by default on Darwin. I am not sure about the necessity of doing so. It definitely precludes some opportunities of further merging block descriptors; also, the extended encoding itself contributes a lot in terms of binary size.