Commit Graph

13406 Commits

Author SHA1 Message Date
Saleem Abdulrasool
d70911e1ff SwiftPrivateLibcExtras: port to Windows
Enable the libc extras to be built for Windows.  This is a dependency
for StdlibUnittests.
2018-12-16 22:11:07 -08:00
Saleem Abdulrasool
df5712d1fd platform: widen winsdk modulemap
Add NamedPipe API Set for LibcExtras.
2018-12-16 22:11:07 -08:00
Saleem Abdulrasool
e918218b4c stdlib: make CommandLine inspection work
This implements commandline access on Windows by using the Windows Shell
API to access the commandline information and making it available in
Swift.  This is needed for the correct invocation of the child process
in the unit tests.
2018-12-16 14:04:38 -08:00
swift-ci
b9a1ad28bb Merge pull request #21353 from compnerd/_setjmp 2018-12-15 11:59:04 -08:00
Saleem Abdulrasool
df1bcb76e4 test: add ClangImporter test for _setjmp APINote
This ensures that we do not allow someone to import `_setjmp` on Windows
which is not annotated with `__attribute__((__returns_twice__))` and
cannot be adjusted without assistance from Microsoft.
2018-12-15 09:24:01 -08:00
Doug Gregor
34113d1f86 Merge pull request #21339 from DougGregor/simd-custom-string-convertible
[SIMD] Add CustomDebugStringConvertible conformance for SIMD types.
2018-12-14 20:43:36 -08:00
Luciano Almeida
2bc5623bdf [stdlib] Resolving some FIXME comments on Set type. (#20631)
* Fixing some fixmes on stdlib Set

* Adding @inline attr

* Fixing spaces

* Adding isEmpty as fast path in other places where is possible.

* Quotes on variable name on comment.

* Update stdlib/public/core/Set.swift

Co-Authored-By: LucianoPAlmeida <passos.luciano@outlook.com>

* Adding benchmark for isDisjoint Set method

* Adding empty sets to benchmark

* Fixing the factor on benchmarks and naming warnings for empty 5 words
2018-12-14 22:11:12 -06:00
swift-ci
8ea5a86dcb Merge pull request #21335 from adrian-prantl/42300829 2018-12-14 18:35:14 -08:00
Doug Gregor
fbf4bb738d [SIMD] Add CustomDebugStringConvertible conformance for SIMD types.
The old SIMD types had a conformance to CustomDebugStringConvertible,
but the new ones do not, causing a source compatibility
regression. Add back a CustomDebugStringConvertible conformance.

Fixes rdar://problem/46746829.
2018-12-14 17:00:17 -08:00
Adrian Prantl
a100d3efb4 Add a comment about keeping the runtime and LLDB in sync.
rdar://problem/42300829
2018-12-14 16:00:09 -08:00
Saleem Abdulrasool
3225e36d63 stdlib: reorder add_subdirectory to repair the Windows build
Due to the horrible attrocities against software of the attempt to perform
cross-compilation in the swift build system, we need to emulate the linking
behaviour for Windows with the link against the import library.  The emulation
requires the custom creation of import library targets.  In order to actually
get the linking semantics correct, the dependendency targets must be created
prior to use (unlike standard CMake).  The reordering ensures that we get
correct linkage when building for Windows.

Perform a simple optimization to avoid a number of string comparisions for the
host system.
2018-12-14 13:56:16 -08:00
eeckstein
18e190542f Merge pull request #21306 from eeckstein/dictionary-code-size
stdlib: Code size improvements for Dictionary for -Osize
2018-12-14 10:05:43 -08:00
Saleem Abdulrasool
ca0a622e54 Merge pull request #21293 from compnerd/msvcrt-fileio
Platform: make MSVCRT more Unix-libc like
2018-12-13 23:37:35 -08:00
Erik Eckstein
aae60ff271 stdlib: Code size improvements for Dictionary for -Osize
The first change is to remove some @inline(__always) attributes. Those were added before we had the guaranteed-by-default calling convention. They are not necessary anymore.

The second change is to not specialize some slow-path functions. This results that no specialization code for these functions is generated at the client side. Instead those functions are directly called in the libSwiftCore.
Note that Key-related hash and equality comparisons are still specialized, because otherwise the performance hit for Osize would be too big.

Some Dictionary benchmarks regress a bit with -Osize, but the code size wins are big.

rdar://problem/46534453
2018-12-13 16:59:19 -08:00
Saleem Abdulrasool
04a5d84575 Platform: make MSVCRT more Unix-libc like
Since `stdin`, `stdout`, and `stderr` are defined via macros, we cannot see them
on the swift side.  Replicate these by hand.  Expose `STDIN_FILENO`,
`STDOUT_FILENO`, and `STDERR_FILENO` for compatibility with other libc
implementations.  This reduces the need for changing the codebase unnecessarily
for MSVCRT.
2018-12-13 16:01:42 -08:00
Philippe Hausler
9e9a791e94 Revert "[Foundation] Fallback to presuming 32-bit platforms if we dont explicitly know that it is 64 bit; this allows for better portability (#21290)"
This reverts commit 77c7a69ae2.
2018-12-13 15:19:57 -08:00
Doug Gregor
cacd72f18c [Runtime] Properly unique foreign witness tables.
The Name field of a type descriptor is not the appropriate
way to compare types for uniquing. Instead, use TypeContextIdentity.

Fixes rdar://problem/46685973.
2018-12-13 13:43:36 -08:00
Lily Vulcano
d5f5ba6402 Merge pull request #21297 from millenomi/fix-crash-init-cocoaDictionary
Build crash fix: AnyObject -> NSDictionary
2018-12-13 13:25:15 -08:00
Philippe Hausler
77c7a69ae2 [Foundation] Fallback to presuming 32-bit platforms if we dont explicitly know that it is 64 bit; this allows for better portability (#21290) 2018-12-13 12:39:52 -08:00
Max Moiseev
bdc68189bf Merge pull request #21265 from moiseev/scenekit-switch-default
Use @unknown default in a switch over SCNGeometryPrimitiveType
2018-12-13 11:53:37 -08:00
Lily Vulcano
d57f714a29 Build crash fix: AnyObject -> NSDictionary
As seen in swift crashers while building https://github.com/apple/swift/pull/20103
2018-12-13 11:03:43 -08:00
Itai Ferber
d4e42c0dd1 Merge pull request #20225 from phausler/inline_data_and_dataprotocol
DataProtocol and new inline Data
2018-12-12 16:10:13 -08:00
Max Moiseev
83ccb23c97 Merge pull request #20958 from jshier/add-result
SE-0235: Add Result<Success, Failure: Error> to Standard Library
2018-12-12 14:00:15 -08:00
Maxim Moiseev
7e211c6615 Use @unknown default in a switch over SCNGeometryPrimitiveType
<rdar://problem/39029889>
2018-12-12 13:51:50 -08:00
Mike Ash
115922304e Merge pull request #21038 from sarveshtamba/master
Change 'isValidPointerForNativeRetain' check for PowerPC(ppc64le)
2018-12-12 14:03:34 -05:00
swift-ci
93023eb3c1 Merge pull request #21250 from rjmccall/revert-memory-tagging-future-proofing 2018-12-12 09:57:57 -08:00
John McCall
190943ea05 Revert "Future-proof the ARM64 ABI by not reserving the entire top byte."
This reverts commit d44851304b.
This patch does not work with our current assumptions about BridgeObject.
2018-12-12 12:01:22 -05:00
Ben Cohen
929539b4ab Merge branch 'master' into remove-strideable-closed-range-operator 2018-12-12 08:03:50 -08:00
John McCall
570840f670 Merge pull request #21204 from rjmccall/remove-xi-witnesses
Remove the extra-inhabitant value witness functions
2018-12-12 01:46:00 -05:00
John McCall
724c192120 Propagate the XI count into the get/store XI tag callbacks.
This allows callers to avoid needing to reload these tags in common cases.
2018-12-11 22:18:44 -05:00
John McCall
2ba7090fe8 Remove the extra-inhabitant value witness functions.
This is essentially a long-belated follow-up to Arnold's #12606.
The key observation here is that the enum-tag-single-payload witnesses
are strictly more powerful than the XI witnesses: you can simulate
the XI witnesses by using an extra case count that's <= the XI count.
Of course the result is less efficient than the XI witnesses, but
that's less important than overall code size, and we can work on
fast-paths for that.

The extra inhabitant count is stored in a 32-bit field (always present)
following the ValueWitnessFlags, which now occupy a fixed 32 bits.
This inflates non-XI VWTs on 32-bit targets by a word, but the net effect
on XI VWTs is to shrink them by two words, which is likely to be the
more important change.  Also, being able to access the XI count directly
should be a nice win.
2018-12-11 22:18:44 -05:00
Michael Gottesman
b2ae3a8b2c [cmake] Move add_swift_target_executable into the new stdlib cmake directory.
This will ensure that additional target executables can not be added to the rest
of the swift project without anyone noticing since the non-stdlib parts of
Swift's cmake will not have visibility of the declaration unless they change the
cmake lookup paths.
2018-12-11 16:43:49 -08:00
Michael Gottesman
191a71e10d Merge pull request #21159 from gottesmm/pr-ba57cf951f8ebe4518b4b183429a5559480dc7bb
[cmake] tools/swift-reflection-test => stdlib/tools/swift-reflection-…
2018-12-11 16:33:54 -08:00
Philippe Hausler
d030354320 Initial draft of DataProtocol ContiguousCollection and new inline Data 2018-12-11 11:19:36 -08:00
Joe Groff
e30c86769a KeyPath: Allow existing context descriptors to be used as generic environment.
If a key path literal appears in a generic context with an existing context descriptor, this will allow us to
save some code size by not having to emit a separate GenericEnvironment descriptor.
2018-12-11 09:05:47 -08:00
Joe Groff
cfb46788c7 Merge pull request #21201 from jckarter/foundation-typeByName-no-symbolic-references
stdlib: Make _typeByName Foundation SPI reject symbolic references.
2018-12-11 07:31:04 -08:00
Karoy Lorentey
ef392c1277 Merge pull request #21056 from lorentey/error-hashing
[Foundation] Update hashing for bridged NSError protocols
2018-12-11 13:17:00 +00:00
Joe Groff
85eb634191 stdlib: Make _typeByName Foundation SPI reject symbolic references.
It's used for recovering type metadata from deserialized mangled names, which should never have symbolic
references in them.
2018-12-10 20:22:03 -08:00
Joe Groff
1f5f6dbb6d Merge pull request #21186 from jckarter/public-getTypeByMangledName
Runtime: Make getTypeByMangledNameIn(Context|Environment) a public entry point.
2018-12-10 18:58:53 -08:00
Michael Ilseman
6a18fb8d83 Merge pull request #21178 from milseman/string_storage_view
[String] UTF8View implements withContiguousStorageIfAvailable
2018-12-10 15:57:15 -08:00
Mike Ash
a39ee29f0e Merge pull request #21127 from mikeash/rename-anykeypath-and-valistbuilder
[Stdlib] Rename AnyKeyPath's ObjC name and _VaListBuilder to avoid conflicts with older stdlibs.
2018-12-10 18:11:23 -05:00
Joe Groff
021053d499 Runtime: Make getTypeByMangledNameIn(Context|Environment) a public entry point.
This can be used by compiler-generated code as a size optimization for metadata access, using a
mangled name instead of possibly many open-coded metadata calls. It can also allow reflection
libraries outside of the standard library to turn type reference strings into in-process metadata
pointers in a robust way. rdar://problem/46451849
2018-12-10 14:22:41 -08:00
Jordan Rose
c66a445ef7 [stdlib] Make some more *Pointer operations _transparent (#21126)
Not only was this affecting performance when building from parseable
interfaces, but we'd also want these to be inlined for any sort of
bounds-checking diagnostics / static analysis we might get in the
future.
2018-12-10 13:37:15 -08:00
Nate Cook
2bb0b5c842 Revise some documentation comments. 2018-12-10 14:31:28 -06:00
Stephen Canon
95d76cd195 Minor improvements to CGFloat (#21090)
* Minor improvements to CGFloat

Apparently init(exactly:) was never implemented for CGFloat, so let's fix that. Also includes minor cleanup for the .magnitude property.

* Add transparent annotations to some other CGFloat things.
2018-12-10 15:31:23 -05:00
Michael Ilseman
1d9032991b [String] UTF8View implements withContiguousStorageIfAvailable 2018-12-10 11:01:28 -08:00
Valeriy Van
0e5d18654e Fixes comment for binaryString example snippet in FixedWidthInteger 2018-12-10 17:12:31 +01:00
Mike Ash
6b9480252e [Stdlib] Change AnyKeyPath to use @_objcRuntimeName attribute for its rename.
rdar://problem/46546165
2018-12-10 10:35:37 -05:00
Mike Ash
a49e2ddde7 [Stdlib] Rename AnyKeyPath's ObjC name and _VaListBuilder to avoid conflicts with older stdlibs.
rdar://problem/46546165
2018-12-10 10:17:52 -05:00
Karoy Lorentey
23188afec1 [Foundation] CocoaError.Code, URLError.Code: Remove hashValue implementation
These implementations did not produce the same hash values as the raw value. RawRepresentable provides a correct hashing implementation by default, so let’s just use that.
2018-12-10 13:00:57 +00:00