Commit Graph

12522 Commits

Author SHA1 Message Date
Mike Ash
fbe990481b [Runtime] Dynamically select the is-Swift bit at runtime on Apple platforms.
Recent Swift uses 2 as the is-Swift bit when running on newer versions, and 1 on older versions. Since it's difficult or impossible to know what we'll be running on at build time, make the selection at runtime.
2019-03-07 10:12:27 -05:00
simon gladman
df1d85f6df [Accelerate] [vDSP] Large Vector Type Conversion Operations
This PR contains a suite of overlays to the vDSP conversion functions.
2019-03-07 13:53:14 +00:00
Erik Eckstein
0dd2495815 runtime: bail in createBoundGenericType if the number of generic parameters and arguments don't match.
This can happen if _typeByName() is called with an invalid mangled type name.
2019-03-06 14:37:03 -08:00
Erik Eckstein
d7fd45d74a Remangler: Use a bump-pointer allocated string instead of std::string
Done by replacing DemanglerPrinter with a bump-pointer allocated CharVector buffer.
This avoids malloc calls.

SR-10028
rdar://problem/48575729
2019-03-06 14:37:03 -08:00
Erik Eckstein
a60086f1dd Runtime: use lambdas to avoid allocations in std::function
Instead of capturing SubstGenericParametersFromMetadata and SubstGenericParametersFromWrittenArgs by value, capture by reference.
This avoids those instances to be copied and thus avoids a lot of mallocs.

SR-10028
rdar://problem/48575729
2019-03-06 14:37:03 -08:00
Erik Eckstein
3bd7f027f8 Runtime: use SmallVector instead of std::vector to avoid memory allocations in most cases.
This dramatically reduces the number of needed malloc calls.
Unfortunately I had to add the implementation of SmallVectorBase::grow_pod to the runtime, as we don't link LLVM. This is a bad hack, but better than re-inventing a new SmallVector implementation.

