Commit Graph

5543 Commits

Author SHA1 Message Date
Nadav Rotem
7a49d7e334 [codesize] Keep _print_unlocked in the swift dylib.
We keep most of our printing code in the swift dylib but we missed
this method in our last refactoring.

Swift SVN r31508
2015-08-26 22:14:19 +00:00
Nadav Rotem
c96a127f6c [codesize] Force _dictionaryBridgeToObjectiveC to stay in the swift dylib.
Keeping this method in the swift dylib saves a few kilobytes for each
specialization of dictionary. This function is not on the critical
performance path and we don't gain much from pulling it and specializing
it in user code.

Swift SVN r31507
2015-08-26 22:14:18 +00:00
Nadav Rotem
b93256503a [codesize] Keep _assertionFailed in the swift dylib.
This commit annotates _assertionFailed with an attribute
that will keep in in the swift dylib. We don't care about
the performance of this function because it happens when
the program crashes. Keeping it in the swift dylib helps
in reducing the code size of the user app because it keeps
more of the printing and string.utf8 logic in the dylib.

Swift SVN r31506
2015-08-26 22:14:12 +00:00
Arnold Schwaighofer
502f1e3de1 stdlib: Move the darwin String implementation over to use the ICU library.
Reapply of 31474 with a fix in _compareCocoaBuffer to use the bufferSizeRhs
variable instead of bufferSizeLhs for the right hand side buffer.

We no longer create intermediate NSString copies to compare and hash swift
Strings. Instead we call directly into the ICU library.

I measured a 1.2 to 2x improvement on dictionary benchmarks as a result of this.
The SuperChars benchmark is also about 1.2x faster because of this.

Pure ASCII comparison has gotten a little bit slower (20% on a pure comparison
micro-benchmark) because we no longer do a memcmp. Doing a memcmp on ASCII is
not the same as the default unicode collation. Instead we have to a string scan.
The default unicode collation does not order like ASCII does and ignores
characters (for example the \0 character).

rdar://18992510

Swift SVN r31489
2015-08-26 15:14:18 +00:00
Arnold Schwaighofer
2d8f29e710 Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add back a test I removed"
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Move the darwin String implementation over to use the ICU library."

This reverts commit r31477, r31476, r31475, r31474.

Commit r31474 broke the ASAN build.

Swift SVN r31488
2015-08-26 13:09:03 +00:00
Chris Willmore
9c1f3e907a Revert "Transform EditorPlaceholderExpr into trap if executed in playground mode."
This reverts commit r31481, which apparently needed some parallel
changes to SourceKit and broke the build as a result.

Swift SVN r31483
2015-08-26 05:28:04 +00:00
Chris Willmore
0addd80bb3 Transform EditorPlaceholderExpr into trap if executed in playground mode.
Allow untyped placeholder to take arbitrary type, but default to Void.
Add _undefined<T>() function, which is like fatalError() but has
arbitrary return type. In playground mode, merely warn about outstanding
placeholders instead of erroring out, and transform placeholders into
calls to _undefined(). This way, code with outstanding placeholders will
only crash when it attempts to evaluate such placeholders.

<rdar://problem/21167372> transform EditorPlaceholderExpr into fatalError()

Swift SVN r31481
2015-08-26 04:50:55 +00:00
Arnold Schwaighofer
5a25a00d1f stdlib: Move the darwin String implementation over to use the ICU library.
We no longer create intermediate NSString copies to compare and hash swift
Strings. Instead we call directly into the ICU library.

I measured a 1.2 to 2x improvement on dictionary benchmarks as a result of this.
The SuperChars benchmark is also about 1.2x faster because of this.

Pure ASCII comparison has gotten a little bit slower (20% on a pure comparison
micro-benchmark) because we no longer do a memcmp. Doing a memcmp on ASCII is
not the same as the default unicode collation. Instead we have to a string scan.
The default unicode collation does not order like ASCII does and ignores
characters (for example the \0 character).

rdar://18992510

Swift SVN r31474
2015-08-26 03:36:59 +00:00
Arnold Schwaighofer
41119cb80b stdlib: Don't crash on strings that require a bigger buffer on normalization.
This is currently a linux only issue.

