Commit Graph

53 Commits

Author SHA1 Message Date
Dimitris Apostolou
d84048e555 Fix typos 2019-02-11 08:33:47 +02:00
John Eismeier
09452396cc Propose fixing some typos 2018-02-15 14:37:51 -05:00
Roman Levenstein
956c556cb6 [docs] Add the description of @_semantics("optimize.sil.specialize.generic.partial.never") and the new @_specialized syntax 2017-06-03 11:15:21 -07:00
Dave Abrahams
8e1c7bde19 Revert "[docs] Add the description of @_semantics("optimize.sil.specialize.generic.partial.never") and the new @_specialized syntax" 2017-06-02 13:41:36 -07:00
Roman Levenstein
99077692ea [docs] Add the description of @_semantics("optimize.sil.specialize.generic.partial.never") and the new @_specialized syntax 2017-06-02 12:21:08 -07:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
Joe
622c86bbcf [SE-0095] Converted the docs to new composition syntax 2016-07-19 12:01:37 -07:00
Vijaya Prakash Kandel
f892bc4331 Typo corrected
Corrected typo in the documentation for implementation which means implements.
2016-06-28 00:03:36 +02:00
hitstergtd
1ccca9d0f0 [gardening] Properly capitalise 'swift' to 'Swift' 2016-04-17 20:53:48 +01:00
Hitster GTD
d95921e5a8 [doc] Fix broken links, permanent redirects and Rust-related inconsistencies (#2220)
* Fix almost every broken link and perm redirect

- Fix Xref from OptimizationTips.rst to Specialization section in Generics.rst
to use Sphinx syntax instead of a direct link to GitHub
- Fix over 12 broken links and permanent redirects

* Fix Rust related inconsistencies and broken links

- Update to reflect Rust does not have three types of pointers anymore
- Replace broken links to deprecated Rust documentation with alternatives,
comparable references in new Rust documentation
2016-04-17 20:52:29 +02:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Andrew Trick
c38adb500e [docs] Update optimization tips considering the presence of @_specialize. 2016-03-28 15:38:33 -07:00
Andrew Trick
482b264afc Reapply "Merge pull request #1725 from atrick/specialize"
This was mistakenly reverted in an attempt to fix buildbots.
Unfortunately it's now smashed into one commit.

---
Introduce @_specialize(<type list>) internal attribute.

This attribute can be attached to generic functions. The attribute's
arguments must be a list of concrete types to be substituted in the
function's generic signature. Any number of specializations may be
associated with a generic function.

This attribute provides a hint to the compiler. At -O, the compiler
will generate the specified specializations and emit calls to the
specialized code in the original generic function guarded by type
checks.

The current attribute is designed to be an internal tool for
performance experimentation. It does not affect the language or
API. This work may be extended in the future to add user-visible
attributes that do provide API guarantees and/or direct dispatch to
specialized code.

This attribute works on any generic function: a freestanding function
with generic type parameters, a nongeneric method declared in a
generic class, a generic method in a nongeneric class or a generic
method in a generic class. A function's generic signature is a
concatenation of the generic context and the function's own generic
type parameters.

e.g.

struct S<T> {
var x: T
@_specialize(Int, Float)
mutating func exchangeSecond<U>(u: U, _ t: T) -> (U, T) {
x = t
return (u, x)
}
}
// Substitutes: <T, U> with <Int, Float> producing:
// S<Int>::exchangeSecond<Float>(u: Float, t: Int) -> (Float, Int)

---
[SILOptimizer] Introduce an eager-specializer pass.

This pass finds generic functions with @_specialized attributes and
generates specialized code for the attribute's concrete types. It
inserts type checks and guarded dispatch at the beginning of the
generic function for each specialization. Since we don't currently
expose this attribute as API and don't specialize vtables and witness
tables yet, the only way to reach the specialized code is by calling
the generic function which performs the guarded dispatch.

In the future, we can build on this work in several ways:
- cross module dispatch directly to specialized code
- dynamic dispatch directly to specialized code
- automated specialization based on less specific hints
- partial specialization
- and so on...

I reorganized and refactored the optimizer's generic utilities to
support direct function specialization as opposed to apply
specialization.
2016-03-21 12:43:05 -07:00
Andrew Trick
5bda28e1cb Revert "Merge pull request #1725 from atrick/specialize"
Temporarily reverting @_specialize because stdlib unit tests are
failing on an internal branch during deserialization.

This reverts commit e2c43cfe14, reversing
changes made to 9078011f93.
2016-03-18 22:31:29 -07:00
Andrew Trick
4c052274e6 Introduce @_specialize(<type list>) internal attribute.
This attribute can be attached to generic functions. The attribute's
arguments must be a list of concrete types to be substituted in the
function's generic signature. Any number of specializations may be
associated with a generic function.

This attribute provides a hint to the compiler. At -O, the compiler
will generate the specified specializations and emit calls to the
specialized code in the original generic function guarded by type
checks.

The current attribute is designed to be an internal tool for
performance experimentation. It does not affect the language or
API. This work may be extended in the future to add user-visible
attributes that do provide API guarantees and/or direct dispatch to
specialized code.

This attribute works on any generic function: a freestanding function
with generic type parameters, a nongeneric method declared in a
generic class, a generic method in a nongeneric class or a generic
method in a generic class. A function's generic signature is a
concatenation of the generic context and the function's own generic
type parameters.

e.g.

  struct S<T> {
    var x: T
    @_specialize(Int, Float)
    mutating func exchangeSecond<U>(u: U, _ t: T) -> (U, T) {
      x = t
      return (u, x)
    }
  }
  // Substitutes: <T, U> with <Int, Float> producing:
  // S<Int>::exchangeSecond<Float>(u: Float, t: Int) -> (Float, Int)
2016-03-17 18:27:10 -07:00
Ray Fix
74605b65db Update Generics.rst
Fixes capitalization of Swift Bool type.
2016-03-11 18:29:37 +09:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
practicalswift
4b0571bae8 [gardening] Fix documentation typos 2016-01-24 12:52:01 +01:00
Marat S
119d501f23 Fix lowercase 'Void' 2016-01-23 23:39:47 +03:00
Marat S
32154de115 fix typo 2016-01-23 07:41:25 +03:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
ken0nek
50c88b9d15 Add spaces before and after closure arrow in docs 2015-12-23 05:04:58 +09:00
zerotypos-found
0c1df3577e Fix typo: a --> an, an --> a. 2015-12-17 15:10:25 +09:00
Jaden Geller
0183833512 Fixed issue in design document where incorrect word mentioned 2015-12-12 14:56:09 -08:00
Chris Willmore
0867e2e59b [docs] Fix linked list definition in Generics.rst
Swift SVN r23471
2014-11-20 05:22:19 +00:00
Dave Abrahams
6f03d836eb [stdlib] Half-open ranges are now spelled x...y
Fully-closed ranges are coming soon.  See the release notes for details.
Implements the "hard" part of <rdar://problem/14586400>

Swift SVN r13674
2014-02-08 05:37:57 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Howard Hinnant
36e6f363f1 Further Vector -> Array migration. Also updated Array with several good suggestions from Dave A.
Swift SVN r9418
2013-10-16 20:48:24 +00:00
Joe Groff
26125d050b Update 'union' references in other docs.
Swift SVN r8483
2013-09-20 04:41:49 +00:00
Doug Gregor
97e772bb43 Generics manifesto: Rename "requires" to "where" and update syntax.
Swift SVN r8182
2013-09-13 02:19:35 +00:00
Chris Lattner
fb801cd73c a couple more.
Swift SVN r7848
2013-09-03 16:52:00 +00:00
Chris Lattner
938ee19b36 This -> Self.
Swift SVN r7847
2013-09-03 16:50:44 +00:00
Chris Lattner
a3928d4c70 fix this -> self conversion issue.
Swift SVN r7663
2013-08-28 04:10:19 +00:00
Ted Kremenek
8f5b8ccb02 Rename "This" to "Self" and "this" to "self".
This was not likely an error-free change.  Where you see problems
please correct them.  This went through a fairly tedious audit
before committing, but comments might have been changed incorrectly,
not changed at all, etc.

Swift SVN r7631
2013-08-27 21:58:27 +00:00
Jordan Rose
674a03b085 Replace "oneof" with "union"...everywhere.
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!

Swift SVN r6783
2013-07-31 21:33:33 +00:00
Dave Abrahams
c97bab033e General documentation corrections
Swift SVN r5628
2013-06-17 21:15:02 +00:00
Joe Groff
b1ef4f4a2a Update description of generic type disambiguation in Generics.rst.
Swift SVN r5480
2013-06-05 16:58:14 +00:00
Dmitri Hrybenko
625f059d7e Fix a few typos in documentation
Swift SVN r5474
2013-06-04 23:02:51 +00:00
Dave Abrahams
eccb25a6b7 docs/Generics.rst: disable the currently-failing test
If this stuff is going to be run by the buildbot, it should start out clean

Swift SVN r4647
2013-04-09 22:33:15 +00:00
Dave Abrahams
a2cc84eb19 Generics.rst: explanatory comment for LitRe @ignore directive
Swift SVN r4513
2013-03-28 13:45:16 +00:00
Dave Abrahams
60dc2cb569 Generics.rst: add missing declarations to example
Swift SVN r4512
2013-03-28 13:45:15 +00:00
Dave Abrahams
424df116c3 Generics.rst: test C++ code with whatever compiler CMake finds
Swift SVN r4511
2013-03-28 13:45:14 +00:00
Dave Abrahams
d357f8d071 Generics.rst: add some initial LitRe testing
Swift SVN r4507
2013-03-28 13:45:09 +00:00
Dave Abrahams
0951927a7c Fix typos ("- >" becomes "->")
Swift SVN r4290
2013-03-06 00:02:08 +00:00
Chris Lattner
076e035c4f add a wishlist to the roadmap, fix a typo in Generics.rst
Swift SVN r4076
2013-02-18 20:27:07 +00:00
Chris Lattner
8307e73595 remove some extraneous ;'s
Swift SVN r4045
2013-02-14 01:46:11 +00:00
Chris Lattner
f0c46ac962 ascii'ify
Swift SVN r4024
2013-02-13 05:23:58 +00:00