Commit Graph

67 Commits

Author SHA1 Message Date
Dave Abrahams
7f0439b90a [stdlib] Disable one more mixed-sign case
Also update release notes

Swift SVN r22403
2014-09-30 21:25:03 +00:00
Dave Abrahams
41359fb128 [stdlib] Disallow mixed-sign arithmetic
It was unintentionally possible to add an Int to any
UnsignedIntegerType.  Use an intentional ambiguity to prevent that at
compile-time.

Swift SVN r22402
2014-09-30 20:21:01 +00:00
Erik Eckstein
a4c7d89671 fix coding style in stdlib: move non-attribute keywords in same line as function declaration
Swift SVN r22275
2014-09-25 08:43:55 +00:00
Dave Abrahams
d1b6dfa48f [stdlib] pick off more public non-protocol docs
137 undocumented public non-operator APIs remain in core

Swift SVN r22253
2014-09-24 03:58:14 +00:00
Dave Abrahams
795799b0d2 [stdlib] Propagate Hashable docs
202 undocumented public non-operator APIs remain in core

Swift SVN r22241
2014-09-23 23:35:58 +00:00
Dave Abrahams
24fe53ed6c [stdlib] Propagate OutputStream docs
240 undocumented public non-operator APIs remain in core

Note: previous estimates were wrong because my regex was broken.  The
previous commit, for example, had 260 undocumented APIs.

Swift SVN r22234
2014-09-23 22:01:49 +00:00
Dave Abrahams
ea47b64bcc [stdlib] Propagate IntegerArithmeticType docs
184 undocumented public non-operator APIs remain in core

Swift SVN r22227
2014-09-23 20:16:36 +00:00
Dave Abrahams
3f4e7f5bc8 [stdlib] Propagate RandomAccessIndexType docs
190 undocumented non-operator public APIs remain in core

Swift SVN r22226
2014-09-23 19:43:36 +00:00
Dave Abrahams
218d25eb5a [stdlib] Propagate BidirectionalIndexType docs
193 undocumented public non-operator APIs remain in core

Swift SVN r22225
2014-09-23 19:35:31 +00:00
Dave Abrahams
9623c52879 [stdlib] Misc protocol comment propagation
197 undocumented non-operator public APIs remain in core

Swift SVN r22224
2014-09-23 19:35:29 +00:00
Dave Abrahams
c38e3201b2 [stdlib] Propagate ForwardIndexType docs to models
200 undocumented public APIs remain in core

Swift SVN r22222
2014-09-23 19:20:48 +00:00
Dave Abrahams
649c35fab3 [stdlib] Propagate integer protocol docs to models
219 undocumented public APIs remain in core

Swift SVN r22219
2014-09-23 18:44:59 +00:00
Dave Abrahams
7c9ebaa19f [stdlib] Propagate LiteralConvertible docs
219 undocumented public APIs remain in core

Swift SVN r22213
2014-09-23 11:12:39 +00:00
Dmitri Hrybenko
4f735794e1 stdlib: add a radar reference to a fixme
Swift SVN r22073
2014-09-18 14:11:06 +00:00
Dmitri Hrybenko
b095339da7 stdlib/Array: implement delayed bridging
rdar://18191358

Swift SVN r22071
2014-09-18 13:46:39 +00:00
Dave Abrahams
33bebac909 [stdlib] Boilerplate doc-comment wording change
Swift SVN r22042
2014-09-17 21:19:24 +00:00
Dave Abrahams
a134fdeaed [stdlib] doc-comment integer protocols
Swift SVN r21993
2014-09-16 22:45:57 +00:00
Dmitri Hrybenko
fad578b304 stdlib: remove ArrayBonudType
Swift SVN r21991
2014-09-16 22:42:33 +00:00
Dave Abrahams
b05f2528f5 [stdlib] Drop redundant factory func requirement
All the integers already have an init() that will narrow from Max[U]Int.
This change is consistent with our general move from factories to
initializers.

Swift SVN r21988
2014-09-16 22:41:19 +00:00
Doug Gregor
4dca192b18 Switch IntegerLiteralConvertible over to initializers.
Swift SVN r21986
2014-09-16 21:59:15 +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
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
61ef07732f stdlib/FixedPoint: add IntXX(truncatingBitPattern:) initializers
rdar://18101336


