Commit Graph

13406 Commits

Author SHA1 Message Date
Saleem Abdulrasool
509060c78a build: convert paths to CMake paths before use
This converts the path separators to the CMake way.  This is primarily
important for Windows where the path separator is \ rather than /.  This
conversion allows the specification of the path in the proper windows
path style.
2018-12-30 12:27:16 -08:00
Saleem Abdulrasool
19a73ad135 SwiftShims: always define TARGET_IS_SIMULATOR
This is used as a conditional guard rather than checked for a
definition.  Ensure that a value is always defined.  Silences a -Wundef
warning.  NFC
2018-12-30 10:28:37 -08:00
Saleem Abdulrasool
1d22ee886c stubs: add workaround for Windows c++ runtime behaviour
The conversion routines in MSVCPRT return "0" for the conversion of
"-inf" et al.  Provde template specializations for `float`, `double`,
and `long double` to use `strtof`, `strtod`, and `strtold` respectively.
This fixes the lossless conversion of floating point constants.
2018-12-27 21:23:01 -08:00
Saleem Abdulrasool
39621a51e7 SwiftShims: break circular dependency in MSVCRT
The inclusion of Windows.h would cause the Shims to depend on WinSDK, which
would in turn depend on MSVCRT.  However, the SwiftShims are using in MSVCRT
causing a circular dependency between WinSDK and MSVCRT preventing a clean build
from succeeding.  Break the dependency by only including libc headers in the
shims header.
2018-12-26 14:11:04 -08:00
Valeriy Van
9c733ed67d Fixes example snippet of AnyHashable
Otherwise, `print(descriptions[AnyHashable(45)])` prints `an Int8`, not `nil`.
2018-12-26 18:35:49 +02:00
Saleem Abdulrasool
40da65a43f runtime: correct _stdlib_thread_key_create
The mapping of the return value of the `FlsAlloc` was flipped resulting
in the failure of the TLS key creation.  The test suite would fail to
generate the TLS key resulting in failures.
2018-12-23 10:02:49 -08:00
Saleem Abdulrasool
58429e7d06 Platform: add legacy compatibility macros to MSVCRT
Although technically these shouldn't be needed on Windows since there is
no compatibility to maintain since there is no version that exists
previously.  However, this will ease porting of sources to the platform.
It also ensures that future tests added cover windows as well.
2018-12-23 09:58:01 -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
Saleem Abdulrasool
7ecaeb1727 stdlib: implement _FDStreams in terms of HANDLES
Use HANDLE on Windows to create the FDStreams.  This will be used by the
standard library unit test test harness.
2018-12-21 14:19:03 -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
swift-ci
6996da5510 Merge pull request #21494 from compnerd/invalid-handle 2018-12-21 12:00:38 -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
Saleem Abdulrasool
362235c166 WindowsSDK: add definition for INVALID_HANDLE_VALUE
Since handle's are so common place on Windows and the clang importer cannot
import the complex macro for INVALID_HANDLE_VALUE, define it locally to provide
an easier path to writing swift code on Windows.  This repairs the Windows
builds.
2018-12-21 09:18:12 -08:00
swift-ci
edc20104e3 Merge pull request #21483 from DougGregor/runtime-demangle-use-after-free 2018-12-20 21:41:58 -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
Doug Gregor
f223d0b886 [Runtime] Eliminate a use-after-free when comparing @objc type names.
We were creating a local Demangler instance, demangling a type name
using it, and then returning one of the resulting nodes to the caller.

Fixes rdar://problem/46817009.
2018-12-20 20:28:23 -08:00
David Smith
016ced2c44 Adopt the new bulk Dictionary initializer in bridging 2018-12-20 16:57:38 -08:00
swift-ci
0ae5dd409e Merge pull request #21461 from compnerd/shellwapi 2018-12-20 16:47:13 -08:00
John McCall
b773fac123 Merge pull request #21453 from rjmccall/future-proof-arm64
Future-proof the ARM64 ABI by not reserving the entire top byte
2018-12-20 17:37:28 -05:00
Maxim Moiseev
a550606412 Make a couple internal functions back public 2018-12-20 14:23:27 -08:00
Max Moiseev
ff47c303ad Merge pull request #21443 from compnerd/ilp32
core: remove unsupported architecture conditional
2018-12-20 13:49:40 -08:00
Saleem Abdulrasool
c764e8a273 build: differentiate better between host and target
Assume that the build currently targets only a single target.  Use the target to
determine the linked libraries for the target library (swiftCore).  This is more
precise and more importantly, is required to enable cross-compilation of various
targets.
2018-12-20 09:18:27 -08:00
Saleem Abdulrasool
f1c2a57557 build: link swiftCore against Shell32
We are now using Shell APIs for the command line parsing.  Ensure that we link
against the Shell32 library.  This is needed for the cross-compilation as on
Windows, the environment will set a default link against a number of libraries.
This is more precise and explicit.
2018-12-20 09:13:34 -08:00
Michael Munday
cdd5aa0624 [stdlib] Fix Unicode.Scalar to String cast on big endian machines
We need to explicity ensure that an integer is in the required byte
order (little-endian in this case) before accessing it as an array
of bytes through an unsafe pointer.
2018-12-20 14:58:16 +00:00
Doug Gregor
4cdfa7e07e [IRGen/Runtime] Anonymous context descriptors can (should be) generic.
Anonymous context descriptors were being treated as non-generic by
IRGen, which lead to problems for (file)private types within generic
types. Emit generic parameters and requirements for anonymous contexts
as well.

