Commit Graph

1309 Commits

Author SHA1 Message Date
Dmitri Hrybenko
df82379a65 stdlib/Array: add bounds checks in NSSwiftArray.getObjects()
rdar://18320164

Swift SVN r21943
2014-09-15 15:26:49 +00:00
Dmitri Hrybenko
cdbd3bae84 stdlib/Dictionary: remove workaround that is no longer needed
Swift SVN r21942
2014-09-15 14:08:56 +00:00
Dmitri Hrybenko
50d497c05f stdlib/Array: fix an issue in fast enumeration
Array did not initialize fast enumeration state if it was empty.
Surprisingly, this did not break code that is generated by Clang
currently.  (But as far as I understand fast enumeration, it may abort
the program because mutation pointer is null.)

Swift SVN r21940
2014-09-15 13:49:56 +00:00
Dmitri Hrybenko
4a1dfdb6ad stdlib/Array: remove default parameters in bridging routines, and
reorder function declarations

Swift SVN r21938
2014-09-15 07:08:09 +00:00
Dmitri Hrybenko
001db58bb1 stdlib: remove trailing whitespace and fix coding style
Swift SVN r21906
2014-09-12 13:23:21 +00:00
Dmitri Hrybenko
d7acb06c64 stdlib/Dictionary: use 'delayed bridging' to keep pointers, returned
from a bridged NSDictionary, stable

We used to return a fresh pointer value every time an NSDictionary
element is requested, but, unfortunately, our SDK has bugs.

Fixes rdar://18191358 for Dictionary.

Swift SVN r21905
2014-09-12 13:20:30 +00:00
Joe Groff
8338e69c86 Actually set up the 'rawValue' argument label on derived enum initializers.
Somehow, protocol conformance checking didn't actually care that this was missing...

Swift SVN r21898
2014-09-12 01:29:51 +00:00
Dave Abrahams
213f59e546 [stdlib] doc-comment Arrays.swift.gyb
Swift SVN r21897
2014-09-12 00:35:09 +00:00
Dave Abrahams
8ec2b299f3 [stdlib] Algorithm.swift: doc-comment public API
Swift SVN r21890
2014-09-11 20:20:19 +00:00
Joe Groff
491e47cb83 Rename RawRepresentable.raw -> rawValue.
Per API review with Ali. While we're here, give the initializer a corresponding 'rawValue' argument label, and change the associated type name to RawValue to match.

Swift SVN r21888
2014-09-11 20:13:47 +00:00
Dave Abrahams
107dca088c [stdlib] Separate Sequence type for enumerate
Avoids surprise in case someone makes a generator with reference
semantics

Swift SVN r21886
2014-09-11 19:57:20 +00:00
Dave Abrahams
1e9e7734f0 Revert "[stdlib] any/all algorithms, keyword for contains"
This reverts r21810 and r21811 due to lack of design consensus

Swift SVN r21880
2014-09-11 17:42:32 +00:00
Dmitri Hrybenko
d68a5c4c98 stdlib: finish implementation of atomics for initializing an ARC
reference, add tests

Swift SVN r21873
2014-09-11 14:52:58 +00:00
Dmitri Hrybenko
a61e4c205a stdlib: document that sort() is not a stable sort
Swift SVN r21870
2014-09-11 10:59:50 +00:00
Dmitri Hrybenko
5000a983a6 stdlib/Unmanaged: change the precondition for non-null pointer to a
debug precondition

Swift SVN r21869
2014-09-11 08:52:55 +00:00
Dave Abrahams
904e0c4203 [stdlib] Fix sorted()
Remove the overload for MutableCollectionType and make it return a
regular Array, as the comment said.  Together with r21829 this fixes
<rdar://problem/18286522>

Swift SVN r21844
2014-09-10 19:05:12 +00:00
Dmitri Hrybenko
b68d147ca1 stdlib/Unmanaged: trap when attempting to create an Unmanaged from a
null pointer

