Commit Graph

17573 Commits

Author SHA1 Message Date
Dave Abrahams
3cebb1444c [stdlib] Make staging typealiases public
Really unbreak external projects this time!

Swift SVN r27187
2015-04-09 22:43:14 +00:00
Roman Levenstein
d1698ba1cb Use a _bridgeable suffix for newly introduced fast bridging functions. NFC.
Dave explained that stdlib usually uses the suffix notation in such cases. This change follows his advice.

Swift SVN r27177
2015-04-09 20:59:42 +00:00
Erik Eckstein
4c2ce1ee84 stdlib: some simplifications in Arrays.swift.gyb source code.
It's not just refactoring. It is a functional change. But it should not have a significant effect on performance.



Swift SVN r27168
2015-04-09 15:49:58 +00:00
Erik Eckstein
36fae15313 stdlib: rewrite Array.append to simplify the generated SIL code.
Swift SVN r27167
2015-04-09 15:37:14 +00:00
Dmitri Hrybenko
c8af957f08 stdlib: fix a typo in comments
Swift SVN r27161
2015-04-09 04:45:37 +00:00
Dmitri Hrybenko
9c03811987 stdlib: add initializers from String to integer and floating-point types
rdar://17232531

Swift SVN r27159
2015-04-09 03:20:41 +00:00
Roman Levenstein
8341a4f5b3 As suggested by DaveA, remove useless information, which just repeats the declaration. NFC.
Swift SVN r27158
2015-04-09 02:35:28 +00:00
Erik Eckstein
43d41147a6 stdlib: implement nativeOwner in all array buffers to avoid %else in Arrays.swift.gyb. NFC.
Swift SVN r27133
2015-04-08 19:48:48 +00:00
Erik Eckstein
d79078a391 stdlib: fix coding style in ArrayBuffer
Swift SVN r27131
2015-04-08 19:24:39 +00:00
Dave Abrahams
72585a7bdd [stdlib] Restore GeneratorOf/SequenceOf for staging
Let's keep internal projects building for a while

Swift SVN r27128
2015-04-08 18:10:19 +00:00
Dave Abrahams
5671f7399d [stdlib] fix comments
Swift SVN r27127
2015-04-08 17:40:49 +00:00
Dave Abrahams
4400bce00a Revert "[stdlib] Workaround for <rdar://20409234>"
This reverts commit r27091 because Doug fixed the underlying bug.

Swift SVN r27126
2015-04-08 17:38:55 +00:00
Dave Abrahams
00bc80b5d0 [stdlib] Bring back toString & co. for staging
Renaming broke external projects and we want to handle this more
smoothly.

Swift SVN r27125
2015-04-08 15:26:25 +00:00
Erik Eckstein
ddb25915b6 stdlib: Avoid a isNative check in _getOwner in the Array's mutableAddressWithPinnedNativeOwner
When calling _getOwner at this point we know that it is a native array.
This simplifies the SIL code for assigning a class array element (a[i] = x).



Swift SVN r27124
2015-04-08 09:54:04 +00:00
Erik Eckstein
10166ba228 stdlib: return the correct buffer property in _getArrayPropertyIsNative
As _getArrayPropertyIsNative is not use yet, there is NFC.



Swift SVN r27123
2015-04-08 09:32:36 +00:00
Dmitri Hrybenko
e5ca5f5952 stdlib: remove unused typealias that was added by mistake
Swift SVN r27114
2015-04-08 00:41:21 +00:00
Dmitri Hrybenko
42b9d14632 Foundation overlay: remove empty file
Swift SVN r27111
2015-04-08 00:28:44 +00:00
Roman Levenstein
3effd6fcf7 Introduce two new compiler-known library functions for performing bridging casts when conformances are known statically.
We define two new library functions _knownForceBridgeFromObjectiveC/_knownConditionallyBridgeFromObjectiveC, similar to _forceBridgeFromObjectiveC/_conditionallyBridgeFromObjectiveC. The main difference is that they require their arguments to conform to _BridgedToObjectiveC and _BridgedToObjectiveC. _ObjectiveCType accordingly. With this change, it is now possible to invoke the _BridgedToObjectiveC._forceBridgeFromObjectiveC witness directly, without going via the inefficient swift_bridgeNonVerbatimFromObjectiveC.

