Commit Graph

7762 Commits

Author SHA1 Message Date
Thomas Roughton
70e9b96243 [stdlib] Make Range.init(_: ClosedRange<Bound>) inlinable
Currently, a simple function such as:

```swift
func makeSingleElementRange(n: Int) -> Range<Int> {
    return Range(n...n)
}
```

will result in the following assembly under optimisation:

```
output.makeSingleElementRange(n: Swift.Int) -> Swift.Range<Swift.Int>:
        sub     rsp, 40
        mov     qword ptr [rsp + 8], rdi
        mov     qword ptr [rsp + 16], rdi
        call    (lazy protocol witness table accessor for type Swift.Int and conformance Swift.Int : Swift.SignedInteger in Swift)
        mov     rcx, rax
        mov     rsi, qword ptr [rip + ($sSiN)@GOTPCREL]
        mov     rdx, qword ptr [rip + ($sSiSxsWP)@GOTPCREL]
        lea     rax, [rsp + 24]
        lea     rdi, [rsp + 8]
        call    ($sSnsSxRzSZ6StrideRpzrlEySnyxGSNyxGcfC)@PLT
        mov     rax, qword ptr [rsp + 24]
        mov     rdx, qword ptr [rsp + 32]
        add     rsp, 40
        ret
```

Mark the `init` as inlinable so these functions can be properly optimised.

