Commit Graph

148 Commits

Author SHA1 Message Date
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -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
Nate Cook
32f81e8238 Add missing abstracts for types and protocols. 2016-02-11 11:47:27 -06:00
Arnold Schwaighofer
ebfb504415 Don't use generators in array equality comparisons
This is easier to read and faster if we don't specialize away the generator
code.
2016-02-02 14:58:23 -08:00
Austin Zheng
77918a86ac [SR-88] Reinstate Mirror migration changes, fix test issues
This reverts commit 182bb7f812.
2016-01-27 20:40:52 -08:00
Andrew Trick
182bb7f812 Revert "Merge pull request #1058 from austinzheng/az-port-mirror"
This pull request broke the following tests on several build configurations
(eg --preset=buildbot,tools=RA,stdlib=DA)

    1_stdlib/Reflection.swift
    1_stdlib/ReflectionHashing.swift
    1_stdlib/UnsafePointer.swift.gyb

This reverts commit c223a3bf06, reversing
changes made to 5c2bb09b09.
2016-01-27 10:43:08 -08:00
Austin Zheng
10d5b23c30 [SR-88] Reinstate mirror migration commit
Changes:
- Reverted commit reverting original SR-88 commit
- Removed mirror children helper collections and related code
- Rewrote some tests to keep them working properly
- Wrote two more tests for the three pointer APIs to ensure no crashes if created using a value > Int64.max