Swift SVN r21481
2014-08-27 10:04:33 +00:00
Dmitri Hrybenko
203cbaa5df stdlib: remove unused GYB code
Swift SVN r21437
2014-08-25 14:46:14 +00:00
Dmitri Hrybenko
7c943d5377 stdlib: remove migration aids for IntXX.asSigned(), IntXX.asUnsigned()
Swift SVN r21436
2014-08-25 14:02:36 +00:00
Dave Abrahams
4b2ccff3a4 [stdlib] Replace assert(false) with compile error
Unsupported architectures will cause a failure to compile rather than
some kind of runtime trap.  In particular, assert() should never be used
in the standard library; we have _sanityCheck for that purpose.

Swift SVN r21373
2014-08-21 21:06:20 +00:00
Dmitri Hrybenko
c17b692e20 stdlib: pull out information about integer types into a reusable file
Swift SVN r20750
2014-07-30 10:16:47 +00:00
Dave Abrahams
92637e786b [stdlib] Integer index operations don't overflow
When an integer type T is used as an Index, there are always
bounds---more restrictive than the full range of T---against which we're
not able to check.  Overflows are not useful indicators of precondition
violations in this context.  Therefore, use masked arithmetic for
RandomAccessIndex conformance.

Performance changes of magnitude >= 5% are below.  Someone might want to
investigate why Fibonacci got 21% faster in -Ounchecked, since nothing
in this change should have removed checks from that build.  (That test
does seem particularly sensitive; see also <rdar://problem/17815767>
Adding three overloads to stdlib slows Fibonacci by 18-19%)

Fixes <rdar://problem/17780469> Integer ranges shouldn't use overflowing adds

