Commit Graph

5263 Commits

Author SHA1 Message Date
Chris Lattner
d73141479e Merge pull request #1348 from Nirma/constant_predicate
Change _predicate from variable to constant.
2016-02-18 09:00:13 -08:00
Janosch Hildebrand
916841d9db [stdlib] Fix precondition messages for MutableCollectionType slice replacing
The precondition messages in `_writeBackMutableSlice` were inverted in their respective meaning.
2016-02-18 15:02:28 +01:00
Nicholas Maccharoli
4d1efe984b Change _predicate from variable to constant. 2016-02-18 20:57:57 +09:00
John McCall
e249fd680e Destructure result types in SIL function types.
Similarly to how we've always handled parameter types, we
now recursively expand tuples in result types and separately
determine a result convention for each result.

The most important code-generation change here is that
indirect results are now returned separately from each
other and from any direct results.  It is generally far
better, when receiving an indirect result, to receive it
as an independent result; the caller is much more likely
to be able to directly receive the result in the address
they want to initialize, rather than having to receive it
in temporary memory and then copy parts of it into the
target.

The most important conceptual change here that clients and
producers of SIL must be aware of is the new distinction
between a SILFunctionType's *parameters* and its *argument
list*.  The former is just the formal parameters, derived
purely from the parameter types of the original function;
indirect results are no longer in this list.  The latter
includes the indirect result arguments; as always, all
the indirect results strictly precede the parameters.
Apply instructions and entry block arguments follow the
argument list, not the parameter list.

A relatively minor change is that there can now be multiple
direct results, each with its own result convention.
This is a minor change because I've chosen to leave
return instructions as taking a single operand and
apply instructions as producing a single result; when
the type describes multiple results, they are implicitly
bound up in a tuple.  It might make sense to split these
up and allow e.g. return instructions to take a list
of operands; however, it's not clear what to do on the
caller side, and this would be a major change that can
be separated out from this already over-large patch.

Unsurprisingly, the most invasive changes here are in
SILGen; this requires substantial reworking of both call
emission and reabstraction.  It also proved important
to switch several SILGen operations over to work with
RValue instead of ManagedValue, since otherwise they
would be forced to spuriously "implode" buffers.
2016-02-18 01:26:28 -08:00
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
William Dillon
d0d9b1de5a Discard swift.ld and support gold linker 2016-02-17 17:47:35 -08:00
Dmitri Gribenko
80fa72ad59 stdlib: fix coding style 2016-02-17 14:50:16 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Maksim Odnoletkov
9fffeda0ae Re-format to fit 80 columns 2016-02-17 00:43:52 +03:00
Maksim Odnoletkov
7bfabd535c [stdlib] Fixed IntervalType.overlaps for empty interval case 2016-02-16 22:19:02 +03:00
Dmitri Gribenko
0e1c488f9a stdlib: print, debugPrint: 'toStream:' => 'to:' 2016-02-15 23:48:02 -08:00
Dmitri Gribenko
25cc2d5695 stdlib: add first argument labels to Set and Dictionary 2016-02-15 23:48:02 -08:00
Dmitri Gribenko
bf34b047d8 stdlib: lowercase cases of FloatingPointClassification enum 2016-02-15 23:48:02 -08:00
Dmitri Gribenko
40a31f2da0 stdlib: fix coding style 2016-02-15 23:48:01 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
a558d13a3b Revert "Replace Unmanaged with UnsafeReference"
This reverts commit d72932e931.
2016-02-15 17:13:40 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Dmitri Gribenko
8b86dac8c1 Revert "[gardening] Fix typo: "nul-terminated" → "null-terminated"" 2016-02-13 15:27:53 -08:00
Chris Lattner
2ba93a2ba9 Merge pull request #1300 from peterfriese/gardening-typo-nul-terminated
[gardening] Fix typo: "nul-terminated" → "null-terminated"
2016-02-13 09:08:51 -08:00
Dmitri Gribenko
2d27beccfc Merge pull request #1286 from natecook1000/natecook-doc-consistency
[stdlib] Documentation consistency fixes
2016-02-12 08:59:21 -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
f3c4e0ac74 Remove style on *generator* and friends. 2016-02-12 04:20:01 -06:00
Nate Cook
d9575c2d7f Make doc consistency fix for String.UnicodeScalarView´ 2016-02-12 01:56:37 -06:00
Jordan Rose
7f221323ca Merge pull request #1271 from hpux735/VarArgs
Add support for __gnuc_va_list to ClangImporter.
2016-02-11 20:22:33 -08:00
William Dillon
582c268ae9 Add support for __gnuc_va_list to ClangImporter
The implementation of va_list is pretty inconsistent across platforms.
On linux-arm __gnuc_va_list is the type used. This change adds that to ClangImporter.
The change to the test is optional, but it dramatically improves the error message printed to the console when the test fails.
Finally, the change to the application of alignment padding is due to the fact that all ARM platforms other than iOS need AAPCS-complient alignemnt.
2016-02-12 03:16:44 +00:00
Nate Cook
44e866ce21 Fix Optional errors. 2016-02-11 13:40:36 -06:00
Nate Cook
32f81e8238 Add missing abstracts for types and protocols. 2016-02-11 11:47:27 -06:00
Nate Cook
5849e167dd [stdlib] Fix a spate of typos.
Fix bulleted list formatting in Unsafe(Mutable)Pointer.
Fix incorrect type mentions on CustomPlaygroundQuickLookable.
Use 'An' instead of 'A' before '8-bit (un)signed integer.
Fix error in Range sample code.
Fix typo in Dictionary.updateValue(_:forKey:) doc comment.
Remove extra documentation in Mirror.AncestorRepresentation.
Fix improper case for operators and methods in IntegerArithmeticType.
2016-02-11 11:39:39 -06:00
Peter Friese
888d0f3fa6 [gardening] Fix typo: "nul-terminated" → "null-terminated" 2016-02-11 11:03:38 +00:00
Peter Friese
723484ef24 [gardening] Fix typo: "nul-terminated" → "null-terminated" 2016-02-11 10:11:02 +00:00
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Brian Gesiak
a69507d493 [stdlib] Fix extra "it" typo 2016-02-10 13:40:05 -05:00
Chris Lattner
5bad3ba49a Warn about implicit tuple splat in a parameter list. 2016-02-09 14:01:50 -08:00
Xin Tong
d4a95eead5 Turn a function internal to preemptively avoid conflict 2016-02-08 13:35:24 -08:00
Xin Tong
be9fec315a Add a caller to _Prespecialize._specializeArrays() and _Prespecialize._specializeRanges() to keep them alive
We now run a dead function elim before running any generic specializer. generic specializer generates some
prespecialized functions and explicitly keep them alive (i.e. make them not removeable by dead function elim)

