Commit Graph

63 Commits

Author SHA1 Message Date
Dmitri Hrybenko
46302bd305 stdlib: mark more closures with @noescape
Swift SVN r25035
2015-02-06 05:26:03 +00:00
Dmitri Hrybenko
f4e35f90eb stdlib: remove Unsafe[Mutable]Pointer.null()
This API is redundant with nil literals and the default initializer.

rdar://19159145

Swift SVN r24796
2015-01-28 08:42:28 +00:00
Dmitri Hrybenko
311957061a Stop using Unsafe[Mutable]Pointer.null()
This API will be removed per rdar://19159145 (it is redundant with nil
literals and the default initializer).

Swift SVN r24795
2015-01-28 08:42:26 +00:00
Maxwell Swadling
c87ddeb2ee [stdlib] added initializeTo default implementation
This allows for sequences backed by contiguous buffers to be
initialized quickly

Swift SVN r24742
2015-01-27 02:12:24 +00:00
Maxwell Swadling
a86572c9a9 [stdlib] Updated APIs to use C.Generator.Element
Swift SVN r24740
2015-01-27 02:12:19 +00:00
Dmitri Hrybenko
877a34e388 stdlib: remove (almost) the assumption that Swift.Int is implemented
in terms of Builtin.Word

Swift SVN r24721
2015-01-25 13:11:37 +00:00
Maxwell Swadling
35d835e454 [stdlib] used builtins in moveAssignFrom instead of loop
Swift SVN r24690
2015-01-23 19:37:02 +00:00
Maxwell Swadling
b33b91156e [stdlib] added comment about builtins in UnsafePointer
Swift SVN r24660
2015-01-22 23:44:51 +00:00
Maxwell Swadling
d9c1888b5b [stdlib] use builtin array operations instead of loops
Swift SVN r24655
2015-01-22 21:51:30 +00:00
Maxwell Swadling
aec2f955e7 [stdlib] fixed bug in bounds of pointer copy/move operations
Fixes rdar://problem/19392115

Swift SVN r24614
2015-01-21 22:41:10 +00:00
John McCall
dc4431ebff Split addressors into unsafe, owning, and pinning variants.
Change all the existing addressors to the unsafe variant.

Update the addressor mangling to include the variant.

The addressor and mutable-addressor may be any of the
variants, independent of the choice for the other.

SILGen and code synthesis for the new variants is still
untested.

Swift SVN r24387
2015-01-13 03:09:16 +00:00
Graham Batty
dc6a776d10 stdlib: Use config directives to work without objective-c.
Swift SVN r23211
2014-11-10 20:06:25 +00:00
Graham Batty
373414864d Revert "Use config directives to carve out a 'portable' kernel stdlib."
This reverts commit r23202 pending further discussion.

Swift SVN r23205
2014-11-10 18:46:42 +00:00
Graham Batty
dfa260fab1 Use config directives to carve out a 'portable' kernel stdlib.
Swift SVN r23202
2014-11-10 18:03:09 +00:00
Dmitri Hrybenko
b350841f72 stdlib: remove old migration aid for ConstUnsafePointer
Swift SVN r22599
2014-10-08 08:34:14 +00:00
John McCall
8541ffd006 Convert UnsafePointer's memory property and
subscript operator to be addressed.

Swift SVN r22424
2014-10-01 07:09:18 +00:00
Erik Eckstein
a4c7d89671 fix coding style in stdlib: move non-attribute keywords in same line as function declaration
Swift SVN r22275
2014-09-25 08:43:55 +00:00
Dave Abrahams
a7f3e4222e [stdlib] finish public non-protocol docs
The 58 undocumented public non-operator APIs still present in core are
all on non-exposed (underscored) APIs.

Swift SVN r22263
2014-09-24 12:31:45 +00:00
Dave Abrahams
66d2ba43c6 [stdlib] underscore APIs made visible by r22212
That commit made a protocol public.  The protocol was underscored but
some of its APIs were not, and those became unintentionally publicly
visible.  This commit corrects that problem.  Since Builtin.RawPointer
properties were being renamed from "value" to "_rawValue" for clarity,
COpaquePointer got that treatment too, even though it wasn't strictly
necessary, for consistency.

Swift SVN r22252
2014-09-24 02:50:43 +00:00
Dave Abrahams
795799b0d2 [stdlib] Propagate Hashable docs
202 undocumented public non-operator APIs remain in core