This reverts commit 8917eb0e5a.
2016-01-26 19:28:32 -08:00
Mark Lacey
8917eb0e5a Revert "[Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()"
This reverts commit 9798dfd4aa because it
broke the stdlib build.
2016-01-22 08:41:07 -08:00
Austin Zheng
9798dfd4aa [Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()
Jira: SR-88
Changes:
- Removed stdlib type conformances to _Reflectable
- Conformed stdlib types to CustomReflectable, CustomPlaygroundQuickLookable
- Rewrote dump() function to not use _reflect()
- CGRect, CGPoint, CGSize now conform to CustomDebugStringConvertible
- Rewrote unit tests for compatibility with new API
2016-01-21 09:44:15 -08:00
gregomni
e2dee6b9dd [stdlib] Switch keywords from 'typealias' to 'associatedtype' in stdlib
Fixes deprecation warnings arising from addition of new
‘associatedtype’ keyword in sr-511.
2016-01-14 09:39:15 -08:00
Arnold Schwaighofer
5c0568dd6e Remove @inline(never) hacks that were added for the lack of ARC across loops
After the recent improvements to the ARC optimizer these should not longer be
necessary and I did not measure negative performance impact from removing them.

rdar://24011261
2016-01-13 11:52:49 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Chris Lattner
66f7ef1295 Move stdlib off ++ and -- 2015-12-21 18:07:36 -08:00
zerotypos-found
0c1df3577e Fix typo: a --> an, an --> a. 2015-12-17 15:10:25 +09:00
Chris Lattner
e9a2e1e128 Eliminate all of the uses of ++/-- from stdlib/public/core.
At DaveA's suggestion, I took a mostly mechanical approach to this:
pointers and numeric types start using += 1, and indexes use
i = i.successor().  The index model is likely to be revised in
Swift 3 anyway, so micro-optimizing this code syntactically isn't
super important.

There is some performance concern of this patch, since some
in-place succesor operations are more efficient than
i = i.successor().  The one that seems particularly at issue is the
instance in the implementation of partition(), which I changed to
use i._successorInPlace().  If other instances lead to a perf issue,
they can be changed to use that as well.
2015-12-15 23:21:55 -08:00
Chris Lattner
566d6a1728 Merge pull request #479 from PatrickPijnappel/spelling-grammar
[stdlib] Fix spelling & grammar
2015-12-14 20:10:46 -08:00
Arnold Schwaighofer
391237b134 Use subscript get for all array like types
Given SR-219 and the fact that we can't hoist uniqueness checks in the current
form using a plain subscript getter is not worse.
2015-12-13 17:25:41 -08:00
Patrick Pijnappel
86e25e7e57 [stdlib] Fix word join grammar 2015-12-13 21:37:31 +11:00
Patrick Pijnappel
4aa89978d2 [stdlib] Fix typos 2015-12-13 21:35:53 +11:00
Arnold Schwaighofer
8f225da5ca Also use array semantics for the array element get function on non-objc systems
... and we hoist uniqueness checks for array on linux.

rdar://23865507
2015-12-11 17:15:15 -08:00
Arnold Schwaighofer
d5b3bfbd59 ArraySemantics: Add an api to replace a call to _getElement with a value
Also remove dependent calls to hoistableNativeTypeCheck() and checkSubscript()
calls. To find the guarding checkSubscript() call we introduce a return value to
checkSubscript that is used by the _getElement() call so that we can just follow
the use-def chain to find the dependence.
2015-12-08 07:34:25 -08:00
Arnold Schwaighofer
4b22a31154 ArraySemantics: Remove getArrayPropertyIsNative - we are only using
hoistableIsNativeTypeChecked these days.
2015-12-08 07:34:25 -08:00
Kanstantsin Linou
c9024ccc2c Fix typo in Arrays.swift.gyb
<code>accross</code> -> <code>across</code>
2015-12-08 17:39:28 +03:00
rajkumarpunchh
7a7efeb3cd Fixed Typo. “forumula” to “formula”. 2015-12-08 17:05:10 +05:30
Alfredo Delli Bovi
e437c4557c Fix typo in comments 2015-12-05 15:34:45 +01:00
Patrick
14fdf744b0 Make documented complexity consistent
Since most of the documentation in the code use O(`self.count`) instead of O(`count`), change the inconsistent code documentation to O(`self.count`).
2015-12-04 17:15:55 -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
David Farler
8f2fbdc93a Make function parameters and refutable patterns always immutable
All refutable patterns and function parameters marked with 'var'
is now an error.

- Using explicit 'let' keyword on function parameters causes a warning.
- Don't suggest making function parameters mutable
- Remove uses in the standard library
- Update tests

rdar://problem/23378003
2015-11-09 16:56:13 -08:00
Erik Eckstein
971a680199 Support for stack promotion of array buffers in the stdlib.
The basic idea is to move the allocation of the buffer out of @_semantics("array.uninitialized") so that it can be inlined without inlining the semantics function (on high-level SIL).

This change in the stdlib also requires an adaption of the dead area elimination in DeadObjectElimination.
Otherwise it would just remove the semantics function but not the allocation and we would leak memory.
2015-11-05 16:52:59 -08:00
Dave Abrahams
912a00cfad [stdlib] More Array Refactoring
w/Dmitri and Arnold, making incremental progress towards comprehensible
code.

Swift SVN r32716
2015-10-16 00:08:03 +00:00
Dave Abrahams
06e32293a4 [stdlib] Attempt to fix linux build
An Array's buffer is a ContiguousArrayBuffer on Linux.

Swift SVN r32323
2015-09-29 23:52:24 +00:00
Dave Abrahams
243b528fac [stdlib] Array refactoring: simplify all array subscript checking
Swift SVN r32314
2015-09-29 22:38:59 +00:00
Dave Abrahams
cfe877bc0a [stdlib] Array refactoring: s/hoistedIs/was/
Swift SVN r32312
2015-09-29 22:38:57 +00:00
Dave Abrahams
b1e98fe3e1 [stdlib] Array refactoring: s/NoTypeCheck/TypeChecked/
First in a long series of commits to clean up the array implementation
and make it maintainable by the stdlib team.

Swift SVN r32311
2015-09-29 22:38:56 +00:00
Dave Abrahams
5cf32911fb Array: Improve function, parameter names and add documentation
NFC.

Swift SVN r32310
2015-09-29 22:38:53 +00:00
Arnold Schwaighofer
599a438015 Don't force to grow the buffer everytime we make it unique
rdar://22873620

Swift SVN r32280
2015-09-28 20:47:23 +00:00
Dmitri Hrybenko
2ff89aa40e stdlib: fix comment on ArraySlice.startIndex
ArraySlice.startIndex is not necessarily zero anymore.

rdar://22633052

Swift SVN r31921
2015-09-14 05:40:14 +00:00
Arnold Schwaighofer
aeece6bc1f stdlib: DRY and disable inlining of code to curb code growth
This halves the code size of array append inlined into user code.

Swift SVN r31603
2015-09-01 16:45:05 +00:00
Arnold Schwaighofer
314e5d9378 stdlib: Remove dead code
Swift SVN r31602
2015-09-01 16:45:04 +00:00
Arnold Schwaighofer
55e4795972 stdlib: Fix formatting.
Swift SVN r31601
2015-09-01 16:45:04 +00:00
Arnold Schwaighofer
de90e57428 stdlib: Reformulate to make ARC's job easier
The extra control-flow seems to inhibit ARC and we end up with an extra
retain-release regressing LevenshteinDistance by 40%.

rdar://22479186

Swift SVN r31588
2015-08-31 18:02:12 +00:00
Arnold Schwaighofer
9fd52b9123 stdlib: Instead of calling reserveCapacity in Array.init(_uninitializedCount)
directly construct a buffer of the right size

This safes a uniqueness check and unecessary code bloat when inlining
reserveCapacity.

rdar://22446738

Swift SVN r31540
2015-08-27 20:07:07 +00:00
Dmitri Hrybenko
6360a590b5 Revert "Fix a problem where the legacy Mirror for ArraySlice would cause an out-of-bounds access if the slice is not zero-based"
This reverts commit r31398.  The commit does not have tests and
introduces code duplication.

Swift SVN r31408
2015-08-22 08:04:51 +00:00
Enrico Granata
fe27790126 Fix a problem where the legacy Mirror for ArraySlice would cause an out-of-bounds access if the slice is not zero-based
rdar://problem/22373053



Swift SVN r31398
2015-08-21 23:08:47 +00:00
Dmitri Hrybenko
d6f04ade75 stdlib: convert join() into a protocol extension
Part of rdar://22022419

Swift SVN r31186
2015-08-12 21:16:25 +00:00
Arnold Schwaighofer
afe39b3c1a Allow hoisting of uniqueness check in array.append
At -O I see about 10% improvement on Havlak, and 40% improvement on the recently
added array append benchmarks.

COWTree regresses by 15% because we hoist an append that is conditionally
executed. If we were to disallow hoisting of conditionally executed benchmarks
we would see big loses accross our benchmarks (for example, we would not hoist
out of nested loops anymore). So we will have to live with this regression.

rdar://17140639

Swift SVN r31120
2015-08-10 20:40:20 +00:00
David Farler
9f10b691e6 Reviewed: Containers should use debug description of their elements in both description and debugDescription
- Don't need CollectionOfOne.description
- Don't use private functions for shared internal functions for
  constructing descriptions

Swift SVN r31071
2015-08-07 08:52:35 +00:00