Commit Graph

76 Commits

Author SHA1 Message Date
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Jordan Rose
12574d0f85 stdlib: Mark old insertContentsOf(_:at:) and unsafeAddressOf(_:) unavailable. 2016-02-24 11:43:02 -08:00
Jordan Rose
416b25bd1e stdlib: unsafeAddressOf(_:) becomes unsafeAddress(of:) 2016-02-23 16:58:49 -08:00
Max Moiseev
78ba5d5f3f [stdlib] Requires in comments changed to Precondition 2016-02-19 18:57:26 -08:00
Max Moiseev
40b1a0b7e0 [stdlib] all sorts of require renamed back to precondition 2016-02-19 18:21:29 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Nate Cook
355fa4d064 Mark true as code in documentation comments. 2016-02-12 04:21:57 -06:00
Nate Cook
51251dc133 Convert imperative function summaries to present.
i.e., "Return ..." -> "Returns ..."
2016-02-12 04:20:39 -06:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Dmitri Gribenko
574052f1be stdlib: standardize fatalError() messages for unavailable APIs 2016-01-21 16:34:54 -08:00
Max Moiseev
86680ec622 [stdlib] @available attributes for removed APIs 2016-01-20 13:08:27 -08:00
Doug Gregor
7d70b704e4 Merge commit '5e11e3f7287427d386636a169c4065c0373931a8' into swift-3-api-guidelines 2016-01-19 23:18:20 -08:00
Anton Blanchard
b1827d8a8f Add powerpc64le Linux support
This patch adds powerpc64le Linux support. While the patch also adds
the matching powerpc64 bits, there are endian issues that need to be
sorted out.

The PowerPC LLVM changes for the swift ABI (eg returning three element
non-homogeneous aggregates) are still in the works, but a simple LLVM
fix to allow those aggregates results in swift passing all but 8
test cases.
2016-01-15 06:48:31 +00:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
d366089df7 Runtime: Change getInstancePositiveExtents methods to return both extents.
A bit of future-proofing, since we plan to be able to grow class instances in both directions relative to their object header.
2015-12-23 15:39:53 -08:00
Joe Groff
583f5bdb6f Runtime: Rename class property lookup functions with consistent naming scheme.
Getting a superclass, instance extents, and whether a class is native-refcounted are all useful type API. De-underscore these functions and give them a consistent `swift[_objc]_class*` naming scheme.
2015-12-23 15:04:27 -08:00
Joe Groff
fe4782ef05 Runtime: Rename swift_isClassOrObjCExistential to -Type.
To conform with the other 'is*Type' queries.
2015-12-23 13:34:47 -08:00
Max Moiseev
200be71583 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-23 10:28:04 -08:00
Joe Groff
4b461684e3 Remove unused _swift_isClass function. 2015-12-23 09:17:08 -08:00
Max Moiseev
a7339e67ac Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-22 11:36:07 -08:00
Max Moiseev
51865a17b2 _debugRequire => _stdlibAssert etc. 2015-12-22 10:18:36 -08:00
practicalswift
36d7072013 Remove immediately adjacent repeated words ("the the", "for for", "an an", etc.). 2015-12-21 22:16:04 +01:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Maxim Moiseev
ee7d55f74b moving unsafeUnwrap into Optional 2015-12-16 17:24:12 -08:00
Maxim Moiseev
c4763ae686 _debugPrecondition => _debugRequire 2015-12-16 17:20:40 -08:00
Maxim Moiseev
e6468a0eca _precondition => _require 2015-12-16 17:19:01 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Patrick Pijnappel
6838f300b1 [stdlib] Add missing backticks around nil in docs 2015-12-13 09:40:49 +11:00
Maxim Moiseev
2c95bb6d51 BooleanType => Boolean 2015-12-10 14:56:32 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00
Andrew Trick
a8a49afd9e Add Builtin.isOptional.
There was previously no way to detect a type that is nominally
Optional at runtime. The standard library, namely OutputStream, needs
to handle Optionals specially in order to cirumvent conversion to the
Optional's wrapped type. This should be done with conditional
conformance, but until that feature is available, Builtin.isOptional
will serve as a useful crutch.
2015-12-09 16:06:42 -08:00
Maxim Moiseev
7372e9e045 COpaquePointer => OpaquePointer 2015-12-07 16:52:45 -08:00
Johan K. Jensen
fa76656c82 Remove instances of duplicated words 2015-12-03 20:00:29 +01:00
Joe Groff
fbd2e4d872 Rename @asmname to @_silgen_name.
This reflects the fact that the attribute's only for compiler-internal use, and isn't really equivalent to C's asm attribute, since it doesn't change the calling convention to be C-compatible.
2015-11-17 14:13:48 -08:00
Jordan Rose
cf8baedee2 Re-apply "Rename @transparent to @_transparent for now."
This re-applies 90fcbfe9a6. I'll be committing
the corresponding change to Foundation momentarily.
2015-11-16 10:53:56 -08:00
Xin Tong
16843684b2 Revert "Rename @transparent to @_transparent for now."
This reverts commit 90fcbfe9a6.