SR-10028
rdar://problem/48575729
2019-03-06 14:37:03 -08:00
David Smith
909868fd67 Merge pull request #21845 from numist/numist/diffing
Ordered Collection Diffing
2019-03-05 23:08:03 -08:00
Ravi Kandhadai
6c662f7a6c [stdlib][Semantics annotation] Add ".empty" suffix to the semantics attribute of
array.init() and add semantics annotation to the compiler-intrinsic:
Array._allocateUninitializedArray
2019-03-05 17:09:34 -08:00
Max Moiseev
041eda1f27 Merge pull request #23105 from moiseev/max-datagram-size-abi
Add availability annotations to NWConnection.maximumDatagramSize
2019-03-05 15:04:41 -08:00
Maxim Moiseev
52c6e03c44 Add availability annotations to NWConnection.maximumDatagramSize
Since it did not exist pre-ABI.
<rdar://problem/48314607>
2019-03-05 10:55:14 -08:00
Scott Perry
fcf6550506 Merge branch 'master' into numist/diffing 2019-03-04 21:29:12 -08:00
Patrick Pijnappel
24282df850 [stdlib] Fix typo in comment 2019-03-05 12:05:00 +11:00
Saleem Abdulrasool
618d525b91 runtime: enable stack traces on Windows
We would not previously symbolicate the stack trace and as a result
would not display the stack trace.  Add symbolication support to the
runtime to actually make use of the captured stack trace.  This allows
us to get a stack trace when the standard library or swift code reports
a fatal error.
2019-03-04 10:39:10 -08:00
Michael Ilseman
dc89cc06e6 Merge pull request #23026 from milseman/client_helper_emitted
[stdlib] Some cleanup enabled by _alwaysEmitIntoClient.
2019-03-04 07:40:17 -08:00
Michael Ilseman
19014a85af [stdlib] Some cleanup enabled by _alwaysEmitIntoClient.
Refactor some copy-pasted code into a helper computed variable and
outline some cold paths.
2019-03-03 14:10:01 -08:00
Saleem Abdulrasool
a19a62351d Merge pull request #23029 from compnerd/list-the-ways-that-everything-is-terrible
stdlib: use the correct va_list type on Windows
2019-03-01 21:22:41 -08:00
Saleem Abdulrasool
08cf801152 Merge pull request #23030 from compnerd/this-shall-be-part-of-my-legacy
stdlib: link against legacy_stdio_definitions on Windows
2019-03-01 21:22:12 -08:00
Saleem Abdulrasool
3f849d45db Merge pull request #23011 from compnerd/file-the-line-with-the-registry
Windows test accomodations
2019-03-01 15:01:39 -08:00
Saleem Abdulrasool
c826deadb4 stdlib: link against legacy_stdio_definitions on Windows
Because Microsoft inlines the definitions of the printf family of
functions, we end up with undefined references to them.  Add an explicit
request to link against the `legacy_stdio_definitions` library when
`ucrt.C.stdio` is used which provides out-of-line definitions for them.
This fixes the building of the `stdlib/VarArgs' test.
2019-03-01 14:50:46 -08:00
Saleem Abdulrasool
75e31751ba stdlib: use the correct va_list type on Windows
Windows uses `char *` for the `va_list` type even on x86_64.  Restore
the correct selection of `__VaListBuilder` for Windows x86_64.  This
partially fixes variadic functions.
2019-03-01 14:25:26 -08:00
Saleem Abdulrasool
45fa39c855 Merge pull request #23001 from compnerd/shims
SwiftShims: update shims copying logic
2019-03-01 11:03:35 -08:00
Saleem Abdulrasool
6da949dda7 stdlib: address a compiler warning
Explicit template specialization may not have a storage class.  Remove
the extraneous storage class.
2019-02-28 23:56:12 -08:00
Saleem Abdulrasool
a227273ff4 stdlib: correct floating point parsing behaviour
These are supposed to be processed in the C locale always, irrespective
of the current locale.  We were not doing this and so we would parse the
value incorrectly.
2019-02-28 23:56:12 -08:00
Saleem Abdulrasool
06ec943d89 StdlibUnittest: add a workaround for Windows \r\n
Windows uses carriage returns and newlines.  The string matching is
sensitive to this.  Simply erase carriage returns from the standard
error stream to compensate.
2019-02-28 23:13:52 -08:00
Saleem Abdulrasool
d26ca1cd3c SwiftShims: update shims copying logic
Update the shims logic to make sure that it works for Xcode as well.
Rather than adding additional rules, just simplify it down to the one
canonical way in modern LLVM land.  The headers are always installed to
the LLVM_LIBRARY_OUTPUT_INTDIR which will be defined for us in both the
standalone and unified build mode.  This allows us to just remove all
the work to find the headers since they will always be in one location.
2019-02-28 17:11:30 -08:00
Michael Ilseman
438010d366 [gardening] Dead File Elimination 2019-02-28 10:11:11 -08:00
Max Moiseev
c903186fa4 Merge pull request #22885 from moiseev/os-log-unshadow
[os_log] Un-shadow buffer so the correct copy happens
2019-02-28 10:07:16 -08:00
Max Moiseev
3bc9ce123a Merge pull request #22964 from moiseev/nil-unwrap-location
Print nil unwrap location in no-assert builds of stdlib
2019-02-28 10:06:40 -08:00
Saleem Abdulrasool
48d8ebd1b0 Merge pull request #21606 from compnerd/you-may-not-assert
stdlib: remove some static assertions which may not hold
2019-02-28 09:49:48 -08:00
Maxim Moiseev
2ce0630b58 Print nil unwrap location in no-assert builds of stdlib
We've been collecting the location info for some time now, but
apparently never printed it in no-assert builds of the stdlib, which
means this functionality was never available to the users.

With this change, the location will be printed depending on the
debug/release build configuration of the program, not stdlib.

Somewhat addresses: <rdar://problem/42980523>
2019-02-27 16:04:30 -08:00
Saleem Abdulrasool
0983ea66ae stdlib: use placement new on Windows, disable asserts
The assertions here are based around the idea that `std::atomic` is
trivially constructible which is not a guarantee that the standard fully
provides.  The default initialization of the `std::atomic` type may
leave it in an undetermined state.  These were caught using the Visual
C++ preview runtime.

Ideally, the object constructor would use a placement new operator.
However, prior to C++17, the C++ standard mandated that there be a
NULL pointer check in the placement new operator.  This is something
which is no longer the case with C++17.  Switch to the placement new
operator for C++17 and newer and enable that codepath for Windows as
well (which seemingly elides the null-pointer check with clang-cl).
2019-02-27 15:29:06 -08:00
Scott Perry
6e3139b5da Incorporate feedback from @lorentey and @moiseev 2019-02-27 14:05:06 -08:00
David Smith
22c61e4b94 Merge pull request #22956 from mikeash/dont-require-taggedpointer-obfuscator
[Reflection] Fail gracefully when objc_debug_taggedpointer_obfuscator isn't present.
2019-02-27 13:58:20 -08:00
Mike Ash
dd170399e4 [Reflection] Add some (disabled by default) debug logging in swift-reflection-test.c. 2019-02-27 14:37:33 -05:00
Daniel Rodríguez Troitiño
3f76e63b6e Merge pull request #22899 from drodriguez/reflection-context-fix-2
Reflection: try holding 32/64 address offset in target machine pointers.
2019-02-27 11:34:36 -08:00
Daniel Rodríguez Troitiño
8bee95d232 Reflection: try holding 32/64 address offset in type big enough for all architectures.
When compiling for a 32 bit machine, uintptr_t from ReflectionInfo will
be the integer sized to hold a 32 bit pointer, so a 64 bit pointer might
not fit.

This commit removes the solution in
0f20c486e0 and does a runtime check that
the calculated offset will fit into the target machine uintptr_t, which
might not be true for 32 bits machines trying to read 64 bits images,
which should not be that common (and those images have to have offsets
bigger than what a 32 bits number can hold).
2019-02-26 13:31:35 -08:00
Max Moiseev
67f62a14f0 Merge pull request #22272 from moiseev/intents-warnings
Remove access specifiers on some extensions to avoid warnings
2019-02-25 12:53:31 -08:00
Maxim Moiseev
a0326f6514 Un-shadow buffer so the correct copy happens
Fixes: rdar://problem/48299301
2019-02-25 11:19:53 -08:00
Saleem Abdulrasool
90fd8a5d34 stdlib: define and use SWIFT_{,UN}LIKELY
Rather than directly using the extension `__builtin_expect`, use a macro
to permit the removal of the builtin on compilers which do not support
this (i.e. cl).  This permits us to build the swift compiler with MSVC
again.
2019-02-24 13:58:18 -08:00
Karoy Lorentey
fd32a3d14e [stdlib] Set availability of diffing APIs 2019-02-22 14:28:15 -08:00
Karoy Lorentey
57f4afbf84 [stdlib] Update diffing code to match stdlib coding conventions
- Add an underscore to private/internal symbols
- Make access levels explicit, even when they’re implied from context
- Conform to max line length of 80 characters
- Conformances declared on separate extensions that implement them
- Arrange member declarations so that stored properties appear first
- Expand single-letter function and type parameter names where there is an obvious name that’s more descriptive
- RangeReplaceableCollection.fastApplicationEnumeration → CollectionDifference._fastEnumeratedApply
2019-02-22 14:27:45 -08:00
Saleem Abdulrasool
3df60b4a84 SwiftRemoteMirror: fix static library builds for Windows
We were previously treating all the builds as shared, which is not the
case for the host library build of SwiftRemoteMirror.  The warnings were
lost in the interminable spew from the build which is now fixed and this
stands out.
2019-02-22 10:46:32 -08:00
Saleem Abdulrasool
0cfb54dbfa stdlib: make cl based compilation reasonable
`-Wall` with the clang-cl interface gives us `-Weverything` effectively,
which really reduces the effectiveness of the warnings.  Switch to `/W3`
which is roughly equivalent to `-Wall` in clang mode.
2019-02-21 22:38:02 -08:00
Saleem Abdulrasool
f58155924c stdlib: repair the Windows build
The recent change to enable the stack traces requires a dependency on
DbgHelp which we were not linking against.  Add the link.
2019-02-21 16:03:53 -08:00
Saleem Abdulrasool
cf6addc12b Merge pull request #22755 from jmittert/WindowsBacktrace
Fix StackTraces on Windows
2019-02-21 14:13:48 -08:00
Jason Mittertreiner
1abe971a16 Fix StackTraces on Windows 2019-02-20 12:59:54 -08:00
Saleem Abdulrasool
6e768e0998 WIndows: add an explicit cast
The constant value is imported as an unsigned value which means that we
cannot or the values together.  Add an explicit cast.
2019-02-20 09:44:19 -08:00
swift-ci
bbaf48a53a Merge pull request #22747 from compnerd/complexity-is-in-the-eye-of-the-beholder 2019-02-20 09:06:13 -08:00
Saleem Abdulrasool
ed4cf1a1b9 Windows: add a couple of constants to WinSDK
Add some WinUser.h (User32) constants to WinSDK to make it easier to use
the WinSDK for more purposes (e.g. SwiftWin32).
2019-02-20 07:46:21 -08:00
swift-ci
7ea8768127 Merge pull request #22569 from Catfish-Man/cheating-the-reaper 2019-02-19 21:58:19 -08:00