Swift SVN r21838
2014-09-10 14:15:06 +00:00
Dmitri Hrybenko
4b19606551 stdlib: fix definition of atomics for 32-bit platforms
Swift SVN r21837
2014-09-10 13:05:14 +00:00
Dmitri Hrybenko
96d00d70b5 StdlibUnittest: add infrastructure for race tests (see examples)
This will be used to test rdar://18191358

Swift SVN r21836
2014-09-10 11:58:45 +00:00
Dmitri Hrybenko
1bac1e6855 stdlib/Dictionary: convert some 'var's to 'let's
Swift SVN r21835
2014-09-10 11:38:44 +00:00
Dmitri Hrybenko
57983579ac stdlib: move declarations of runtime entry points for atomics to
Runtime.swift.gyb

Swift SVN r21832
2014-09-10 08:07:45 +00:00
Dave Abrahams
09793716cb [stdlib] try to measure sequences before array-izing
When creating an array from a SequenceType not statically known to be a
CollectionType, don't neglect to pre-allocate based on its
underestimated count.

Swift SVN r21829
2014-09-10 03:21:14 +00:00
Dave Abrahams
c467825bc2 [stdlib] any/all algorithms, keyword for contains
Expose any, all on Array and all the Lazy sequence adapters.  Make the
'contains' algorithm that takes a predecate unavailable in favor of
'any', which does the same thing.

Fixes <rdar://problem/18190149> [algorithm] `contains` syntax is ambiguous

Swift SVN r21810
2014-09-09 20:39:39 +00:00
Dave Abrahams
69075bc61d [stdlib] Kill unintended argument label
Fixes <rdar://problem/18232095> Remove mandatory keyword from generic String init

Swift SVN r21801
2014-09-09 03:50:40 +00:00
Dmitri Hrybenko
6a85dc4c0f stdlib: fix strange indentation
Swift SVN r21769
2014-09-08 08:33:37 +00:00
Joe Groff
419ba5cbea Change RawRepresentable to use failable initializers and property requirements.
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832

Swift SVN r21762
2014-09-06 18:40:14 +00:00
Dmitri Hrybenko
7d51b2b7fe stdlib: improve comment for sorted() overload with predicate and reduce
comment duplication with gyb code

Swift SVN r21742
2014-09-05 15:27:25 +00:00
Michael Gottesman
e8df864581 [stdlib] Change _fixLifetime<T> to use Builtin.fixLifetime now that we lower fix_lifetime to swift_keepAlive in IRGen.
Also remove the old swift_keepAlive and rename swift_keepAlive2 => swift_fixLifetime.

rdar://16464507

Swift SVN r21723
2014-09-04 22:58:37 +00:00
Dmitri Hrybenko
149d3aaa8f stdlib: docs: sort() is not a stable sort
rdar://17570356


Swift SVN r21703
2014-09-04 11:27:53 +00:00
Dave Abrahams
c16987cc8b [stdlib] Add/use unsafeDowncast
now that <rdar://problem/18184883> is fixed, this factoring can be done