So now, for a cast O -> S, if it can be statically proven that an ObjC type O is bridgeable to a Swift type S implementing the _BridgedToObjectiveC protocol (i.e. O is the class (or its subclass) defined by the S._ObjectiveCType alias), we can generate a code to invoke the newly defined library function _knownForceBridgeFromObjectiveC/_knownConditionallyBridgeFromObjectiveC instead of _forceBridgeFromObjectiveC/_conditionallyBridgeFromObjectiveC.

After inlining, this will end-up invoking  S._forceBridgeFromObjectiveC directly instead of invoking a more general, but less effective swift_bridgeNonVerbatimFromObjectiveC, which always performs conformance checks at runtime, even if conformances are known statically. As a result, no conformance checks are performed at run-time if conformances are known statically.

The client code making use of these new APIs and the tests are coming in the subsequent commits.

The naming of the two new helper library functions was discussed with Dmitri.

This is part of the bridging casts optimization effort. And it is specifically useful for e.g. rdar://19081345.

Swift SVN r27100
2015-04-07 22:53:55 +00:00
Dave Abrahams
0464c3d957 [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r27092
2015-04-07 20:32:31 +00:00
Dave Abrahams
858b1223a6 [stdlib] Workaround for <rdar://20409234>
Doug will revert this any second now when he checks in his fix

Swift SVN r27091
2015-04-07 20:32:30 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +00:00
Michael Gottesman
2c143aee96 Revert "[stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]"
This reverts commit r27081. It broke the build.

Swift SVN r27086
2015-04-07 17:21:03 +00:00
Doug Gregor
6fe861474c Revert "[stdlib] Workaround for <rdar://20409234>"
This reverts r27080; the workaround is no longer necessary.

Swift SVN r27085
2015-04-07 16:40:18 +00:00
Dave Abrahams
367b2e40f0 [stdlib] Mirror -> public/core
The new mirror design passed our API review and blocking bugs have been
fixed/worked-around, so integrating it into the core standard library.

Swift SVN r27082
2015-04-07 15:33:49 +00:00
Dave Abrahams
a80b1a4caa [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r27081
2015-04-07 15:20:40 +00:00
Dave Abrahams
ed5156e3ee [stdlib] Workaround for <rdar://20409234>
Doug will revert this any second now when he checks in his fix

Swift SVN r27080
2015-04-07 15:12:12 +00:00
Dave Abrahams
4ba169ae16 [stdlib] ExistentialCollection -> public/core
It passed our API review so integrating it into the core standard
library.

Swift SVN r27079
2015-04-07 15:12:10 +00:00
Dmitri Hrybenko
ed99e14f54 SDK overlay: create an overlay for SceneKit
rdar://20384803
rdar://20384835

Swift SVN r27069
2015-04-07 06:41:55 +00:00
Dmitri Hrybenko
1b9ca12c5b stdlib: remove old declarations that were marked unavailable
rdar://20169533

Swift SVN r27020
2015-04-05 09:15:49 +00:00
Dmitri Hrybenko
ff2dd6320a stdlib: fix coding style
When colon specifies is-a relationship between types, we put spaces on
both sides of the colon.

Swift SVN r27016
2015-04-05 05:54:55 +00:00
Joe Groff
fe3d75eec8 Update for feedback from Dmitri.
Simplify the observation evaluation in the ErrorType race test by using evaluateObservationsAllEqual, and run the test for real. Apparently round-trip NSString and NSDictionary bridging doesn't produce a stable object, so use valueForKey as a hack to sidestep bridging so we can verify that the identities of the bridged domain and code aren't racy.

Swift SVN r27003
2015-04-05 03:07:42 +00:00
Joe Groff
41f73d43ae Runtime: Try to make lazy ErrorType-to-NSError bridging thread-safe.
Atomically initialize and load the NSError bridging fields within an ErrorType box so that we do the right thing when two threads concurrently coerce the box to NSError.

Swift SVN r26996
2015-04-05 00:17:34 +00:00
Joe Groff
66ae68bcc3 Sema: Allow ErrorType-conforming types to be explicitly coerced 'as NSError'.
Swift SVN r26993
2015-04-04 22:38:04 +00:00
Erik Eckstein
78a3572fa4 Rename NoDTC to NoTypeCheck. NFC.
Swift SVN r26973
2015-04-04 08:24:59 +00:00
Joe Groff
b2cb75ad30 Runtime: Add a 'swift_becomeNSError' entry point to coerce an ErrorType box to an NSError instance.
If the NSError part of the box hasn't been initialized yet, fill it in with the domain and code of the contained value. This will allow us to efficiently turn ErrorType values into NSErrors, either for bridging or for coercion purposes.

Swift SVN r26958
2015-04-03 22:16:52 +00:00
Joe Pamer
980bd819a2 Propagate 'throws' information into function type metadata.
Swift SVN r26956
2015-04-03 21:45:33 +00:00
Nadav Rotem
7ebd9f1adc Mark methods in protocol extension as final.
Swift SVN r26948
2015-04-03 19:29:20 +00:00
Ben Langmuir
0c120e5914 Reapply r26926 after fixing SourceKit test
r26926 was reverted in r26930 because of a SourceKit failure, that was
fixed in r26945.

Swift SVN r26946
2015-04-03 19:04:50 +00:00
Erik Eckstein
4c4b9abd99 stdlib: avoid masking out the array buffer spare bits if we know that they are zero.
Swift SVN r26938
2015-04-03 14:14:56 +00:00
Erik Eckstein
2f971c22cb re-apply r26871: stdlib: Do the Array fast-path check with a single array property call.
Changes compared to the original version:
I fixed the 2 bugs and added a test for the so far undetected missing range check bug.
To keep the SIL simple (4 basic blocks for arr[x]) I extracted the slow path for getElement into a
non-inlinable function.
On the other hand I inlined _typeCheck into the slow-path function.
This speeds up NSArray accesses because now only a single objectAtIndex is required for both
type checking and element retrieving.

Update on performance: DeltaBlue is now only 12% better (and not 25%). I suspect this is because
now Arnold's tail duplication cannot detect the ObjC call in the slow path.



Swift SVN r26935
2015-04-03 06:48:25 +00:00
Greg Parker
f9ca55df0f Revert r26926 which broke a SourceKit test.
Swift SVN r26930
2015-04-03 03:54:12 +00:00
Dave Abrahams
17de46f1c9 [stdlib] ExistentialCollection: perf de-regression
The performance regression that occurred when ++ and -- were added as
requirements to the Index protocols was due to the fact that it caused a
dubious hack of mine to be bypassed: when treated as indices, integer
types are incremented and decremented without overflow checking.  While
technically justifiable (see the r20576 commit message), this makes the
standard library extremely fragile and makes successor() and
predecessor() mathematically unsafe. We really should see what the
optimizer team can do to make that hack unnecessary.

In the meantime, instead of dispatching through ++ and --, use a
special, defaulted _[successor|predecessor]InPlace() method to give
indices their own, customizable in-place inc/dec-rement path.

Swift SVN r26926
2015-04-03 02:39:40 +00:00
Michael Gottesman
0255a5b948 Revert "[stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]"
This reverts commit r26904. Fixing the build.

Swift SVN r26912
2015-04-02 22:55:30 +00:00
Michael Gottesman
d53bff777b Revert "[stdlib] ExistentialCollection -> public/core"
This reverts commit r26888. Trying to fix the build.

Swift SVN r26911
2015-04-02 22:55:29 +00:00
Dave Abrahams
0b40374d10 [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r26904
2015-04-02 21:55:22 +00:00
Chris Willmore
690daa539a Back out changes for in-place methods/operators from Xcode 7.
This reverts commits r26508, r26545, and r26576.

Swift SVN r26900
2015-04-02 21:14:28 +00:00
Chris Lattner
79ed57f9f2 standardize naming of tuples and tuple patterns on "elements".
Previously some parts of the compiler referred to them as "fields",
and most referred to them as "elements".  Use the more generic 'elements'
nomenclature because that's what we refer to other things in the compiler
(e.g. the elements of a bracestmt).

At the same time, make the API better by providing "getElement" consistently
and using it, instead of getElements()[i].

NFC.



Swift SVN r26894
2015-04-02 20:23:49 +00:00
Dave Abrahams
910c895346 [stdlib] ExistentialCollection -> public/core
It passed our API review so integrating it into the core standard
library.

Swift SVN r26888
2015-04-02 20:17:53 +00:00
Dave Abrahams
44bddea674 [stdlib] Protocol-dispatch ++ and -- for indices
...and take advantage of this capability to optimize AnyXXXIndex.

Swift SVN r26876
2015-04-02 17:21:45 +00:00
Ted Kremenek
69a12dfcb8 Revert "stdlib: Do the Array fast-path check with a single array property call."
This was causing test '1_stdlib/ArrayTraps.swift.gyb' to fail.

Swift SVN r26872
2015-04-02 14:47:19 +00:00