[swift-dev] Having 64-bit swift_retain/release ignore all negative pointer values

Greg Parker gparker at apple.com
Tue Mar 1 17:05:05 CST 2016


> On Mar 1, 2016, at 1:33 PM, Joe Groff via swift-dev <swift-dev at swift.org> wrote:
> 
> In swift_retain/release, we have an early-exit check to pass through a nil pointer. Since we're already burning branch, I'm thinking we could pass through not only zero but negative pointer values too on 64-bit systems, since negative pointers are never valid userspace pointers on our 64-bit targets. This would give us room for tagged-pointer-like optimizations, for instance to avoid allocations for tiny closure contexts.

We can't do that unless we can get a guarantee from the OS folks that a "negative" pointer will never be a valid userspace pointer in any future OS version.


-- 
Greg Parker     gparker at apple.com     Runtime Wrangler




More information about the swift-dev mailing list