Swift SVN r21647
2014-09-02 17:26:03 +00:00
Dave Abrahams
27809a507a [stdlib] Don't @asmname POSIX APIs
For reasons not entirely clear yet, this can cause problems in the
compiler when some modules bring in the same names via the Darwin
module (see <rdar://problem/18184795>).  Use SwiftShims instead.

Swift SVN r21646
2014-09-02 17:26:03 +00:00
Dmitri Hrybenko
4139fe129e stdlib: underscore-prefix private type Character.SmallUTF16
Swift SVN r21640
2014-09-02 14:26:51 +00:00
Dmitri Hrybenko
51a8becf1c stdlib/String: strength-reduce some String methods: prefer StringCore.append
over String.extend

Performance testsuite changes over 2% are as follows.  A lot of tests unrelated
to String have been affected because of measurement noise and because strings
are used in result verification.

                 Ary3     4.8%
          CaptureProp    10.3%
           Dictionary    -4.0%
         EditDistance     2.8%
               Forest    -4.0%
                 Hash     8.6%
        InsertionSort     6.7%
                 Life    -2.3%
               MatMul     2.6%
           NestedLoop     3.9%
        PopFrontArray     2.9%
             PrimeNum     3.6%
                Prims     2.2%
              SmallPT    -2.1%
               TwoSum     4.1%

Swift SVN r21629
2014-09-01 14:30:41 +00:00
Erik Eckstein
962a50160a stdlib: Optimize convertion from array literal for Array
Replaced the general implementation (which works for all array types) to the obvious and trivial implementation for Array.
This speeds up array literal initialization by about 2x.



Swift SVN r21626
2014-09-01 08:21:13 +00:00
Dave Abrahams
42a2f263fd [stdlib] Add/use unsafeAddressOf
Turning a class into an UnsafePointer should be available to users, and
both safer and more optimizable than using unsafeBitCast.

Swift SVN r21593
2014-08-29 22:33:13 +00:00
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
cf1d5722a9 stdlib/FixedPoint: precondition for shifts: use a SIL-compile-time
constant instead of an expression that will be folded only by LLVM

Swift SVN r21576
2014-08-29 15:10:05 +00:00
Dmitri Hrybenko
4ecfc2b244 stdlib/FixedPoint: fix strange indentation
Swift SVN r21574
2014-08-29 15:09:59 +00:00
Dmitri Hrybenko
cb9e5c2c86 stdlib: use simpler interface to iterate over integer types
Swift SVN r21573
2014-08-29 14:32:46 +00:00
Dmitri Hrybenko
c5181c2d65 stdlib/FixedPoint: fix hash computation for [U]Int64 on 32-bit platforms
It used to trap if the value of [U]Int64 was outside the Int32 range.

rdar://18113807

Swift SVN r21572
2014-08-29 13:48:32 +00:00
Dmitri Hrybenko
14899abdf5 stdlib/FixedPoint: define the same set of 'truncatingBitPattern'
initializers on all platforms

rdar://18167806

Swift SVN r21570
2014-08-29 10:32:33 +00:00
Dmitri Hrybenko
985def47c9 stdlib: improve performance of string appending
CaptureProp ,  -21.8%
             HeapSort ,   12.7%
            ImageProc ,  -25.6%
               StrCat ,   92.6%
       StrComplexWalk ,   11.1%
             StrToInt ,   16.6%
  StringInterpolation ,   21.6%

Regression in CaptureProp is due to some interference of the harness.  When the
code is extracted into a separate file, there is no difference.

Regression in ImageProc is caused by unconditional construction of a string for
CheckResults()

rdar://18119872

Swift SVN r21535
2014-08-28 16:48:39 +00:00
Dmitri Hrybenko
4acc8a3e4b stdlib: remove redundant parens
Swift SVN r21529
2014-08-28 14:10:07 +00:00
Roman Levenstein
97014172b7 [sil-combine] String literal concatenation optimization. Constant-fold concatenation of string literals known at compile-time.
Addresses rdar://17033696.

Swift SVN r21526
2014-08-28 11:33:21 +00:00
Dmitri Hrybenko
8e4c76f4f6 stdlib/StringBuffer: update doc comment
Swift SVN r21523
2014-08-28 10:03:02 +00:00
Dave Abrahams
a45cb59747 [stdlib] Eliminate some gratuitous @objc labels
Swift SVN r21511
2014-08-28 02:03:31 +00:00
Dave Abrahams
18dac28aea [stdlib] Eliminate HeapBufferStorageBase
It's just needless complexity

Swift SVN r21508
2014-08-28 01:41:43 +00:00
Dave Abrahams
082c396cfe [stdlib] String.replaceRange: fix value semantics
Fixes <rdar://problem/18114265> Swift Compiler Optimizations for Strings causing incorrect behaviour

Swift SVN r21487
2014-08-27 19:24:55 +00:00
Dmitri Hrybenko
61ef07732f stdlib/FixedPoint: add IntXX(truncatingBitPattern:) initializers
rdar://18101336


Swift SVN r21481
2014-08-27 10:04:33 +00:00
Dave Abrahams
349e730c07 [stdlib] Add a missing mode string in a .gyb file
Swift SVN r21462
2014-08-26 19:59:04 +00:00