ObjectIdentifier is used relatively frequently as the Key type for dictionaries, so it makes sense for it to implement single-shot hashing. This will lead to a measurable speedup in lookup/insertion performance.
rdar://88339458
There isn't actually an ** operator in Swift, so making the formula that
includes ** for exponentiation look like Swift can lead to confusion.
Fixes rdar://56184186
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.
* 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>
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.