Erik Eckstein
ef3a611ddb
stdlib: make sure that Array._copyBuffer is not inlined.
...
Although it’s called via _slowPath the compiler sometimes inlines it, because it considers it to be a trivial function.
This change gives small code size improvements for benchmarks which deal with arrays.
rdar://problem/30210047
2017-01-26 15:59:55 -08:00
Ben Cohen
0bafc86e5e
remove redundant _arrayReserve method
2017-01-18 09:17:26 -08:00
Ben Cohen
5a83bef7b3
tweak outer loop comment
2017-01-17 11:36:41 -08:00
ben-cohen
3dfd0f74f0
refactor sequence append growth logic
2017-01-16 20:42:00 -08:00
Ben Cohen
578a52627a
Merge branch 'master' into se-147
2017-01-07 13:19:15 -08:00
practicalswift
6d1ae2a39c
[gardening] 2016 → 2017
2017-01-06 16:41:22 +01:00
Ben Cohen
465f243943
Move += operator for append(contentsOf:) up to RangeReplaceableCollection
2017-01-05 11:59:49 -08:00
Ben Cohen
fefc2e40df
Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun.
2017-01-05 11:59:49 -08:00
Yurii Samsoniuk
2b62ed250a
Updated index(_:offsetBy:limitedBy:) code example
2016-12-31 15:48:52 +01:00
Nate Cook
4169635a20
[stdlib] Consistency fixes in Array documentation
...
- Removed "see other" note from type discussion
- Modified index(_:offsetBy...) to match other collections
- Word choice in reserveCapacity(_:)
2016-12-19 14:16:36 -06:00
Nate Cook
82811c57f0
[stdlib] Improvements to Collection doc comments
2016-12-19 13:05:19 -06:00
Nate Cook
f2bc719eff
[stdlib] Address feedback from @stephentyrone
2016-12-15 13:55:38 -06:00
Nate Cook
3bc4909de8
[stdlib] Various revisions and fixes for documentation
...
- Fix wording for RandomAccessCollection
- Add note about array growth to reserveCapacity(_:)
- Reformat lazy flatMap discussions
- Improve Collection symbol consistency
2016-12-15 11:47:19 -06:00
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