The runtime was mostly prepared for this, and the ABI already
accounted for it, so the runtime change is minor---it only affected
building a demangle tree from metadata.

Fixes rdar://problem/46853806.
2018-12-19 23:25:59 -08:00
John McCall
6936ce7d90 Future-proof the ARM64 ABI by not reserving the entire top byte.
Targets that want to use armv8.5a memory tagging will need this.
Hopefully nobody comes up with a brilliant reason they need to use
anything else.
2018-12-20 00:30:28 -05:00
Robert Widmann
426fe886dc [SR-8272] Drop the last remnants of LogicValue
Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
2018-12-19 23:14:59 -05:00
Michael Ilseman
0ac802a95b Merge pull request #21310 from milseman/4_bit_string
[String] Last-minute ABI adjustment: 4-bit discriminator
2018-12-19 16:42:20 -08:00
swift-ci
93d6eb9478 Merge pull request #21442 from compnerd/module-map 2018-12-19 14:57:52 -08:00
Karoy Lorentey
624135641d Merge pull request #21057 from lorentey/actually-deprecate-hashValue
[Sema] Emit a deprecation warning if a Hashable type only implements hashValue
2018-12-19 22:47:16 +00:00
Saleem Abdulrasool
f8b41740e5 core: remove unsupported architecture conditional
AArch64 ILP32 support has not yet been integrated into the frontend.
Remove the conditional compilation for the target.
2018-12-19 13:56:18 -08:00
Michael Ilseman
5a6d2dfa59 [String] Switch ABI to only use 4 discriminator bits.
In anticipation of potential future HW features, e.g. armv8.5 memory
tagging, only use the high 4 bytes as discriminator bits in
_BridgeObject rather than the top 8 bits. Utilize two perf flags to
cover this instead. This requires shifting around a fair amount of
internal complexity.
2018-12-19 13:54:50 -08:00
Saleem Abdulrasool
0bdf536c8a Platform: improve WinSDK coverage further
Additional APISets are required to implement the Foundation API surface.
Expand the module to include that.  Unfortunately, I have not been able
to get the ImageHelp or the DebugHelp APIs or the RTLSupport APISet
covered under the module.  Those are required to get stack captures to
work.
2018-12-19 13:53:15 -08:00
Michael Ilseman
5d67236bc0 [String] Refactor 32-bit StringObject.
Remove Discriminator, Flags, etc., abstractions from
StringObject. These cause code divergence between 32-bit and 64-bit
ABI, complicate ABI changes, and otherwise contribute to bloat.
2018-12-19 11:19:08 -08:00
Max Moiseev
ab87c708f2 Merge pull request #21337 from moiseev/atomic-int-reshuffle
[stdlib] tee _stdlib_AtomicInt > SwiftPrivate
2018-12-19 10:00:39 -08:00
Max Moiseev
f370c676c0 Merge pull request #20962 from compnerd/libc-extras
PrivateLibcExtras: Port to Windows
2018-12-19 10:00:15 -08:00
Maxim Moiseev
165fe328c3 [stdlib] tee _stdlib_AtomicInt > SwiftPrivate
Turns out some people used this type despite it being prefixed with
`_stdlib_`, so we have to keep it, with an obsoletion message this time.
Second copy of the same type is kept available past Swift 5 in
SwiftPrivate for use in tests.
2018-12-18 16:12:47 -08:00
Saleem Abdulrasool
e86c1714a2 stdlib: extend WinSDK module for Foundation
When building foundation, we end up including the interlocked module
through CoreFoundation.  Extend the modulemap for this.
2018-12-18 15:17:17 -08:00
Karoy Lorentey
9d61bad1e5 [stdlib] Keep the first duplicate key instead of the last 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f862ad3741 [stdlib] Doc updates 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f0e04f73f4 [stdlib] Process elements from back to front 2018-12-18 09:49:58 -08:00
Karoy Lorentey
039891c24b [stdlib] Dictionary: Add support for non-unique keys in bulk loading init 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f1f5e0f2bf [stdlib] Dictionary: Add unsafe bulk-loading initializer
Interface inspired by this Array pitch:
https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689
2018-12-18 09:49:58 -08:00
Nate Cook
646849ee64 Doc fix
Co-Authored-By: lorentey <klorentey@apple.com>
2018-12-18 17:27:08 +00:00
Doug Gregor
9af6623386 Merge pull request #21379 from DougGregor/there-and-back-again-a-simd-operator-tale
Move SIMD operators back into the Swift standard library
2018-12-17 13:53:55 -08:00
Saleem Abdulrasool
1ff7823d9b Merge pull request #21369 from compnerd/winsdk
platform: widen winsdk modulemap
2018-12-17 11:09:59 -08:00
Doug Gregor
ad17e8a3ab [SIMD] Delete unnecessary comment on debugDescription.
It maakes documentation works by overriding the default.
2018-12-17 11:08:46 -08:00
Doug Gregor
69c9fbc3c8 Move SIMD operators back into the Swift standard library
Moving them out to SIMDOperators didn't help, but the type checker hack
might. Move them back into the Swift standard library where they belong,
but leave SIMDOperators there to smooth over any short-term
incompatibilities.
2018-12-17 11:07:32 -08:00
Saleem Abdulrasool
39f2ac98b7 SwiftPrivate: fix dependencies on Windows
This module needs MSVCRT and WinSDK on Windows.  Track the dependencies.
2018-12-16 22:26:44 -08:00