Swift SVN r22241
2014-09-23 23:35:58 +00:00
Dave Abrahams
24fe53ed6c [stdlib] Propagate OutputStream docs
240 undocumented public non-operator APIs remain in core

Note: previous estimates were wrong because my regex was broken.  The
previous commit, for example, had 260 undocumented APIs.

Swift SVN r22234
2014-09-23 22:01:49 +00:00
Dave Abrahams
3f4e7f5bc8 [stdlib] Propagate RandomAccessIndexType docs
190 undocumented non-operator public APIs remain in core

Swift SVN r22226
2014-09-23 19:43:36 +00:00
Dave Abrahams
218d25eb5a [stdlib] Propagate BidirectionalIndexType docs
193 undocumented public non-operator APIs remain in core

Swift SVN r22225
2014-09-23 19:35:31 +00:00
Dave Abrahams
c38e3201b2 [stdlib] Propagate ForwardIndexType docs to models
200 undocumented public APIs remain in core

Swift SVN r22222
2014-09-23 19:20:48 +00:00
Erik Eckstein
f8f703083f Make compiler intrinsics public.
Swift SVN r22212
2014-09-23 11:12:18 +00:00
Dave Abrahams
f780a1ce67 [stdlib] Propagate NilLiteralConvertible docs
229 undocumented public APIs remain in core

Swift SVN r22211
2014-09-23 10:49:47 +00:00
Doug Gregor
7f80e00d37 Swift NilLiteralConvertible to an initializer requirement
Swift SVN r21980
2014-09-16 20:43:35 +00:00
Dave Abrahams
6c07fb4ad1 [stdlib] Revert UnsafePointer casting change
The syntax being reverted added busywork and noise to the common case
where you want to say "I have the right address, but the wrong type,"
without adding any real safety.

Also it eliminated the ability to write UnsafePointer<T>(otherPointer),
without adding ".self" to T.  Overall, it was not a win.

This reverts commits r21324 and r21342

Swift SVN r21424
2014-08-22 21:53:12 +00:00
Dave Abrahams
1fb0f889d7 [stdlib] Make UnsafePointer conversions explicit
Previously, it was possible to write Unsafe[Mutable]Pointer(x) and have
Swift deduce the pointee type based on context.  Since reinterpreting
memory is a fundamentally type-unsafe operation, it's better to be
explicit about conversions from Unsafe[Mutable]Pointer<T> to
Unsafe[Mutable]Pointer<U>.  This change is consistent with the move from
reinterpretCast(x) to unsafeBitCast(x, T.self).

Also, we've encoded the operations of explicitly adding or removing
mutability as properties, so that adding mutability can be separated
from wild reinterpretCast'ing, a much more severe form of unsafety.

Swift SVN r21324
2014-08-20 23:15:56 +00:00
Arnold Schwaighofer
dc001d3ece stdlib: Don't check overflow on UnsafePointers they are unsafe
This also reverts the commit "stdlib: Don't check for overflow in subscript accesses to
ContigousArrayBuffer" as removing the overflow check on all unsafe pointers has
the same effect.

Swift SVN r21220
2014-08-14 23:16:20 +00:00
Arnold Schwaighofer
70caa2e83e stdlib: Don't check for overflow in subscript accesses to ContigousArrayBuffer
We overflow checked the mulitplication in "a + sizeof(T) * i". This is not
necessary for ContingousArrayBuffer because this overflow check has happened
when we compute the size of the array during allocation of a native swift array
or a NSArray.

benchmark``````````````,``baserun0``,``optrun2``,``delta,``speedup
Memset`````````````````,``1184.00```,``487.00```,``698.00``,````````143.9%
QuickSort``````````````,``1299.00```,``1458.00``,``178.00``,````````-12.2%
SelectionSort``````````,``1027.00```,``814.00```,``213.00``,````````26.2%
StdlibSort`````````````,``1718.00```,``1587.00``,``127.00``,````````8.0%
Walsh``````````````````,``1160.00```,``1076.00``,``86.00```,````````8.1%
XorLoop````````````````,``1248.00```,``884.00```,``369.00``,````````42.0%

The  regression in quicksort is noise - i looked at the LLVM IR and the only
thing different in the graph is that we have removed the mulitplication with
overflow check (that is - we should be running faster). Same thing looking at
the assembly.

XorLoop and Memset speed up because we are now able to vectorize those loops.

Swift SVN r21218
2014-08-14 21:49:34 +00:00
Dave Abrahams
70b388ba77 [stdlib] Add append() to ExtensibleCollectionType
If you can be grown by an arbitrary sequence of your element type, you
can be grown by a single element.