Swift SVN r31467
2015-08-26 02:00:19 +00:00
Dmitri Hrybenko
217ef5aa12 stdlib: fix legacy Mirror for ArraySlice
The mirror wasn't adjusted to account for non-zero-based indices of
ArraySlice.

rdar://problem/22373053

Swift SVN r31409
2015-08-22 08:04:58 +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
bb3b00a0e0 stdlib: work around type checker not being able to deduce
RandomAccessIndexType.Distance

Fixes rdar://22373461, works around rdar://22381498

Swift SVN r31384
2015-08-21 18:18:23 +00:00
Dmitri Hrybenko
779444eec3 stdlib: rewrite the comment on CustomPlaygroundQuickLookable
It used to refer to Mirror and other related concepts, while it should
be refering to PlaygroundQuickLook.

rdar://21012615

Swift SVN r31374
2015-08-21 01:37:10 +00:00
Dmitri Hrybenko
951e65116d stdlib: document that unsafe pointers should be suitably aligned
rdar://21880864

Swift SVN r31373
2015-08-21 01:24:31 +00:00
Dmitri Hrybenko
f6e23d42cf stdlib: fix a bug in Character._SmallUTF8
8-byte UTF-8 sequences were throwing _SmallUTF8 into an infinite loop.

rdar://21005978

Swift SVN r31368
2015-08-20 21:49:36 +00:00
Dmitri Hrybenko
14466151eb stdlib: rename ImplicitlyUnwrappedOptional's parameter to Wrapped
We renamed the parameter of Optional, but missed
ImplicitlyUnwrappedOptional.

rdar://22332469

Swift SVN r31315
2015-08-18 22:33:10 +00:00
Dmitri Hrybenko
8311c05461 stdlib: add a default implementation for MutableCollection.subscript().set
rdar://20722366

Swift SVN r31241
2015-08-14 03:12:23 +00:00
David Farler
83a2b5cecd Provide renamed fixit for Optional.T -> Optional.Wrapped
rdar://problem/22281537

Swift SVN r31240
2015-08-14 02:18:31 +00:00
Chris Willmore
51f08e0285 Add FileReference object literals and _FileReferenceLiteralConvertible protocol.
<rdar://problem/21781451> Add file literal to Swift

Swift SVN r31232
2015-08-13 22:38:55 +00:00
Chris Willmore
e4ff8fdc05 Make image literals non-optional by routing delegation of non-failable
literal initializer to underlying failable initializer through
implicitly-failable initializer (proper solution is covered in
22276505).

<rdar://problem/20788137> Image literals should not be optional

Swift SVN r31229
2015-08-13 22:11:47 +00:00
Dmitri Hrybenko
33631ca9c4 stdlib: Fix a bug in split()
split() used to drop the tail of the sequence under certain
circumstances.

rdar://22200821

Swift SVN r31207
2015-08-13 05:31:07 +00:00
Dmitri Hrybenko
4efa7f4372 stdlib: fix the docs to refer to the actual parameter name
Swift SVN r31205
2015-08-13 04:59:16 +00:00
Dmitri Hrybenko
ee20926b20 stdlib: rename join() to joinWithSeparator()
rdar://22022419, rdar://21474222

Swift SVN r31188
2015-08-12 21:16:38 +00:00
Dmitri Hrybenko
22b15bda60 stdlib: loosen the type signature of join()
rdar://17696054

