Commit Graph

5263 Commits

Author SHA1 Message Date
Scott Perry
df3a058a6f s/shortestEditScript/difference/g per proposal feedback 2019-01-21 22:31:04 -08:00
samding01
197c9634b4 fixed small String comparsion for big_endian 2019-01-21 19:09:07 +00:00
Ben Cohen
4363f61dec Mark ClosedRange->Range conversion inlinable 2019-01-18 17:27:27 -08:00
Mike Ash
ae0f04ab23 Merge pull request #21958 from mikeash/rename-avoid-more-objc-conflicts
[stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
2019-01-18 17:18:03 -05:00
Slava Pestov
5e2e467b05 Merge pull request #21631 from Azoy/something-something-string-storage
[stdlib] NFC: Simplify _getCString
2019-01-18 13:28:36 -05:00
Michael Ilseman
a088e13224 [String] Add UTF-8 fast-paths for Foundation initializers
Many Foundation initializers could benefit from faster string
construction and subsequent reads in Swift 5. Add UTF-8 fast paths for
when constructing a string from a valid UTF-8 code units.
2019-01-17 14:15:40 -08:00
Mike Ash
faceaaa0ab [stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
JSONEcoder/Decoder get another underscore in their ObjC name, as the one with a single underscore conflicts with older Swifts that had _JSONEcoder/Decoder as internal rather than fileprivate.

_JSONEncoder/Decoder get another underscore in their Swift name to avoid conflicting with the ObjC name from the ones in older overlays.
2019-01-17 17:12:01 -05:00
Ben Cohen
eb083ce84d Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage" (#21874)
* Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage"
2019-01-16 10:22:58 -08:00
Mike Ash
fa5888fb3f [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request #19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
2019-01-15 12:21:20 -05:00
John McCall
f771e4c36d Merge pull request #21237 from drodriguez/aapcs64-valist
[stdlib][SR-2239] Refactor AAPCS64 variable argument list support.
2019-01-14 23:48:14 -05:00
Max Moiseev
22b514353c Merge pull request #20715 from anayini/contiguous-array-codable
[SR-7076] Make ContiguousArray Codable
2019-01-14 17:07:39 -08:00
Scott Perry
c0c068d663 Match indentation style 2019-01-14 15:53:24 -08:00
Max Moiseev
3b6c6cc0a5 Merge pull request #19532 from dlbuckley/SR-8649_ranges_codable
SR-8649: Range types conform to Codable
2019-01-14 14:38:32 -08:00
swift-ci
77ec709128 Merge pull request #21820 from freak4pc/sm/typo 2019-01-14 09:07:29 -08:00
Scott Perry
1af14db552 Initial import of diffing package into standard library 2019-01-13 20:17:20 -08:00
swift-ci
b3a20520f7 Merge pull request #21711 from apple/marcrasi-const-evaluator-strings 2019-01-12 12:32:19 -08:00
Shai Mishali
6bfe3dadc5 Minor typo fix understimatedCap -> underestimatedCap 2019-01-12 15:37:01 +02:00
Joe Groff
9669c3a703 KeyPaths: Don't relative-reference selector refs.
ld64 doesn't like this. Instead, generate a stub function to grab the instantiated selector. Fixes rdar://problem/47184763.
2019-01-10 14:32:50 -08:00
Daniel Rodríguez Troitiño
7cfaf9fae2 [stdlib][SR-2239] Refactor AAPCS64 variable argument list support.
This refactoring uses large portions of the already existing code for
x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where
each implementation differ are the x86_64 header, and the order of the
general and vector registers.

The changes also addresses many of the request from the reviewers in
 #20862 which were not addressed originally, like the reuse of the
already existing code, and the generalizations for the code to be useful
for platforms different than Linux (Android, for example).
2019-01-09 13:45:04 -08:00
Saleem Abdulrasool
5282e92e47 Merge pull request #21707 from compnerd/placeholder-less
[build] remove special placeholder libraries
2019-01-08 16:23:32 -08:00
Lance Parker
15aaa1e777 [stdlib]String normalization functions (#21026)
* fast/foreignNormalize functions
2019-01-08 13:55:29 -08:00
Marc Rasi
0eff06e4f9 const evaluator: string values and init operations 2019-01-08 11:57:27 -08:00
Saleem Abdulrasool
6dac8dd092 build: cleanup swiftCore link definition
Colocate the target specific library specification.  Inline the single
site use of the place holder ICU_UC and ICU_I18N libraries rather than
trying to create special library processing code for that.
2019-01-08 08:31:35 -08:00
Saleem Abdulrasool
5482409fb7 build: clean up unused variable (NFC)
Remove the unused parameter from the build (NFC).
2019-01-08 08:31:35 -08:00
Pavol Vaskovic
66bc1661b2 Merge pull request #21658 from palimondo/within-one-stem
[stdlib] Use ContiguousArray internally in Sequence dropLast, prefix, suffix
2019-01-08 12:22:11 +01:00
Michael Munday
8d4608f8e4 [string] Improve some small string comments
Clarify the expected behavior of some small string helper functions.
2019-01-08 06:15:54 -05:00
Michael Munday
9587582c86 [string] Fix string implementation for big endian platforms
This commit supersedes 2866b4a which was overwritten by 4ab45df.

Store small string code units in little-endian byte order. This way
the code units are in the same order on all machines and can be
safely treated as an array of bytes.
2019-01-07 09:01:43 -05:00
Raj Barik
fc90a0009a Add @inline(__always) to stdlib function for performance parity 2019-01-05 17:39:59 -08:00
Pavol Vaskovic
c887116862 [stdlib] dropLast, prefix, suffix: ContiguousArray
Nano-optimization:
Following the template used in methods `map` and `_filter`, internally use ContiguousArray before converting to an Array on return.
2019-01-05 14:28:37 +01:00
Pavol Vaskovic
a1fb6f1278 [stdlib] Gardening: ringBuffer position index 2019-01-05 14:27:03 +01:00
Raj Barik
3faf741288 Merge pull request #21617 from rajbarik/raj-perf-stdlib
Add inline(always) to AnyCollection routines like _suffix, _prefix, _drop, ...
2019-01-04 08:39:57 -08:00
Johannes Weiss
3f4990dc3c Merge pull request #21611 from weissi/jw-make-urbp-contiguous
conform Unsafe(Mutable)RawBufferPointer conform to _HasContiguousBytes
2019-01-04 10:36:08 +00:00
Azoy
5532a16205 simplify _getCString 2019-01-03 22:00:58 -06:00
Kuba Mracek
b9b4c789f3 Fix a data race on _swiftEmptyArrayStorage reported by TSan. Array.append(contentsOf) used to write a 0 into _buffer.count causing a race. 2019-01-03 17:26:18 -08:00
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00
Andrew Trick
0b5fa792e1 Force manual allocation (via Unsafe*Pointer) to use >= 16 alignment.
This fixes the Windows platform, where the aligned allocation path is
not malloc-compatible. It won't have any observable difference on
Darwin or Linux, aside from manually allocated memory on Linux now
being consistently 16-byte aligned (heap objects will still be 8-byte
aligned on Linux).

It is unfortunate that we can't guarantee Swift-allocated memory via
Unsafe*Pointer is malloc compatible on Windows. It would have been
nice for that to be a cross platform guarantee since it's normal to
allocate in C and deallocate in Swift or vice-versa. Now we have to
tell developers to always use _aligned_malloc/_aligned_free when
transitioning between Swift/C if they expect their code to work on
Windows.

Even though this fix isn't required today on Darwin/Linux, it makes
good sense to guarantee that the allocation/deallocation paths are
consistent.

This is done by specifying a constant that stdlib can use to round up
alignment, _swift_MinAllocationAlignment. The runtime asserts that
this constant is greater than MALLOC_ALIGN_MASK for all platforms.
This way, manually allocated buffers will always use the aligned
allocation path. If users specify an alignment less than m

round up so users don't need
to pass the same alignment to deallocate the buffer). This constant
does not need to be ABI.

Alternatives are:

1. Require users of Unsafe*Pointer to specify the same alignment
   during deallocation. This is obviously madness.

2. Introduce new runtime entry points:
   swift_alignedAlloc/swift_alignedDealloc, introduce corresponding
   new builtins, and have Unsafe*Pointer always call those. This would
   make the runtime API a little more obvious but would introduce
   complexity in other areas of the compiler and it doesn't have any
   other significant benefit. Less than 16-byte alignment of manually
   allocated buffers on Linux is a non-goal.
2019-01-03 12:35:51 -08:00
Raj Barik
4be5ab167e Add inline(always) to AnyCollection routines like _suffix, _prefix, _drop 2019-01-03 11:33:09 -08:00
Michael Ilseman
e6586ac209 Merge pull request #21465 from linux-on-ibm-z/s390x-unicode-scalar-fix
[stdlib] Fix Unicode.Scalar to String cast on big endian machines
2019-01-03 11:32:23 -07:00
Johannes Weiss
f87ffd2077 conform Unsafe(Mutable)RawBufferPointer conform to _HasContiguousBytes 2019-01-03 18:23:08 +00:00
Harlan Haskins
b29f1ee1a2 Merge pull request #21527 from nordicio/stdlib_warning_stringstorage
[stdlib] fixes warning: result of call to 'initialize(from:)' is unused
2019-01-03 10:03:49 -08:00
Valeriy Van
a4496d51d8 Fixes typo in var name in example snippet (#21553)
imagePaths is declared in line 320
2019-01-02 16:21:42 -06:00
Dennis Vennink
45429ffa24 Add Zip2Sequence.underestimatedCount (#21530) 2019-01-02 12:46:49 -05:00
Saleem Abdulrasool
b7aca2bd06 Merge pull request #21462 from compnerd/build-host-target
build: differentiate better between host and target
2019-01-02 08:35:51 -08:00
Andreas Jönsson
121f15b2ac [stdlib] fixes warning: result of call to 'initialize(from:)' is unused 2018-12-23 00:20:01 +01:00
Saleem Abdulrasool
f1043e4aa7 build: correct case for STREQUAL (NFC)
The swift variables use the upper case spelling while CMake uses mixed
case.  Use the correct case to fix the build.  This is preferable to
using MATCH to avoid the unnecessary configure time penalties.
2018-12-21 15:51:57 -08:00
Max Moiseev
1116525f92 Merge pull request #21475 from moiseev/atomic-int-func-public
[stdlib] Make a couple internal functions back public
2018-12-21 12:12:25 -08:00
David Smith
4e4325d248 Merge pull request #21235 from Catfish-Man/cheaper-by-the-dozen
Adopt bulk Dictionary creation in bridging
2018-12-21 11:37:40 -08:00
Robert Widmann
2efbeb3912 Merge pull request #21451 from CodaFi/logicd
[SR-8272] Drop the last remnants of LogicValue
2018-12-20 23:33:20 -05:00
swift-ci
0ae5dd409e Merge pull request #21461 from compnerd/shellwapi 2018-12-20 16:47:13 -08:00
Maxim Moiseev
a550606412 Make a couple internal functions back public 2018-12-20 14:23:27 -08:00