Swift SVN r20996
2014-08-04 06:44:33 +00:00
Dmitri Hrybenko
aaaedefb63 stdlib/pointer types: give all pointers to objects (COpaquePointer,
Unsafe*Pointer) equivalent APIs, and change the initializer from a bare integer
to require a 'bitPattern:' label.

rdar://17895306


Swift SVN r20979
2014-08-03 21:47:31 +00:00
Dave Abrahams
f270a5b6f3 [stdlib] _StringCore : RangeReplaceable
Swift SVN r20947
2014-08-02 05:44:40 +00:00
Dave Abrahams
5465993f81 [stdlib] UnsafePointer : RandomAccessIndexType
It can be useful to form Ranges of these things, and there's no reason
it shouldn't be efficient to measure them, for example.

Swift SVN r20875
2014-08-01 01:46:09 +00:00
Dmitri Hrybenko
0194e2675b stdlib/UnsafePointer: add more doc comments
Swift SVN r20822
2014-07-31 14:28:04 +00:00
Dave Abrahams
a792eb68a4 [stdlib] release notes, @availability attributes
Swift SVN r20488
2014-07-24 13:17:39 +00:00
Dave Abrahams
d00e888d95 [stdlib] Rename reinterpretCast => unsafeBitCast
Also give unsafeBitCast an explicit type parameter.  So

  let x: T = reinterpretCast(y)

becomes

  let x = unsafeBitCast(y, T.self)

Swift SVN r20487
2014-07-24 13:17:36 +00:00
Dmitri Hrybenko
26c3285534 stdlib: StaticString and UnsafePointer should be free abstractions even in
debug builds

On -O0 pre-commit benchmarks, this change has only effects at noise level for
most benchmarks, but +10% for StringWalk.


Swift SVN r20393
2014-07-23 13:43:51 +00:00
Dave Abrahams
1438d617cd [stdlib] Rename ConstUnsafePointer=>UnsafePointer
Swift SVN r20318
2014-07-22 17:10:54 +00:00
Dave Abrahams
21669b3aee [stdlib] Add "Mutable" to [Autoreleasing]UnsafePointer
UnsafePointer becomes UnsafeMutablePointer
AutoreleasingUnsafePointer becomes AutoreleasingUnsafeMutablePointer

Swift SVN r20316
2014-07-22 16:56:23 +00:00
Dmitri Hrybenko
80748a5883 stdlib/Printing: add DebugPrintable conformances to unsafe pointer types
rdar://16896025 rdar://16896013

Swift SVN r20312
2014-07-22 16:06:47 +00:00
Dave Abrahams
3731a0d1d2 [stdlib] Deal with various zero-division scenarios
Primarily, this means becoming resilient to Builtin.strideof(x) == 0.
Pretty much the only way to get pointers and arrays to make sense is to
treat zero-sized elements as having a stride of 1, so we do that in our
wrapper for Builtin.strideof.  Other points include precondition checks
for radixes in number formatting.

Fixes <rdar://problem/17097768>

Swift SVN r20242
2014-07-21 05:21:22 +00:00
Jordan Rose
8f520414b7 [Accessibility] A private class cannot contain public methods.
There's no meaningful way in which these methods are public, since they
can't be accessed through any value of the type

<rdar://problem/17647878>

Swift SVN r20224
2014-07-20 17:26:24 +00:00
Chris Lattner
e0b0205cd7 Remove the @assignment attribute entirely. It doesn't do anything except
enforce its own little constraints.  The type checker isn't using it for
anything, and it is just clutter.

This resolves <rdar://problem/16656024> Remove @assignment from operator implementations



Swift SVN r19960
2014-07-14 22:44:25 +00:00
Dave Abrahams
d85a7f5d0c [stdlib] Pointer types are not BooleanType's
Fixes <rdar://problem/17597917>.  Someone still needs to do this for the
Optional types.

Swift SVN r19901
2014-07-13 19:21:54 +00:00
Dave Abrahams
cbcf9aba21 s/LogicValueType/BooleanType/
We're moving toward using that protocol for straight-up Bool types

Swift SVN r19884
2014-07-12 18:58:18 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Jordan Rose
da29f099f0 Update stdlib for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19672
2014-07-08 02:17:46 +00:00
Enrico Granata
d611059b70 Refactor the UnsafePointers Mirrors to use the all-powerful Mirror Generator
Reduces some boilerplate



Swift SVN r19640
2014-07-07 22:11:32 +00:00