====================`PrecommitBench_O`====================
````benchmark`|`baserun0`|`baserun1`|`optrun0`|`optrun1`|``delta`|`speedup`
````Ackermann`|``1428.00`|``1466.00`|`1661.00`|`1657.00`|`229.00`|``-13.8%`
`````ForLoops`|``2021.00`|``1986.00`|`1249.00`|`1255.00`|`737.00`|```59.0%`
`````````Hash`|``1038.00`|```979.00`|``898.00`|``922.00`|``81.00`|````9.0%`
`````````Life`|````63.00`|````63.00`|```60.00`|```61.00`|```3.00`|````5.0%`
```````Memset`|````55.00`|````54.00`|```42.00`|```42.00`|``12.00`|```28.6%`
``MonteCarloE`|``1243.00`|``1265.00`|``885.00`|``880.00`|`363.00`|```41.3%`
`MonteCarloPi`|```994.00`|``1004.00`|``613.00`|``605.00`|`389.00`|```64.3%`
````````NBody`|````45.00`|````45.00`|```42.00`|```43.00`|```3.00`|````7.1%`
````QuickSort`|```105.00`|```103.00`|```83.00`|```83.00`|``20.00`|```24.1%`
````R17315246`|``1080.00`|``1080.00`|``805.00`|``808.00`|`275.00`|```34.2%`
``````SmallPT`|``1008.00`|``1007.00`|``789.00`|``795.00`|`218.00`|```27.6%`
````````Walsh`|```136.00`|```136.00`|``129.00`|``130.00`|```7.00`|````5.4%`
====================`PrecommitBench_Ounchecked`====================
````benchmark`|`baserun0`|`baserun1`|`optrun0`|`optrun1`|``delta`|`speedup`
``Dictionary3`|``1060.00`|``1039.00`|``982.00`|`1029.00`|``57.00`|````5.8%`
````Fibonacci`|```842.00`|```848.00`|``694.00`|``694.00`|`148.00`|```21.3%`
```StringWalk`|```945.00`|```924.00`|``989.00`|``995.00`|``65.00`|```-6.6%`
====================`PrecommitBench_Onone`====================
````benchmark`|`baserun0`|`baserun1`|`optrun0`|`optrun1`|``delta`|`speedup`
`EditDistance`|``2086.00`|``1981.00`|`1492.00`|`1622.00`|`489.00`|```32.8%`
`````````Life`|``1256.00`|``1216.00`|`1110.00`|`1142.00`|`106.00`|````9.5%`
```````MatMul`|``1210.00`|``1245.00`|``705.00`|``705.00`|`505.00`|```71.6%`
````R17315246`|```205.00`|```209.00`|``195.00`|``200.00`|``10.00`|````5.1%`

Swift SVN r20576
2014-07-25 23:37:01 +00:00
Ben Langmuir
6742613a19 Swap an em dash for -- in a comment to satisfy the sourcekit tests
We're checking for ascii-only comments in the stdlib.  It kind of sucks
that we can't have nice things.

Swift SVN r20493
2014-07-24 16:00:04 +00:00
Dave Abrahams
a792eb68a4 [stdlib] release notes, @availability attributes
Swift SVN r20488
2014-07-24 13:17:39 +00:00
Dmitri Hrybenko
d0369e650b stdlib: mark init(bitPattern:) @transparent, this should be a free abstraction
Swift SVN r20482
2014-07-24 08:26:26 +00:00
Dmitri Hrybenko
2d27594d4e stdlib: clarify the comment: "same value" -> "same numeric value"
Can not say "may not compare equal" because there is no mixed-type overload of ==.


Swift SVN r20481
2014-07-24 08:24:27 +00:00
Dave Abrahams
993c7e0bae [stdlib] Replace .toSigned()/.toUnsigned() methods
...because their semantics were unclear.  The new idiom is explicit
construction of the target type using the "bitPattern:" argument label:

    myInt.toUnsigned() => UInt(bitPattern: myInt)

Fixes <rdar://problem/17000821>

Swift SVN r20479
2014-07-24 08:07:07 +00:00
Mark Lacey
c69ea64c0d Add specializations of prefix/postfix increment/decrement for integer types.
A few benchmarks in PreCommitBench improve at Onone (typically by a few
percent but for StringWalk it is 10%).

Swift SVN r20468
2014-07-24 05:10:12 +00:00
Dmitri Hrybenko
d14f17beef Change 'getLogicValue()' into a property 'boolValue'; change
'getArrayBoundValue()' into a property 'arrayBoundValue'.

rdar://17156123


Swift SVN r20304
2014-07-22 12:08:10 +00:00
Chris Lattner
e0b0205cd7 Remove the @assignment attribute entirely. It doesn't do anything except
enforce its own little constraints.  The type checker isn't using it for
anything, and it is just clutter.

This resolves <rdar://problem/16656024> Remove @assignment from operator implementations



Swift SVN r19960
2014-07-14 22:44:25 +00:00
Chris Lattner
8991456ff2 Switch infix/postfix/prefix to be declaration modifiers instead of attributes,
eliminating the @'s from them when used on func's.  This is progress towards
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword

This also consolidates rejection of custom operator definitions into one
place and makes it consistent, and adds postfix "?" to the list of rejected
operators.

This also changes the demangler to demangle weak/inout/postfix and related things
without the @.



Swift SVN r19929
2014-07-14 15:51:49 +00:00
Dmitri Hrybenko
b53ed944b0 stdlib: replace masking arithmetic with less complex code
Swift SVN r19899
2014-07-13 15:42:51 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Nadav Rotem
bb3ad55201 Document the use of the non overflowing arithmetic when multiplying sizeof() by 8.
Swift SVN r19856
2014-07-11 18:35:23 +00:00
Nadav Rotem
f4a470979b Use unsafe arithmetic for basic sizeof and alignof calculations.
Swift SVN r19838
2014-07-11 00:03:57 +00:00
Dave Abrahams
b56c3a84d3 [stdlib] Drop Sliceable conformance for Range<T>
Sliceable is a totally non-critical protocol and Range slicing wasn't
even being tested.  Along with r19771, fixes <rdar://problem/16363898>

Swift SVN r19775
2014-07-10 02:08:46 +00:00
Dave Abrahams
58f94698c3 [stdlib] Disallow indexing integer ranges with Int
This horrible hack prevents the user from indexing Range<I>, for all
integer types I, outside of a generic context.  This seems to be the
best we can do to prevent confusion given the current language.

Addresses <rdar://problem/16363898>

Unfortunately, I can't make this work for slicing ranges yet.

Swift SVN r19771
2014-07-10 01:20:57 +00:00
Jordan Rose
da29f099f0 Update stdlib for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19672
2014-07-08 02:17:46 +00:00
Chris Lattner
7dae30f755 rename the integer 'modulus' methods to 'remainder' methods.
Swift SVN r19433
2014-07-01 22:36:54 +00:00
Jordan Rose
748efed913 [Accessibility] Protocol witnesses must be as accessible as the protocol.
...unless the type has less accessibility than the protocol, in which case
they must be as accessible as the type.

This restriction applies even with access control checking disabled, but
shouldn't affect any decls not already marked with access control modifiers.

Swift SVN r19382
2014-06-30 23:38:35 +00:00
Dave Abrahams
8e7d45f2c0 [stdlib] Normalize .gyb files
- Follow LLVM conventions for emacs mode specification

- Use local variables suffix to make the output read-only (at least on
  Emacs)

- But drop the admonitions not to edit the generated files;
  line-directive mostly takes care of that problem now.

Swift SVN r19381
2014-06-30 23:24:17 +00:00