Commit Graph

3590 Commits

Author SHA1 Message Date
Max Moiseev
4108884a11 Fix new compilation errors 2017-09-29 11:26:56 -07:00
Max Moiseev
568dfc75f6 More missing _inlineable's and deinit's 2017-09-29 11:26:56 -07:00
Maxim Moiseev
98b875a6e5 Fix compilation errors 2017-09-29 11:26:56 -07:00
Max Moiseev
ef6b5c4795 Add missing @_inlineable attributes and deinits 2017-09-29 11:26:56 -07:00
Max Moiseev
b30b937ed3 Revert making some enums public
The compiler problem was fixed: rdar://problem/34342955
2017-09-29 11:26:56 -07:00
Max Moiseev
29346cc52b Address watchOS build failures 2017-09-29 11:26:56 -07:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
Saleem Abdulrasool
1ce5c17337 stdlib: swap conditional to make it easier to read (NFC)
This changes the conditional for the definition of the _VaListBuilder.
This makes it easier to read as well as to extend to other platforms
which use a non-pointer va_list type.  NFC.
2017-09-28 09:34:39 -07:00
Lance Parker
0787a4ec48 Merge pull request #12061 from lancep/CVarArgBoolConformance
[stdlib] Bool should conform to the CVarArg protocol
2017-09-25 16:06:37 -07:00
Jordan Rose
e0ddb219d0 [stdlib] Eliminate the last direct use of Builtin.UnknownObject (#11984)
At the Swift level, this is equivalent to AnyObject, which we've done
much more testing of. This commit paves the way for taking UnknownObject
out of the SIL type system and just using it as type metadata. Filed
https://bugs.swift.org/browse/SR-5926 to track that work.
2017-09-25 13:51:22 -07:00
Lance Parker
07b9232235 Correctly handle big endian systems, updated the comment for va_arg usage 2017-09-25 12:38:18 -07:00
Tony Allevato
3618164330 [stdlib] Add _mixForSynthesizedHashValue to stdlib 2017-09-24 08:55:45 -07:00
Lance Parker
5fe76898d5 Make Bool conform to CVarArg protocol 2017-09-22 09:51:52 -07:00
Saleem Abdulrasool
2a7e1be7b3 Merge pull request #11999 from compnerd/windows-tls-cc
stubs: fix Windows x86 TLS callback CC violation
2017-09-21 14:52:50 -07:00
Saleem Abdulrasool
42c98e63d0 stubs: fix Windows x86 TLS callback CC violation
Windows x86 requires that the TLS destructor callback uses the "stdcall"
calling convention.  Provide a shim which will adjust the calling
convention and call back into the swift portion of the code code with
the expected calling convention.
2017-09-21 11:29:56 -07:00
swift-ci
79a3f9c415 Merge pull request #11670 from natecook1000/nc-rev-77-2 2017-09-19 10:15:59 -07:00
Erik Eckstein
ba1a5f9cae Produce more efficient code for the init(rawValue: String) constructor of string enums, part 2.
Use a dictionary for string lookup, which is initialized the first time the constructor is called.
This is more efficient than just iterating of the string table.

Unfortunately it's still not as fast as the original version (where all the string comparisons are inlined into the constructor) for enums with < 100 strings.
But this will improve once we can pass the string and string table as borrowed parameters and we can reduce the ARC overhead.
2017-09-18 17:50:24 -07:00
Erik Eckstein
0bdd91a039 Produce more efficient code for the init(rawValue: String) constructor of string enums.
Instead of inlining a series of string comparisons, we call a library function which does the string lookup on a table of static strings.
This reduces the code size of those initializers dramatically.
Performance wise it's slower than before, because the string comparisons are not inlined anymore.
2017-09-18 17:50:24 -07:00
Roman Levenstein
937352a03b Merge pull request #11910 from swiftix/resilience-performance1
Add experimental support for tracking the invocations of runtime functions
2017-09-18 16:23:00 -07:00
Saleem Abdulrasool
b38ed2f8fc Merge pull request #11949 from compnerd/windows-tls
stdlib: generalise TLS to support Windows
2017-09-18 14:21:13 -07:00
Slava Pestov
df75e536e6 Merge pull request #11969 from slavapestov/versioned-inherited-initializers
Sema: Inherited initializers inherit the @_versioned attribute
2017-09-16 17:17:48 -07:00
Robert Widmann
74f02ad16b Merge pull request #11623 from CodaFi/fundef
[stdlib]Custom message for recursive Strideable witness
2017-09-16 11:02:09 -04:00
Slava Pestov
f3e9aa35a7 Sema: Inherited initializers inherit the @_versioned attribute
Fixes <rdar://problem/34398148>.
2017-09-16 00:23:14 -07:00
Roman Levenstein
045dc34955 Address review comments related to the Swift standard library part of the PR 2017-09-15 15:17:34 -07:00
Saleem Abdulrasool
ba8cbe137c stdlib: generalise TLS to support Windows
Rename the explicit `pthread` to `thread` to indicate that this is not
`pthread` specifically.  This allows us to implement the TLS support for
Windows using Fibers.
2017-09-15 10:56:50 -07:00
Joe Groff
b7566dacdb IRGen: Lowering for key paths with indices. 2017-09-15 10:24:28 -07:00
Robert Widmann
d0bc2a8611 Custom message for recursive Strideable witness
Strideable declares a default witness for Equatable and Comparable

extension Strideable {
  @_inlineable
  public static func < (x: Self, y: Self) -> Bool {
    return x.distance(to: y) > 0
  }

  @_inlineable
  public static func == (x: Self, y: Self) -> Bool {
    return x.distance(to: y) == 0
  }
}

This witness is implemented recursively because the expectation
is that Stride != Self.  However, it is possible to implement
SignedNumeric and Strideable together and inherit this conformance
which will cause undefined behavior - usually a crash.

Provide an overload when Stride == Self and crash with custom message
that mentions that Equatable and Comparable have to be implemented
in this case.

- It's better than nothing.
2017-09-15 12:31:09 -04:00
Roman Levenstein
a4d5cad3a5 Fix creation of UnsafeRawPointer for found references 2017-09-14 19:14:03 -07:00
Roman Levenstein
a590e4902e Add experimental Swift standard library support for tracking the invocations of runtime functions
It allows for collecting the state of runtime function counters, which are used to determine how many times a given runtime function was called.

It is possible to get the global counters, which represent the total number of invocations, or per-object counters, which represent the number of runtime functions calls for a specific object.
2017-09-14 16:43:13 -07:00
Doug Gregor
0793f6c8c5 Revert "[Sequence] Make Sequence.SubSequence conform to Sequence."
This reverts commit 7dc8737c9c.
2017-09-14 09:12:56 -07:00
Arnold Schwaighofer
5326fb73f7 Merge pull request #11877 from aschwaighofer/replace_array_witnesses
Use array copy runtime implementation instead of the array value witnesses
2017-09-13 07:54:13 -07:00
Michael Ilseman
fdb1cab12d Merge pull request #11862 from milseman/message_init_view
[stdlib] Better message for unavailable String.init(_:UTF8Buffer)
2017-09-12 15:48:03 -05:00
Arnold Schwaighofer
8a85a9efd5 Use array copy runtime implementation instead of the array value witnesses
And add builtins for the added runtime functions (assign-take, assign-copy).

rdar://27412867
SR-3376
2017-09-12 12:43:26 -07:00
Nate Cook
4a1b74c266 [stdlib] Additional revisions
- Incorporate feedback from @xwu
- Add parameters for `dump`
- Duplicate some missing integer comments
2017-09-12 11:21:54 -05:00
Doug Gregor
6ce063f769 Merge pull request #11769 from DougGregor/stdlib-recursive-constraints
[Stdlib] Make Sequence.SubSequence conform to Sequence.
2017-09-12 09:19:20 -07:00
swift-ci
8c65f6e785 Merge pull request #11751 from DougGregor/gsb-nested-same-type-match 2017-09-12 07:20:33 -07:00
Doug Gregor
7dc8737c9c [Sequence] Make Sequence.SubSequence conform to Sequence.
Addressed ABI FIXME’s #4, #5, #104 and #105, making Sequence’s
SubSequence conform to Sequence, with the same element type, and for
which the SubSequence of a SubSequence is the same SubSequence.

Fixes SR-318 / rdar://problem/31418206.
2017-09-12 06:52:01 -07:00
Doug Gregor
3b47b16a47 [Stdlib] Eliminate the _UnicodeEncoding_ protocol.
This protocol was only used to fake recursive protocol conformances;
collapse it into _UnicodeEncoding.
2017-09-12 06:34:10 -07:00
Michael Ilseman
de5968cbb4 [stdlib] Remove trivial FIXME; NFC 2017-09-11 17:27:37 -07:00
Michael Ilseman
29d0d142bb [stdlib] Better message for unavailable String.init(_:UTF8Buffer) 2017-09-11 17:14:32 -07:00
Slava Pestov
852cb30d04 stdlib: Explicitly define an _ObjectiveCType typealias for _SwiftNewtypeWrapper where the RawValue is _ObjectiveCBridgeable
Previously we relied on associated type inference inferring that
_ObjectiveCType should be Self.RawValue._ObjectiveCType, but this
doesn't work if we import a newtype wrapper after Sema has been
torn down.
2017-09-07 01:53:09 -07:00
Maxim Moiseev
29562f05bf Merge pull request #11746 from xwu/patch-3
[stdlib] Put new standard operators in the right place [NFC]
2017-09-05 17:10:23 -07:00
Maxim Moiseev
6c7d93491f Merge pull request #11627 from moiseev/swift-2-artifacts
[stdlib] Remove the Grand Renaming artifacts of Swift 3 era
2017-09-05 11:41:18 -07:00
Xiaodi Wu
d661204d7e Remove operators from Integers.swift.gyb 2017-09-02 12:05:18 -05:00
Xiaodi Wu
a4ac677bae Put new standard operators in the right place 2017-09-02 12:02:12 -05:00
Mark Lacey
b64551b853 [stdlib] Restore signatures to use UnsafeMutableBufferPointer.
Resolves rdar://problem/21933004.
2017-08-31 22:33:36 -07:00
Max Moiseev
1e51177fec Add back the Generator typealias in the name of source stability 2017-08-29 14:22:21 -07:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Nate Cook
050268d876 [stdlib] Documentation revisions
- Update NSRange -> Range guidance
- Fix example in Optional
- Improve RangeExpression docs
- Fix issue in UnsafeRawBufferPointer.initializeMemory
- Code point -> scalar value most places
- Reposition the dot above the scripty `i'
- Fix ExpressibleByArrayLiteral code sample
2017-08-29 09:41:55 -05:00
Maxim Moiseev
ee5fb33656 [stdlib] Remove the Grand Renaming artifacts of Swift 3 era 2017-08-28 15:54:11 -07:00