Seems there are still some tests that are left not modified.
2015-11-14 07:04:31 -08:00
Jordan Rose
90fcbfe9a6 Rename @transparent to @_transparent for now.
This feature has not been fully designed, let alone properly implemented.
For more information, see docs/TransparentAttr.rst.
2015-11-13 16:25:34 -08:00
Andrew Trick
60d23310c1 For unsafeReferenceCast rely on type checks in the runtime.
<slight revision of yesterday's reverted commit>

The debugAsserts were nicely self-documenting, but generate an obscene
amount of useless SIL code that is inlined everywhere and sticks around
when we compile the stdlib. The old asserts would need to be fixed to
support Optionals but that makes the situation much worse.

Why is it ok to remove the asserts?
_unsafeReferenceCast remains an internal API.
If the src/dest types are not loadable reference types, the cast will
not be promoted to a value bitcast.
The remanining cases will be dynamically checked by swift_dynamicCast.

Swift SVN r32828
2015-10-22 18:19:24 +00:00
Arnold Schwaighofer
7fa673c6bc Revert "stdlib: Replace unsafeBitCast calls with unsafeCastReference."
Revert "For unsafeReferenceCast rely on static verifier checks."

This reverts commit r32796.
This reverts commit r32795.

They very likely broke a buildbot.

Swift SVN r32813
2015-10-21 22:06:01 +00:00
Andrew Trick
98d17a5236 For unsafeReferenceCast rely on static verifier checks.
The debugAsserts were nicely self-documenting, but generate an obscene
amount of useless SIL code that is inlined everywhere and sticks around
when we compile the stdlib. The old asserts would need to be fixed to
support Optionals but that makes the situation much worse.

Why is it ok to remove the asserts?
_unsafeReferenceCast remains an internal API. The invariants are checked
statically whenever the routine is specialized, and dynamically checked
by the runtime cast.

Swift SVN r32795
2015-10-21 19:41:54 +00:00
Andrew Trick
f3e5b1d5af Convert unsafeDownCast to use Builtin.castReference.
Generally avoid casting to a raw pointer unless a raw pointer is needed.
Builtin.castReference is now the canonical way to cast reference types.
Canonical generally = better optimizer. In practice this will reduce to
the same SIL since the stdlib code will be optimized.

There are enough unit tests for unsafeDowncast and Builtin.castReference.

I measured no performance regressions.

Swift SVN r32646
2015-10-13 01:07:54 +00:00
Andrew Trick
8007dc8cfa Add Builtin.castReference and internal API _unsafeCastReference.
_unsafeCastReference allows casting of any references types, regardless
of whether they are references to objects or class existentials. The
implementation is responsible for converting between representations.

_unsafeCastReference provides a dynamic check to ensure that the source
and dest are both actually references. If not, the implementation will
trap at runtime. Generally, the optimizer can prove that the source
and dest are references, and promote this cast to an
unchecked_ref_cast bitcast. There is no dynamic check that the
references types are compatible.

This differs from unsafeDownCast in two ways:

(1) The source and dest types are not statically typed
AnyObjects. Therefore, unsafeCastReference can be used when the
surrounding code dynamically handles both reference and nonreference
types.

(2) The source and dest also need not dynamically conform to AnyObject.
Either side of the cast may be a class existential. The primary
requirement is that the source and dest refer to the same reference
counted object.

Swift SVN r32588
2015-10-10 03:39:34 +00:00
Andrew Trick
08bc41849e Remove from unsafeBitCast argument--it doesn't need an address.
Swift SVN r32300
2015-09-29 15:42:38 +00:00
Andrew Trick
21e7b06e77 Migrate the unsafeBitCast API to use Builtin.reinterpretCast.
This avoids unnecessary address-taking. Instead use the builtin that directly
supports unsafe casts. The optimizer now follows clear rules for
Builtin.reinterpretCast (so it's safe to use) and knows how to optimize it.

Swift SVN r32268
2015-09-28 01:58:30 +00:00
Arnold Schwaighofer
cc4e41cb3e Add a ispod builtin and _isPOD function to the stdlib
The builtin returns true if the argument type is a POD type: needs no special
handling for copy and destruct operations.

Swift SVN r32242
2015-09-25 22:05:14 +00:00
Dmitri Hrybenko
4375a463a7 stdlib: rename Int**.value and Float**.value to _value per naming convention
rdar://21357661

Swift SVN r32096
2015-09-20 00:01:13 +00:00
Dmitri Hrybenko
dd3194a18c stdlib: adopt @warn_unused_result
rdar://20957486

Swift SVN r31048
2015-08-06 14:53:18 +00:00