Commits

Dave Abrahams committed 586ccabbb02
[stdlib] Rework String bridging Going through an @objc protocol for bridging Cocoa strings to Swift String was working, but it had several disadvantages, including the cost of invoking objc_msgsend and the need to viciously cast away type-safety to get past swift's ObjC bridging restrictions. Instead, Swift's core stdlib now contains a couple of "function pointers" (variables of Optional<some-Swift-function-type>) that are set when Foundation is loaded. We use C++ dynamic initialization to set up these variables, which is probably not the right long-term answer, but works for now. These functions, instead of invoking objc methods on NSString, go through CFStringXXX functions, which have a fast path that avoids objc_msgsend in Cocoa's common cases, and since they're not @objc methods, they can use Swift's full type vocabulary. It would still be nice to avoid any dynamic dispatch and checking overheads for going through these optional function variables, but this ought to be a lot better than where we were, and it keeps Foundation decoupled from the core standard library. Along the way, a fair amount of needless code bulk was shed. Shedding FTW! Swift SVN r12327