Commit Graph

9 Commits

Author SHA1 Message Date
Dave Abrahams
97ec182ba7 [stdlib] Move String bridging into Core stdlib
This change allows us to drop an egregious table-of-function-pointers
hack in favor of a much cleaner hack using SwiftShims.  It also allows
us to move the ObjC mirrors out of Foundation in an upcoming commit.

Swift SVN r25011
2015-02-05 19:18:32 +00:00
Joe Groff
436acb00f3 Foundation: Remove the prepareWithInvocationTarget overlay.
Giving the invocation target proxy a type will be bogus when we turn on 'dynamic'. This breaks the NSUndoManager tests because we still can't work with lvalues through AnyObject. <rdar://problem/17755906>

Swift SVN r20283
2014-07-22 00:23:34 +00:00
Greg Parker
3b0e45b497 Fix -[NSUndoManager prepareWithInvocationTarget:].
This method returns a proxy object. Swift cannot current cast proxy objects 
to their proxied types. The workaround for now is to add a generic overlay 
for -prepareWithInvocationTarget: so the declared type of the returned 
proxy is the proxied type. This is good enough to make undo proxies work with 
objc-dispatched calls.


Swift SVN r18155
2014-05-16 01:07:22 +00:00
Joe Groff
da7880b0e4 Drop unnecessary 'swift_compareObjects' and 'swift_hashObject' stubs.
Swift SVN r14769
2014-03-07 03:21:32 +00:00
Joe Groff
c572cc222c Revert "stdlib: Push '===' for AnyObject into stdlib/core."
This reverts commit r14646. It exposes an optimizer bug.

Swift SVN r14649
2014-03-04 17:39:15 +00:00
Joe Groff
5634ff5e67 stdlib: Push '===' for AnyObject into stdlib/core.
And drop the 'Identifiable' protocol.

Swift SVN r14646
2014-03-04 17:04:50 +00:00
Greg Parker
95c2fc43f8 Clena up some 32/64 mismatches. Remove some dead posix stubs.
Swift SVN r13144
2014-01-30 09:34:26 +00:00
Dave Abrahams
586ccabbb0 [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
2014-01-15 11:29:23 +00:00
Greg Parker
720dab7b95 Separate non-String code from BridgeNSString.mm.
Swift SVN r8818
2013-10-01 21:49:03 +00:00