Commit Graph

343 Commits

Author SHA1 Message Date
Mishal Shah
5eece8860f Revert "SILOptimizer: Replace Array.append(contentsOf: with Array.append(elem…" 2016-12-06 11:26:15 -08:00
Slava Pestov
a32e11a0de Merge pull request #6064 from slavapestov/killing-substituted-type-access-check
Refactor accessibility checking to use TypeReprs (most of the time) rather than Types
2016-12-05 13:19:58 -08:00
Ben Ng
1b10c18b3e SILOptimizer: Replace [].append(contentsOf:) with [].append(element:) 2016-12-05 12:27:42 -05:00
Slava Pestov
d1b753c46a Sema: Remove a workaround for an accessibility problem in the standard library 2016-12-04 23:57:11 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
81e93c7ca6 Remove unused internal struct _InitializePointer<T> 2016-11-20 13:58:38 +01:00
Nate Cook
534bea8f9f [stdlib] Update revisions with feedback 2016-11-15 15:00:10 -06:00
Nate Cook
9b2128eb35 [stdlib] Add missing trivial type info to withUnsafeBytes 2016-11-11 14:03:37 -06:00
Nate Cook
bd6025f463 [stdlib] Various documentation fixes
- Fix incorrect type in Float(_:String) examples
- Expand discussions for ExpressibleBy_Literal protocols
- Add notes about non-escaping unsafe pointers from closures
- Add note about isEmpty to Collection.count discussions
- Describe imported `Bool` types
- Clean up some floating point discussions
- Provide some additional operator documentation
- Revise documentation for CVarArg functions
- Fix incorrect Set method parameter descriptions
- Clarify array bridging behavior
- Add collection subscript complexity notes
2016-11-11 11:23:49 -06:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Ben Cohen
fbed646d82 Merge pull request #5483 from airspeedswift/buffer-protocol
[stdlib] Make various free functions mutating an _ArrayBufferProtocol into extensions. Resolves ABI FIXME #14
2016-10-27 11:38:54 -07:00
Ben Cohen
81473386df added arg labels to _expectEnd 2016-10-26 12:58:44 -07:00
Ben Cohen
77e13e042e Remove the FIXME that led to this PR 2016-10-26 12:10:42 -07:00
Ben Cohen
f428a16635 tweaked local var names to avoid confusion with self's properties 2016-10-26 12:09:33 -07:00
Ben Cohen
91fa717715 move _arrayAppendSequence to an extension on _ArrayBufferProtocol 2016-10-26 10:21:10 -07:00
Ben Cohen
acb317c308 remove Index == Int constraints by adding missing endIndex: { get } 2016-10-26 10:15:01 -07:00
Ben Cohen
b35f1d10f3 remove some unnecessary self's 2016-10-26 09:21:37 -07:00
Ben Cohen
35d2392d7d Change _ArrayBuffer.replace(subRange:) to replaceSubrange to match RangeReplaceableCollection 2016-10-26 09:19:50 -07:00
Ben Cohen
f0d8ca83ad FIXME(ABI)#14 : add argument labels to _arrayOutOfPlaceReplace 2016-10-26 08:52:58 -07:00
Ben Cohen
3cc9b7f337 move _arrayOutOfPlaceReplace into _ArrayBufferProtocol extension 2016-10-25 16:36:28 -07:00
Ben Cohen
3752e6dae4 move _outlinedMakeUniqueBuffer and _arrayReserve into _ArrayBufferProtocol extension 2016-10-25 16:29:48 -07:00
Ben Cohen
6e841e0215 move _forceCreateUniqueMutableBuffer{Impl} into _ArrayBufferProtocol extension 2016-10-25 16:22:10 -07:00
Ben Cohen
b57b5bb222 move _forceCreateUniqueMutableBuffer{Impl} into _ArrayBufferProtocol extension 2016-10-25 16:18:07 -07:00
Ben Cohen
e0a31a9a6e move _arrayOutOfPlaceUpdate into _ArrayBufferProtocol extension 2016-10-25 15:14:19 -07:00
Andrew Trick
0a448ea74b SE-0138: Minor update. Array.withUnsafeBytes is nonmutating.
The "mutating" keyword should not have been on this API. The example
code in SE-0138 uses it as a nonmutating API.

(The mutating keyword was a temporary workaround that should never
have been carried over to the swift-3.0-branch).

<rdar://28614519> [swift-3.0-branch] Remove "mutating" keyword from Array.withUnsafeBytes
2016-10-11 15:54:16 -07:00
Andrew Trick
9c729e4c0c SE-0138: UnsafeRawBufferPointer revision.
The withUnsafeMutableBytes closure argument should not be `inout`.

Improve testing, fix comments.