However, the recently added dead function elimination gets rid of the calls which the prespecialization uses
to generate the prespecialization.

Create a caller with special name (avoid conflict) to make sure the specialization does happen.

Hopefully, eventually we will be able to move to a cleaner approach to do prespecialization.

rdar://24543234
2016-02-08 12:53:19 -08:00
Kevin Ballard
ed03745c75 Add @noescape to SequenceType.flatMap 2016-02-05 12:35:00 -08:00
Doug Gregor
42bb2528dd [Overload resolution] Prefer functions with fewer defaulted/variadic arguments.
When comparing two functions for overload resolution, break apart the
parameter lists to compare individual parameters rather than comparing
the tuples. This allows us to prefer functions with fewer arguments to
ones with more, defaulted or variadic arguments. That preference was
already encoded in the constraint optimizer, which led to some strange
behavior where the preference was expressed for function calls but not
for calls to initializers. Fixes rdar://problem/24128153.

The standard library change tweaks the anachronistic, unavailable
"print" variants somewhat. The only behavior change here is a slight
regression for cases like:

  print(a: 1, b: 2)

where we used to produce a diagnostic:

  Please wrap your tuple argument in parentheses: 'print((...))'

but we now get:

  argument labels '(a:, b:)' do not match any available overloads

However, this regression will happen at some point *anyway*, if
SE-0029 (or anything else that removes the implicit tuple splat
operation) goes through.
2016-02-05 11:41:01 -08:00
Max Moiseev
39fdbca8d0 making Swift build succesfully after the merge 2016-02-04 16:48:14 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Chris Lattner
0619e57a61 Switch the stdlib to use #file instead of __FILE__, and deprecate the __FILE__ identifiers.
This also updates the tests that would otherwise fail.
2016-02-04 15:08:31 -08:00
Dmitri Gribenko
b2ca7712f6 Merge pull request #929 from kballard/remove-reundant-locking-from-print
[Stdlib] Remove all redundant stdout locking when printing
2016-02-04 09:15:24 -08:00
Xin Tong
19869d4fb5 Minor code refactoring and changing an enum of 2 fields to an Optional 2016-02-03 15:01:46 -08:00
Xin Tong
d2a1cb90f5 Fix a swift argument initialization bug - swift argument should be initialized
after argc and argv are initialized.

The problem before is that the argument function is a global_init which can be moved
by the GlobalOpt optimization and thus broke the data dependence on argc and argv.

rdar://24250684
2016-02-03 14:02:31 -08: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
Kevin Ballard
ac1996000e [Stdlib] Remove all redundant stdout locking when printing
* Switch to calling `putchar_unlocked()` instead of `putchar()` for
  actual printing. We're already locking stdout with `flockfile()`, so
  there's no need for the redundant lock that `putchar()` uses.
* Add an explicit lock to the output stream in `dump()`. This means the
  entire dump is printed with the lock held, which will prevent the
  output of `dump()` from mixing with prints on other threads.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `_adHocPrint()`. The output stream is already locked while this
  function is executing. Rename the function to `_adHocPrint_unlocked()`
  to make this explicit.
* Use `targetStream.write()` and `_print_unlocked()` instead of
  `print()` in `_dumpObject()`. This removes the redundant locking, and
  also eliminates the creation of intermediate strings. Rename the
  function to `_dumpObject_unlocked()` to make this explicit.
* Use `targetStream.write()`, `_print_unlocked()`, and
  `_debugPrint_unlocked()` in `_dumpSuperclass()`. This removes the
  redundant locking, and also eliminates the creation of intermediate
  strings. Rename the function to `_dumpSuperclass_unlocked()` to make
  this explicit.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `String.init(reflecting:)`. This shouldn't really make much of a
  difference but it matches the usage of `_print_unlocked()` in
  `String.init(_:)`.

The net result is that all printing is still covered under locks like
before, but stdout is never recursively locked. This should result in
slightly faster printing. In addition, `dump()` is now covered under a
single lock so it can't mix its output with prints from other threads.
2016-02-02 13:40:55 -08:00
Dmitri Gribenko
34b00e25b1 stdlib: fix coding guideline violations 2016-01-31 23:42:05 -08:00
Dmitri Gribenko
81ce88847c stdlib: remove dead code 2016-01-31 21:57:06 -08:00
David Farler
d45aa36e85 Clean up some things that sneaked into var reverts
- Remove an overload that came back in after rebase
- Minor formatting issues
2016-01-30 10:03:53 -08:00
Dmitri Gribenko
dc11ccded4 Merge pull request #1122 from harlanhaskins/fatalError-stack-trace
Add backtrace reporting on fatalError
2016-01-30 04:07:07 -08:00