Also add a missing line of documentation.
2022-01-16 15:09:03 +13:00
Guillaume Lessard
e24b9b46bc [nfc] document legacy ABI in the implementation of sort 2022-01-12 16:04:59 -07:00
swift_jenkins
368da5d9ee Merge remote-tracking branch 'origin/main' into next 2022-01-12 15:00:58 -08:00
Guillaume Lessard
a1e2ebb3a8 Merge pull request #40081 from HassanElDesouky/sort-optimization
[stdlib] Remove workaround for sort optimization
2022-01-12 15:58:16 -07:00
Hassan
6316555781 [stdlib] Remove workaround for sort optimization issue
Add discardableResult
2022-01-11 23:27:54 +02:00
swift_jenkins
764c642cc2 Merge remote-tracking branch 'origin/main' into next 2022-01-11 13:02:11 -08:00
Alejandro Alonso
6ca7366cd8 Merge pull request #40746 from Azoy/indic-grapheme-clusters
[stdlib] Implement the Indic grapheme breaking rules
2022-01-11 12:50:02 -08:00
swift_jenkins
1f810c12f7 Merge remote-tracking branch 'origin/main' into next 2022-01-10 11:01:39 -08:00
David Smith
12166a9c2d Optimize NSString->AnyHashable and String->AnyHashable 2022-01-08 02:33:51 -08:00
Alejandro Alonso
4a451829f8 Implement the Indic grapheme breaking rules 2022-01-05 16:18:54 -08:00
swift_jenkins
1993c9986a Merge remote-tracking branch 'origin/main' into next 2021-12-22 06:00:53 -08:00
Erik Eckstein
3d33f11e6c cmake/build-script: rename the libswift option to "bootstrapping"
In cmake, rename LIBSWIFT_BUILD_MODE to BOOTSTRAPPING_MODE.
Also, rename the lit feature "libswift" to "swift_in_compiler".
2021-12-22 11:31:52 +01:00
swift_jenkins
eea3e39edf Merge remote-tracking branch 'origin/main' into next 2021-12-21 19:21:32 -08:00
Doug Gregor
78e5846537 Add a feature for Builtin.assumeAlignment
Fixes rdar://86785846
2021-12-21 15:56:15 -08:00
swift_jenkins
e02d316b60 Merge remote-tracking branch 'origin/main' into next 2021-12-20 20:41:06 -08:00
Alejandro Alonso
76fbb3c139 Some fixes for scalar names 2021-12-20 13:51:45 -08:00
swift_jenkins
e67307e314 Merge remote-tracking branch 'origin/main' into next 2021-12-15 13:01:17 -08:00
Chris Adamson
59559ca0ce StdlibRef: Sequence.withContiguousStorageIfAvailable(_:) abstract needs a rewrite (#40334)
* First draft of incorporating material from #38891

* Apply suggestions from Alex's review

Co-authored-by: Alex Martini <amartini@apple.com>

* Rephrase suggested by Alex.

* Remove redundancy re: "don't replace buffer".

* Apply changes from editorial review.

* Apply Sequence edits (a3a3ff1) to MutableCollect'n

* Remove errant space.

Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>

Co-authored-by: Chris Adamson <cadamson@apple.com>
Co-authored-by: Alex Martini <amartini@apple.com>
Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>
2021-12-15 15:46:47 -05:00
Alex Martini
f1dfaaa663 Fix mentions of nonexistent 'end' parameter.
Follow-on to commit 4c82b7705c.
2021-12-13 11:00:44 -08:00
swift_jenkins
0c6b7f77dc Merge remote-tracking branch 'origin/main' into next 2021-12-13 10:40:29 -08:00
Alex Martini
e6cbf54832 Merge pull request #40454 from amartini51/doc_fixes_main
Cherry pick documentation fixes to 'main'
2021-12-13 10:31:41 -08:00
swift_jenkins
1f508bcda5 Merge remote-tracking branch 'origin/main' into next 2021-12-10 16:20:51 -08:00
Matt Zanchelli
9186d99747 Make assertionFailure(_:file:line:)’s documentation more consistent with sibling functions 2021-12-09 17:25:52 -08:00
swift_jenkins
e69908e929 Merge remote-tracking branch 'origin/main' into next 2021-12-07 06:01:08 -08:00
Andrew Trick
a1e717223f Merge pull request #39218 from atrick/revoke-pointer-sendable
Unsafe*Pointer types should not be Sendable.
2021-12-07 05:50:06 -08:00
swift_jenkins
dbf6ccb338 Merge remote-tracking branch 'origin/main' into next 2021-12-07 02:00:58 -08:00
Alejandro Alonso
8a5f728daf Merge pull request #40340 from Azoy/drop-icu
[stdlib] Drop ICU
2021-12-07 01:44:38 -08:00
Andrew Trick
47cc279960 Unsafe*Pointer types should not be Sendable.
To send them across actors, they need to be wrapped in an '@unchecked
Sendable' type. Typically such a wrapper type would be be responsible
for ensuring its uniqueness or immutability.

Inferring Sendability for arbitrary types that contain Unsafe*Pointers
would introduce race conditions without warning or any explicit
acknoledgement from the programmer that the pointer is in fact unique.
2021-12-06 15:52:50 -08:00
swift_jenkins
ab9ce743cb Merge remote-tracking branch 'origin/main' into next 2021-12-03 05:41:24 -08:00
David Smith
fc3e718771 Initial support for compile-time generation of vprintf format strings, behind the SWIFT_STDLIB_STATIC_PRINT flag 2021-12-02 16:58:36 -08:00
swift_jenkins
38fe5d045c Merge remote-tracking branch 'origin/main' into next 2021-12-01 17:41:30 -08:00
Andrew Trick
d62fbb81ea Merge pull request #40296 from atrick/assert-align
Add Builtin.assumeAlignment with support for misaligned loads
2021-12-01 17:34:01 -08:00
swift_jenkins
18f95e3c13 Merge remote-tracking branch 'origin/main' into next 2021-11-30 16:20:28 -08:00
swift-ci
691b62f84f Merge pull request #40314 from Catfish-Man/count-von-count 2021-11-30 16:09:31 -08:00
Alejandro Alonso
21ee3a5e0f Drop ICU
update freestanding deps
2021-11-30 13:53:08 -08:00
swift_jenkins
a7e1718cec Merge remote-tracking branch 'origin/main' into next 2021-11-30 13:00:43 -08:00
Alejandro Alonso
ac6c08f157 [stdlib] Make the rest of the scalar properties native (#40233)
* Factor out the scalar bit array index mechanism

* Implement native numeric scalar properties

* Implement native scalar name aliases

* Implement native scalar mappings

* Implement native scalar names

* Implement native scalar age

* Implement native scalar general category

* Address Michael's and others comments

fix special mappings

fix bug
2021-11-30 12:40:32 -08:00
Andrew Trick
385a85ccc1 Add assumeAlignment to UnsafeRawPointer.load()
To preserve current behavior.

I expect this builtin to be removed in the default case after
proposing the change in Swift Evolution.
2021-11-30 12:23:46 -08:00
David Smith
3d8c29eaea Early out for unequal NFC counts in String == 2021-11-29 19:49:00 -08:00
Arnold Schwaighofer
2df553cc02 arm64e: Update for LLVM ptr_auth intrinsics differences
ptr_auth intrinsics are not polymorphic rather expect an int64 type.

rdar://85583820
2021-11-29 10:15:40 -08:00
Erik Eckstein
97424b76f4 stdlib: Don't check for overflows when adding 1 to Array.count
That addition can not possibly overflow. If Array.count would be Int max, the allocation of the array buffer would have failed way before.
2021-11-29 09:41:05 +01:00
Erik Eckstein
61db072617 cmake: fix libswift build dependencies
Unfortunately using the convenient "bootstrapping0-all", etc. custom targets does not work.
For some reason it does not cause a dependent file (like libswift's SIL.o) being rebuilt when a depenency (like swift-frontend from the previous bootstrapping stage) changes.
Instead we have to list al library- and executable-targets explicitly.
2021-11-23 18:33:43 +01:00
swift-ci
5f3b7bbd22 Merge pull request #40253 from apple/substring-base-doc-fix 2021-11-19 03:55:36 -08:00
Doug Gregor
6d5d23aa18 Add a feature flag for Builtin.stackAlloc and friends
... and use it in inlinable code so older compilers don't break on
newer standard libraries, fixing rdar://85574956.
2021-11-18 21:00:05 -08:00
Richard Wei
e7e9e06de6 [Doc] Fix unescaped reference in 'Substring.base' summary.
There is an unescaped reference to type `Substring`.  I think a plain lowercased reference would read better.  Alternatively we could escape it with backquotes.
2021-11-18 16:49:44 -08:00
Alejandro Alonso
3b402f0179 [stdlib] Implement native Unicode.Scalar binary properties (#39597)
* Generate Unicode data for Scalar Binary Properties

* Use native scalar binary property lookup

* Add _BinaryProperties to Scalar Properties

narrow access control

* Upgrade the notice to a warning in UnicodeScalarProperties
2021-11-15 15:20:46 -08:00
Karoy Lorentey
78ef55081d Merge pull request #40138 from glessard/sort-workaround-bug-id 2021-11-12 21:41:38 -08:00
swift-ci
2a0c8a186a Merge pull request #40157 from DougGregor/unchecked-sendable-stdlib 2021-11-12 09:54:47 -08:00
Doug Gregor
353daabf8d Replace UnsafeSendable with @unchecked Sendable in the standard library. 2021-11-12 07:56:10 -08:00
Guillaume Lessard
183042e7ab Merge pull request #40132 from glessard/ump-deinitialize-todo
[docs] clarify todo about deinitializing a single element
2021-11-11 14:32:20 -07:00