Addresses DaveA's review.
2016-09-25 19:56:21 -07:00
Andrew Trick
f70a2e083e SE-0138: Add UnsafeRawBufferPointer and UnsafeMutableRawBufferPointer. (#4954)
https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md

Unsafe[Mutable]RawBufferPointer is a non-owning view over a region of memory as
a Collection of bytes independent of the type of values held in that
memory. Each 8-bit byte in memory is viewed as a `UInt8` value.

Reads and writes on memory via `Unsafe[Mutable]RawBufferPointer` are untyped
operations. Accessing this Collection's bytes does not bind the
underlying memory to `UInt8`. The underlying memory must be bound
to some trivial type whenever it is accessed via a typed operation.

In addition to the `Collection` interface, the following methods from
`Unsafe[Mutable]RawPointer`'s interface to raw memory are
provided with debug mode bounds checks: `load(fromByteOffset:as:)`,
`storeBytes(of:toByteOffset:as:)`, and `copyBytes(from:count:)`.

This is only a view into memory and does not own the memory. Copying a value of
type `UnsafeMutableRawBufferPointer` does not copy the underlying
memory. Assigning an `Unsafe[Mutable]RawBufferPointer` into a value-based
collection, such as `[UInt8]` copies bytes out of memory. Assigning into a
subscript range of UnsafeMutableRawBufferPointer copies into memory.
2016-09-23 11:26:00 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
Erik Eckstein
312b0d8521 fix coding style 2016-09-16 11:14:36 -07:00
Erik Eckstein
266a5f90bd stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate contiguous array buffers.
This reduces the amount of SIL generated for array operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-16 11:02:19 -07:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Dmitri Gribenko
cd07c2c125 Merge pull request #4795 from sigito/sr_2624
[SR-2624] Refine index out of bounds error messages for ArraySlice and SliceBuffer.
2016-09-15 00:24:40 -07:00
Yurii Samsoniuk
f3e3e2eb3f Update message. 2016-09-15 08:53:59 +02:00
Yurii Samsoniuk
53be51fb67 Refine index out of bounds error messages for Arrays and SliceBuffer. 2016-09-15 00:04:44 +02:00
Erik Eckstein
1201d96cb2 stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate contiguous array buffers.
This reduces the amount of SIL generated for array operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-14 14:54:18 -07:00
Nate Cook
8b39706c3f [stdlib] Documentation revisions
- Various edits
- Standardized complexity formatting
2016-08-12 12:24:36 -05:00
Ted Kremenek
1865f7d0db Revert "[stdlib] Deprecate ContiguousArray (do not merge yet)" 2016-08-08 21:36:14 -07:00
Ted Kremenek
0cdcd18d20 Merge pull request #4086 from apple/deprecate-contiguousarray
[stdlib] Deprecate ContiguousArray (do not merge yet)
2016-08-08 17:48:12 -07:00
Dave Abrahams
595aad3574 [stdlib] Deprecate ContiguousArray
The performance team reports that it's 2x slower than Array, and even if
it weren't, it would be obsoleted by the introduction of eager bridging.
2016-08-07 17:20:35 -07:00
Dmitri Gribenko
5178c8ea8a stdlib: fix the build with resilience enabled 2016-08-07 15:37:39 -07:00
Dmitri Gribenko
3c741bab7c stdlib: mark _ArrayBuffer, _ContiguousArrayBuffer, and _SliceBuffer internal 2016-08-07 15:13:59 -07:00
Dmitri Gribenko
2708afecc7 stdlib: internalize the _uninitializedCount initializer of array buffer 2016-08-07 15:11:54 -07:00
Dmitri Gribenko
3bb5c86e03 stdlib: make _ArrayProtocol and _ArrayBufferProtocol internal 2016-08-07 15:11:54 -07:00
Dmitri Gribenko
9705ccb9f2 stdlib: add underscores to an initializer on ArrayBufferProtocol 2016-08-07 14:20:37 -07:00
Dmitri Gribenko
609ba7321e stdlib: add SPI for bridging for Foundation 2016-08-07 14:20:36 -07:00
Nate Cook
559092bbf2 [stdlib] Revise stdlib documentation comments
- Expand pre-example explanations
- Update documentation for SE-0118
- Removing remaining 'iff' usage
- Revise Array discussion
- Fix formIndex(_:offsetBy) parameter formatting
- Improve index/formIndex(_:offsetBy:(limitedBy:)?) discussion
- Update Quick Look discussions
- Fixes grammar inconsistencies
- Adds parameter / return documentation
- Adds and expands on examples
- Revises AnyObject discussion for new `id` bridging rules
- Revise readLine, print, and assertion functions
- Add missing docs to String index-moving methods
2016-08-05 16:07:46 -05:00
Michael Ilseman
b7c9eddd11 [noescape by default] drop @noescape from stdlib 2016-08-04 16:09:01 -07:00
Dmitri Gribenko
a61d618c9e stdlib: fix indentation style 2016-07-31 02:04:28 -07:00
Dmitri Gribenko
bb6c6740ca stdlib: fix a bug in ArraySlice.removeLast() when startIndex != 0
ArraySlice.removeLast() only worked when startIndex was equal to zero.

This change fixes the bug, and uses the proper customization point for
the algorithm.

Fixes SR-1791, rdar://problem/26897658.
2016-07-31 02:04:23 -07:00
Andrew Trick
a18d490d6a Migrate from UnsafePointer<Void> to UnsafeRawPointer. (#3773)
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.

As proposed in SE-0107: UnsafeRawPointer.

`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.

Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.

* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.

This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.

* Fix a bunch of test cases for Void->Raw migration.

* qsort takes IUO values

* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.

* Parse #dsohandle as UnsafeMutableRawPointer

* Update a bunch of test cases for Void->Raw migration.

* Trivial fix for the SceneKit test case.

* Add an UnsafeRawPointer self initializer.

This is unfortunately necessary for assignment between types imported from C.

* Tiny simplification of the initializer.
2016-07-26 14:21:15 -07:00