Swift SVN r31187
2015-08-12 21:16:35 +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
Dave Abrahams
713ae47caf [stdlib] Explicitly document how to print without trailing newline.
Swift SVN r31181
2015-08-12 18:46:43 +00:00
Joe Pamer
10afd159e4 Following up on r31169, take Jordan's CR feedback and uncomment the two currently disabled migration aid overloads for 'print'.
Swift SVN r31176
2015-08-12 18:10:35 +00:00
Joe Pamer
cd492d96b5 Fix a type checker crash when the object type of a ForceValueExpr is an 'Any'.
This allows us to remove the workaround generic overloads for "print" without sacrificing good diagnostics for its unavailable overloads. (rdar://problem/21499048, rdar://problem/21582758, rdar://problem/22126141)

Swift SVN r31169
2015-08-12 15:59:31 +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
David Farler
5091dc244d Really fix the Optional map/flatMap mismerge
Swift SVN r31070
2015-08-07 08:20:27 +00:00
David Farler
697d0dbd4f Build fix: mismerge in Optional.swift
Swift SVN r31069
2015-08-07 07:10:45 +00:00
David Farler
4848235c7f Rename Optional type parameter from 'T' to 'Wrapped'.
rdar://problem/21970065

Swift SVN r31068
2015-08-07 06:17:20 +00:00
David Farler
9aa7663ad3 Always debugPrint containers' elements
rdar://problem/19312992

Swift SVN r31067
2015-08-07 06:14:19 +00:00
Dmitri Hrybenko
255d2229c7 stdlib: remove erroneous @warn_unused_result annotations
Swift SVN r31050
2015-08-06 15:54:47 +00:00
Dmitri Hrybenko
dd3194a18c stdlib: adopt @warn_unused_result
rdar://20957486

Swift SVN r31048
2015-08-06 14:53:18 +00:00
Dave Abrahams
f59279dc31 [stdlib] Fix a couple of availability message
Swift SVN r31025
2015-08-05 20:02:34 +00:00
Dmitri Hrybenko
827224f146 stdlib: clarify the behavior of sequences and for loops
This is not a new rule, this is just a consequence (although a
non-trivial one) of existing rules.

Swift SVN r31024
2015-08-05 19:06:10 +00:00
Arnold Schwaighofer
e0d069a0e0 stdlib: Call _print_unlocked directly in String.init
Then we can get rid of the specialized print function.

Swift SVN r31022
2015-08-05 14:44:13 +00:00
Jordan Rose
54cca1a2fa Restore fully-general signature for IntervalType.overlaps.
rdar://problem/22085137

Swift SVN r31010
2015-08-04 21:57:03 +00:00
David Farler
8eec4b6e13 RangeReplaceable: document and enforce count >= n for removeFirst(n)
Swift SVN r31001
2015-08-04 19:41:14 +00:00
Arnold Schwaighofer
9c77c05696 stdlib: Call a private specialized version in String.init
The print abi changed so that there is no longer a way to print one item to a
stream without going through a vararg array. We call the print function in a
String initializer (e.g for string interpolation) incurring unnecessary
overhead. Use an internal specialized version of print instead.

rdar://22133281

Swift SVN r31000
2015-08-04 19:19:50 +00:00
Arnold Schwaighofer
8c112d1fea stdlib: Always inline the _UnsafePartiallyInitializedContiguousArrayBuffer builder functions
For performance reasons.

This should now truly have recovered PrimeNum's performance at -O.

rdar://22126579

Swift SVN r30988
2015-08-04 07:49:40 +00:00
David Farler
313a4c93c6 Review: Index protocol extensions
- Add Strict/Defaulted Index types to StdlibUnittest
- Test whether a random access index calls its more efficient
  customization by tracking successor calls.
- Fix the RandomAccessIndex.advancedBy(n, limit:) API by de-underscoring
  the limit parameter
- Inline some internal transparent default implementations to their only
  call site
- Attach _RandomAccessAmbiguity type to RandomAccessIndex

rdar://problem/22085119

Swift SVN r30979
2015-08-04 03:13:14 +00:00
Jordan Rose
03e3dc2e2d stdlib: Workaround for IntervalType.overlaps to avoid a SIL parser error.
The parse_stdlib tests choke on the constraints that were there previously,
so weaken the API to only work on intervals of the same type for now.

rdar://problem/22126470

Swift SVN r30977
2015-08-04 02:10:49 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Jordan Rose
c5bc10a597 stdlib: Update a comment I missed on Strideable.
Swift SVN r30975
2015-08-04 01:34:38 +00:00
Jordan Rose
83e2e0bbb2 Move the 'stride' family into methods on Strideable.
Part of the Protocol Extensions TLF.

rdar://problem/22085144

Swift SVN r30974
2015-08-04 01:32:41 +00:00
Jordan Rose
1ee08fe92a stdlib: Move 'overlaps' into a method on IntervalType.
Part of the Protocol Extensions TLF.

rdar://problem/22085137

Swift SVN r30973
2015-08-04 01:32:36 +00:00