For some reason I was not on this list;
So in response to your query about CF’s usage of CFGetRetainCount - I think we can safely forbid that function in the swift version since there is no safe way to use it (even CFMachPort is a bit dodgy for it’s usage).
It might take some surgery but I can probably excise that fairly simply.
···
On Dec 22, 2015, at 1:08 PM, Joe Groff via swift-dev <swift-dev at swift.org <https://lists.swift.org/mailman/listinfo/swift-dev>> wrote:
It looks like the corelibs implementation of CoreFoundation references swift_retainCount in order to implement CFGetRetainCount. Is getting the retain count necessary to CF functionality, or can these functions be removed?
Joe_Groff
(Joe Groff)
2
That'd be awesome. Thanks Philippe! For CFMachPort's usage, since it's checking for a retainCount of 1, maybe we could use swift_isUniquelyReferenced* instead, which we do need to reliably support for COW.
-Joe
···
On Dec 25, 2015, at 9:02 PM, Philippe Hausler <phausler@apple.com> wrote:
> On Dec 22, 2015, at 1:08 PM, Joe Groff via swift-dev <swift-dev at swift.org <https://lists.swift.org/mailman/listinfo/swift-dev>> wrote:
>
> It looks like the corelibs implementation of CoreFoundation references swift_retainCount in order to implement CFGetRetainCount. Is getting the retain count necessary to CF functionality, or can these functions be removed?
For some reason I was not on this list;
So in response to your query about CF’s usage of CFGetRetainCount - I think we can safely forbid that function in the swift version since there is no safe way to use it (even CFMachPort is a bit dodgy for it’s usage).
It might take some surgery but I can probably excise that fairly simply.
Actually the method that was being used there is not even compiled on mac targets, I was able to safely excise the usage and disallow the function in the Swift version of CF.
I pushed this:
Which should no longer swift_retainCount in swift-corelibs-foundation builds anymore.
···
On Dec 26, 2015, at 12:31 PM, Joe Groff <jgroff@apple.com> wrote:
On Dec 25, 2015, at 9:02 PM, Philippe Hausler <phausler@apple.com <mailto:phausler@apple.com>> wrote:
> On Dec 22, 2015, at 1:08 PM, Joe Groff via swift-dev <swift-dev at swift.org <https://lists.swift.org/mailman/listinfo/swift-dev>> wrote:
>
> It looks like the corelibs implementation of CoreFoundation references swift_retainCount in order to implement CFGetRetainCount. Is getting the retain count necessary to CF functionality, or can these functions be removed?
For some reason I was not on this list;
So in response to your query about CF’s usage of CFGetRetainCount - I think we can safely forbid that function in the swift version since there is no safe way to use it (even CFMachPort is a bit dodgy for it’s usage).
It might take some surgery but I can probably excise that fairly simply.
That'd be awesome. Thanks Philippe! For CFMachPort's usage, since it's checking for a retainCount of 1, maybe we could use swift_isUniquelyReferenced* instead, which we do need to reliably support for COW.
-Joe
Joe_Groff
(Joe Groff)
4
Nice, thanks again Philippe!
-Joe
···
On Dec 26, 2015, at 12:52 PM, Philippe Hausler <phausler@apple.com> wrote:
On Dec 26, 2015, at 12:31 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:
On Dec 25, 2015, at 9:02 PM, Philippe Hausler <phausler@apple.com <mailto:phausler@apple.com>> wrote:
> On Dec 22, 2015, at 1:08 PM, Joe Groff via swift-dev <swift-dev at swift.org <https://lists.swift.org/mailman/listinfo/swift-dev>> wrote:
>
> It looks like the corelibs implementation of CoreFoundation references swift_retainCount in order to implement CFGetRetainCount. Is getting the retain count necessary to CF functionality, or can these functions be removed?
For some reason I was not on this list;
So in response to your query about CF’s usage of CFGetRetainCount - I think we can safely forbid that function in the swift version since there is no safe way to use it (even CFMachPort is a bit dodgy for it’s usage).
It might take some surgery but I can probably excise that fairly simply.
That'd be awesome. Thanks Philippe! For CFMachPort's usage, since it's checking for a retainCount of 1, maybe we could use swift_isUniquelyReferenced* instead, which we do need to reliably support for COW.
-Joe
Actually the method that was being used there is not even compiled on mac targets, I was able to safely excise the usage and disallow the function in the Swift version of CF.
I pushed this:
CFGetRetainCount should not be available in the swift version of CF/F… · apple/swift-corelibs-foundation@d430c06 · GitHub
Which should no longer swift_retainCount in swift-corelibs-foundation builds anymore.