Previously we had a single mask for all x86-64 targets which included both the top and bottom bits. This accommodated simulators, which use the top bit, while macOS uses the bottom bit, but reserved one bit more than necessary on each. This change breaks out x86-64 simulators from non-simulators and reserves only the one bit used on each.
rdar://problem/34805348 rdar://problem/29765919
Introduce an inner function that breaks the infinite recursion check, silencing this warning:
```
swift/stdlib/public/core/AssertCommon.swift:166:15: warning: all paths through this function will call itself
internal func _fatalErrorMessage(
^
```
Also enable the parsing of these with
-enable-operator-designated-protocols in the stdlib build.
The constraint solver support to make use of these is not yet in-tree.
and will probably land with a different command-line option to enable
it, so that we can continue to have parsing support enabled in-tree
while the constraint solver support is iteratively improved.
The functions in LibcShims are used externally, some directly and some through @inlineable functions. These are changed to SWIFT_RUNTIME_STDLIB_SPI to better match their actual usage. Their names are also changed to add "_swift" to the front to match our naming conventions.
Three functions from SwiftObject.mm are changed to SPI and get a _swift prefix.
A few other support functions are also changed to SPI. They already had a prefix and look like they were meant to be SPI anyway. It was just hard to notice any mixup when they were #defined to the same thing.
rdar://problem/35863717
This eliminates a retain/release pair around calls to it when it doesn’t get inlined.
_delete is responsible for restoring hash table invariants after a removal. It moves around elements in complicated patterns, but it doesn’t release them.
The performance of operations merging two similar-sized sets or dictionaries is currently quadratic. Enabling per-instance seeds makes most of these linear, which is what most people expect.
This affects Set.union, Set.symmetricDifference and similar operations, including the for-loop based forms that people write manually.
The only remaining quadratic cases are when two sets/dictionaries are merged that are mutated copy-on-write copies of the same original instance. (We can’t change the hash seed without a full rehash,
We're not actually sure what this test is trying to validate, but it's quite fragile and probably not the best way to test it. Remove it rather than continuing to blindly update it.
Also minor improvements for the generic converts on 32b platforms; there's still more to be done with these, but this keeps us on the HW path for the common case.
Also removes .gyb from FloatingPoint.swift, since we barely are using it after this change.
Rework Self._convert from integer, by making it require RawSignificand: FixedWidthInteger. This requirement should have always been there, and the existing implementaiton wouldn't have actually worked correctly without it. Making it explcit makes the implementation quite a bit simpler, which is nice.
Additionally add a fast-path conversion that will catch all concrete integer types without needing to be a concrete implementation itself. Room for further improvement, but good start. See RandomDouble performance improvements, for example.
Replace the single typed storage reference with two _BridgeObjects; this should give us plenty of space to play around with alternative representations.
An error was hit when attempting to build Swift on a 32-bit Linux host. It was asserting when attempting to run ‘RedunantLoadElim” during the optimizer. The reason why is a bit messy.
First, Builtin.Word is always considered to be 64-bit when it is a SILType. This means the optimizer, when working with a Builtin.Word, will create 64-bit APInts when converting from other types.
Second, the SIL being output for a particular literal looked like this:
Int2048 (integer_literal) : Int32 (Signed Truncation) : Word (zextOrBitCast)
The constant fold behavior would convert this into an integer_literal of the Builtin.Word type. But because of the zext cast, if the original literal was -1, it would become +4 billion during folding.
This normally isn’t a problem **except** when SIL is still attempting to optimize. (See First)
Third, The Redundant Load Elimination pass was attempting to make sense of an index_addr instruction which was indexing at -1. This happens when you perform “-= 1” on an UnsafePointer. Because SIL was interpreting Word’s size incorrectly, it caused the RLE pass to ask “what is the ProjectionKind at ptr[4billion]?” Since there’s no feasible answer for such a question, the answer was “nothing” when the Projection’s kind() was checked, which tripped the assert.
This fix uses sign extension when converting “upward” and the Integer type is signed, otherwise it will still use zero extension.