Commit Graph

7778 Commits

Author SHA1 Message Date
Mike Ash
ba25b624f8 Merge pull request #18737 from mikeash/change-swift_unknownX-to-swift_unknownObjectX
[Runtime] Rename swift_unknown* functions to swift_unknownObject*.
2018-08-17 14:19:27 -04:00
Mike Ash
5e031ed033 Merge pull request #18758 from mikeash/availability-directive-optimization
[Runtime] Mark _swift_stdlib_operatingSystemVersion as __attribute__((const)).
2018-08-17 11:06:08 -04:00
Karoy Lorentey
c88030faa0 Merge pull request #18181 from lorentey/dictionary-review
[stdlib] Modernize Set and Dictionary internals
2018-08-17 14:49:42 +01:00
Kirill Chibisov
9c5f9ce18d [stdlib][QoI] Replace recursion in sort _siftDown with Iteration (#18629)
* stdlib: replace recursion in _siftDown with iteration

Iterative approach removes recursion overhead. Therefore performance
of sorting will be improved
2018-08-16 18:39:18 -06:00
Arnold Schwaighofer
76b03fe907 JSONEncoder: Also use workaround on arm
Instead of XFAILing the test try to use the workaround on arm.
This test failed on armv7k.

SR-8276
rdar://43145346
2018-08-16 13:51:51 -07:00
Karoy Lorentey
d1ec3b9b9b [stdlib] Make Set.isSubset(of:) self-contained; remove standalone function for same 2018-08-16 21:35:24 +01:00
Karoy Lorentey
d2d3c0cb21 [stdlib] Implement Set.contains without retrieving the stored value 2018-08-16 21:35:24 +01:00
Karoy Lorentey
2213b4ee2d [stdlib] Set, Dictionary: Review _SwiftDeferredNS* 2018-08-16 20:05:32 +01:00
Karoy Lorentey
548f59a0e3 [stdlib] Set, Dictionary: Make internal representations conform to Sequence 2018-08-16 20:05:32 +01:00
Karoy Lorentey
5e969ce24c [stdlib] Set, Dictionary: Simplify _find(_:,startBucket:)
The startBucket argument is _bucket(key) in the vast majority of cases. Add an overload with this default value.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
b1c81e5ffe [test] Update api-digester source compatibility tests
DictionaryIterator & SetIterator have been renamed Dictionary.Iterator and Set.Iterator, with compatibility typealiases.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
3bb720c6b0 [stdlib] Set, Dictionary: Prefer collection-agnostic names for stored property names
This makes it easier to define lldb data formatters for these types.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
9eb2743dd9 [stdlib] _UnsafeBitMap: make internal; force-inline members
A Dictionary.removeValue(forKey:) benchmark regressed 35% because recent changes in this PR caused an _UnsafeBitMap member to not be inlined in its implementation. (This was probably triggered by moving a method from Dictionary._Variant to _NativeDictionary.)
Add @inline(__always) to _UnsafeBitMap members.

While we’re at it, make _UnsafeBitMap @usableFromInline. It’s only public for testing purposes.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
063d92627b [stdlib] Dictionary: Add implementation for first
This is primarily for documentation purposes, although the default implementation (based on an iterator) may not return the correct value for bridged dictionaries with exotic implementations.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
6ee9fce52c [stdlib] Set, Dictionary: Remove remaining internal typealiases 2018-08-16 20:05:32 +01:00
Karoy Lorentey
2201d0e3c8 [stdlib] Set, Dictionary: Move compatibility typealiases to end of file 2018-08-16 20:05:32 +01:00
Karoy Lorentey
791d29f422 [stdlib] Set, Dictionary: Audit one more round of inlinability attributes 2018-08-16 20:05:32 +01:00
Karoy Lorentey
ad3c970054 [stdlib] Set, Dictionary: Review builders
- Inlinability audit
- Create a _NativeSet/_NativeDictionary directly, without extracting it from a Set/Dictionary
- Swap the final result with an empty collection.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
3f9cd3fb4b [stdlib] Set, Dictionary: Review iterators
- DictionaryIterator => Dictionary.Iterator
- SetIterator => Set.Iterator

- Introduce an explicit struct for native iterators
- _CocoaDictionaryIterator => _CocoaDictionary.Iterator
- _CocoaSetIterator => _CocoaSet.Iterator
- Move representation enums under {Set,Dictionary}.Iterator as _Variant.
- Inlinability audit
2018-08-16 20:05:32 +01:00
Karoy Lorentey
e588f1a8ba [stdlib] Set, Dictionary: Audit inlinability of storage classes
- Remove @inlinable from @objc methods.
- _UnmanagedAnyObjectArray: make internal.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
fcadebc02b [stdlib] Set, Dictionary: Review indices
- Nest native/cocoa index types under their corresponding struct
- Move *IndexRepresentation enums under the corresponding Index type, renamed to _Variant.
- Rename Index._value to Index._variant.
- Remove internal typealiases.
- Remove underscore prefix from enum case names.
- _nativeIndex => _asNative, _cocoaIndex => _asCocoa
- Audit inlinability.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
ac9f29451f [stdlib] Set, Dictionary: Review enumerators
_NativeSetNSEnumerator => _SwiftSetNSEnumerator
_NativeDictionaryNSEnumerator => _SwiftDictionaryNSEnumerator
2018-08-16 20:05:32 +01:00
Karoy Lorentey
e2fb468b97 [stdlib] Set, Dictionary: Review native & cocoa representations
- Remove buffer suffix from type, property & variable names
  struct _NativeSetBuffer => _NativeSet
  struct _NativeDictionaryBuffer => _NativeDictionary
  struct _CocoaSetBuffer => _CocoaSet
  struct _CocoaDictionaryBuffer => _CocoaDictionary

- Remove internal typealiases related to these types
- Move nativeDelete, nativeMapValues from variant enum to corresponding struct
2018-08-16 20:05:32 +01:00
Karoy Lorentey
cc8e378319 [stdlib] Set, Dictionary: Remove obsolete operator definitions. 2018-08-16 20:05:32 +01:00
Karoy Lorentey
2053f74828 [stdlib] Set, Dictionary: Review variant enums
- Rename variant enum types and move them into the corresponding struct:
  _VariantSetBuffer => Set._Variant
  _VariantDictionaryBuffer => Dictionary._Variant

  I found the buffer suffix did not positively contribute to understanding these types. And the extra indirection of the typealiases wasn't exactly helpful, either.

- Remove internal typealiases that resolved to these.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
c74e4daa2b [stdlib][NFC] Shorten notes about SR-6437 2018-08-16 20:05:32 +01:00
Mike Ash
195e3807d1 [Runtime] Mark _swift_stdlib_operatingSystemVersion as __attribute__((const)).
This tells the compiler that repeated calls to this function will always generate the same result, which allows the optimizer to coalesce multiple calls, hoist calls out of loops, and other such nice things.

rdar://problem/20690429
2018-08-16 13:24:54 -04:00
Mike Ash
46309d9794 [Runtime] Rename swift_unknown* functions to swift_unknownObject*.
These functions don't accept local variable heap memory, although the names make it sound like they work on anything. When you try, they mistakenly identify such things as ObjC objects, call through to the equivalent objc_* function, and crash confusingly. This adds Object to the name of each one to make it more clear what they accept.

rdar://problem/37285743
2018-08-15 17:48:23 -04:00
Mishal Shah
3f1be3bd8c Update swift master to build with Xcode 10 beta 6, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-08-15 12:35:40 -07:00
Arnold Schwaighofer
8993b0d10d Address review comments 2018-08-15 07:05:47 -07:00
Arnold Schwaighofer
b9b6362251 Re-enable inlining of the _stdlib_isOSVersionAtLeast macro 2018-08-14 13:42:55 -07:00
Michael Ilseman
b93a351c89 Merge branch 'master' into patch-1 2018-08-11 18:51:29 -07:00
Michael Ilseman
9825111d00 Merge pull request #18642 from milseman/you_see_dee
[string] Internal Unicode.Scalar.withUTF16CodeUnits
2018-08-11 14:37:59 -07:00
Thomas Roughton
839d92b247 [stdlib] UnicodeScalarProperties: use RawValue over UInt32
On Windows, `__swift_stdlib_UNumericType` and `__swift_stdlib_UCharCategory` are imported as `Int32`s rather than `UInt32`. Change the constructors to use the type's inferred `RawValue` rather than always `UInt32`.
2018-08-11 12:01:19 +12:00
Ben Cohen
48e298a589 [stdlib] Remove vestigial _DisabledRangeIndex associated type (#18419)
* Remove vestigial _DisabledRangeIndex associated type

* Remove _DisabledRangeIndex from Integer types
2018-08-10 17:34:43 -06:00
Michael Ilseman
9f6eecb1ef [string] Internal Unicode.Scalar.withUTF16CodeUnits
Clean up Unicode.Scalar.Properties a bit and add internal methods to
access UTF-16 and UTF-8 code units by pointer. NFC.
2018-08-10 16:22:49 -07:00
Itai Ferber
66083f6003 Merge pull request #16238 from mortenbekditlevsen/jsoncodingkeys
[WIP] JSON Coding Keys - string keyed dictionary opt out
2018-08-09 14:25:58 -07:00
Joe Groff
8620bc619b Merge pull request #18578 from jckarter/dont-verify-roundtripping-private-types
Runtime: Don't attempt to round-trip mangled names for private types.
2018-08-08 19:19:24 -07:00
Stephen Canon
2f015ce574 Conform Float80 to CustomReflectable. (#18577)
Fixes SR-8492.
2018-08-08 19:34:17 -04:00
Joe Groff
fb05ede036 Runtime: Don't attempt to round-trip mangled names for private types.
By design, we don't want private or function-nested types to be accessible by mangled name, since they don't have stable identities, and they could inadvertently become ABI if someone serialized a mangled string and expected to deserialize it into a type. Fixes rdar://problem/39826794 .
2018-08-08 13:52:59 -07:00
Joe Groff
0f6f3493fe Demangler: Use a non-numeric introducer for anonymous context tokens.
The token contents doesn't really matter, but it can't start with a digit if it's going to show up in mangled names using identifier grammar. `s/0x/$/` for some 80s flair.
2018-08-08 13:48:24 -07:00
Morten Bek Ditlevsen
7076327ef0 Disambiguation between variable and function with same name 2018-08-08 20:32:27 +02:00
Morten Bek Ditlevsen
517bd32e2e Added comment and included reference to bug 2018-08-08 07:55:59 +02:00
Mox Soini
c66e136c18 Improve documentation for compactMapValues() of Dictionary (#18547) 2018-08-08 00:25:49 -05:00
Nate Cook
efb0415a61 [stdlib] More documentation revisions (#18263)
- Fix error in `last(where:)` example
- Improve MemoryLayout, UnsafePointer, and integer operator discussions
- Clean up ranges and random APIs
- Revisions to overflow operators and the SignedNumeric requirements
- Standardize on 'nonoptional' in remaining uses
2018-08-08 00:25:09 -05:00
Xiaodi Wu
0dcaff99eb Merge pull request #18511 from xwu/simplify-fp-int-conversion
[stdlib] Simplify concrete floating-point-to-integer conversion
2018-08-07 23:02:59 -04:00
Xiaodi Wu
c2ed788dad [stdlib] Restore rounding-based test of numeric conversion exactness 2018-08-07 21:29:51 -04:00
eeckstein
1ccad42482 Merge pull request #18520 from eeckstein/utf8iterator
stdlib: mark the UTF8View iterator's next function as inline-always.
2018-08-06 13:38:16 -07:00
Morten Bek Ditlevsen
eae25a336d Suggestion for a workaround for runtime error related to witness tables on i386 2018-08-06 20:44:43 +02:00
swift-ci
71f0248b0a Merge remote-tracking branch 'origin/master' into master-next 2018-08-06 11:07:55 -07:00