Commit Graph

13406 Commits

Author SHA1 Message Date
Harlan Haskins
047749a745 Merge pull request #25419 from harlanhaskins/property-reprs
[ModuleInterface] Qualify all types in module interfaces
2019-06-14 14:23:08 -07:00
Mike Ash
2ac0ab069a [Runtime] Use objc_addLoadImageFunc when available to find out about newly loaded images.
rdar://problem/49742015
2019-06-14 17:09:28 -04:00
Arnold Schwaighofer
5003c15079 stdlib: Add backward deployment versions for the
dynamic-replacement runtime functions.

The recent change of how we do dynamic replacements added 2 new runtime
functions. This patch adds those functions to the Compatibility50 static
archive.

This will allow backward deployment to a swift 5.0 runtime.

Patch by Erik Eckstein with a modification to call the standard
libraries implementation (marked as weak) when it is available.

This ensures we can change the implementation in the future and are not
ABI locked.

rdar://problem/51601233
2019-06-14 10:53:26 -07:00
Saleem Abdulrasool
5befea4d8d build: query the resource dir when needed
When building the standard library standalone with the host compiler, we
do not have the location of the resource dir available to us nor can it
be computed.  Use `-print-resource-dir` to query the value from the
compiler and use that.  This is needed to cross-compile the standard
library to android from Windows.
2019-06-13 22:55:03 -07:00
Karoy Lorentey
8ae76342f8 [Foundation] Set correct availability on NSValue.value(of:)
(cherry picked from commit 35a47b3a55e113fd1212485b85d808427ccf5dea)
2019-06-13 20:10:06 -07:00
Karoy Lorentey
dcda278cb3 [SDK] Add overlay shims for ClockKit framework 2019-06-13 17:05:40 -07:00
Vlad Gorloff
28d1fb65b7 Android Mac Cross-compile: Fixes issue "ld.gold: error: cannot find -lutil". 2019-06-13 23:57:18 +02:00
ravikandhadai
6d3e3f02eb Merge pull request #24971 from ravikandhadai/oslog-optimization-transparent
[os_log][SIL Optimization] Make new os log APIs @_transparent and change OSLogOptimization pass so that inlining is not performed.
2019-06-13 11:46:12 -07:00
Harlan Haskins
f02bac341f Add new flag to XCTest overlay 2019-06-13 11:26:54 -07:00
Nate Cook
e730bd1256 Remove residual gyb bits from LazyPrefixWhileCollection. 2019-06-13 11:39:15 -05:00
Karoy Lorentey
6a2123fbb7 Merge pull request #25364 from lorentey/ModelIO-arrays
[SDK] Modernize array initialization pattern in ModelIO overlay
2019-06-12 11:28:15 -07:00
Stephen Canon
2df36527d3 Provide a default implementation of multipliedFullWidth (#25346)
* Provide a default implementation of multipliedFullWidth

Previously, [U]Int64 fatalErrored on 32b platforms, which is obviously undesirable. This PR provides a default implementation on FixedWidthInteger, which is not ideally efficient for all types, but is correct, and gives the optimizer all the information that it needs to generate good code in the important case of Int64 arithmetic on 32b platforms. There's still some minor room for improvement, but we'll call that an optimizer bug now.

* Clarify comments somewhat, remove `merge` nested function

I was only using `merge` in one place, so making it a function seems unnecessary. Also got rid of some trucatingIfNeeded inits where the compiler is able to reason that no checks are needed anyway.

* Add some basic test coverage specifically for multipliedFullWidth

* Fix typo, further clarify bounds comments.

* Make new defaulted implementation @_aEIC so we don't need availability.
2019-06-11 22:02:48 -07:00
Saleem Abdulrasool
9f070edc17 Merge pull request #25308 from Azoy/demangle-bug-thing
[Runtime] swift_demangle: Update buffer size after copying
2019-06-11 16:56:57 -07:00
Ravi Kandhadai
27eefd7311 [os_log][SIL Optimization] Make new os log APIs @_transparent and
change OSLogOptimization pass so that inlining is not performed.
2019-06-11 15:47:21 -07:00
Karoy Lorentey
b4998fb9ff [SDK] Modernize array initialization pattern in ModelIO overlay
We have nondeterministic test failures indicating a memory safety issue in ModelIO’s overlay. This switches the overlay’s property implementations to use the new `Array(unsafeUninitializedCount:,initializedWith:)` initializer rather than the potentially unreliable `&values[0]` pattern.

rdar://problem/50449570
2019-06-11 15:18:44 -07:00
Slava Pestov
67fd1f2372 Foundation: Manually define hashValue witnesses for CocoaError, URLError, POSIXError and MachError 2019-06-11 14:26:21 -07:00
Slava Pestov
3491fecc04 Revert "Sema: Go back to synthesizing hashValue on _StoredBridgedNSError conformers"
This reverts commit 712927c494.
2019-06-11 14:22:48 -07:00
Karoy Lorentey
fd39f2f9d2 Merge pull request #25301 from fassko/SR_10094_withContiguousStorageIfAvailable_docs
[Doc] [SR-10094]  Add missing documentation for SE-0237
2019-06-11 11:52:50 -07:00
Karoy Lorentey
b48175525e Merge pull request #25345 from lorentey/foundation-diff-apis
[Foundation] Bridge difference APIs between Foundation and swift stdlib
2019-06-11 11:43:10 -07:00
Stephen Canon
bbd44a186f Replace two #ifs with #if/#else in new integer random algorithm (#25352)
Swift gets used on archs other than 32 and 64b Intel and ARM (e.g. IBM's systems); as written this would fail to compile there.
2019-06-11 14:36:43 -04:00
Slava Pestov
6ee5774371 Merge pull request #25349 from slavapestov/synthesized-hashValue-abi-break
Sema: Go back to synthesizing hashValue on _StoredBridgedNSError conformers
2019-06-11 11:32:21 -07:00
Gwen Mittertreiner
defd518fa3 Merge pull request #25334 from gmittert/DeviceIoControl
Add WinSDK constants to get Symlink Information
2019-06-11 09:39:21 -07:00
Slava Pestov
712927c494 Sema: Go back to synthesizing hashValue on _StoredBridgedNSError conformers
Commit e0bba70 added a default implementation, however this is wrong
for non-imported types.

Instead, synthesize the body as before. Since this is one of the few
derived methods that can appear on an imported type, make sure to
build fully type-checked AST.

Fixes <rdar://problem/51322302>.
2019-06-11 02:46:10 -07:00
Pavol Vaskovic
2bc648c26b [stdlib] Lemire’s Nearly Divisionless Random Integer Generation (#25286)
* [stdlib] Lemire’s nearly divisionless random int

Implementation of Daniel Lemire’s “Fast Random Integer Generation in Interval”
See https://arxiv.org/pdf/1805.10941.pdf

* [stdlib] Simpler, optimized expression

* [stdlib] O'Neill’s modulo optimization

See http://www.pcg-random.org/posts/bounded-rands.html#optimizing-modulo

* [stdlib] Remove modulo optimization

Swift, compared to C, seems unable to generate tightly fused instructions here for some reason (probably the division by zero check?)… removing.

* [stdlib] Keep OpenBSD debiasing method on 32-bit

systems until the https://bugs.swift.org/browse/SR-10910 is resolved.

* [stdlib] TODO FIXME SR-10912

Remove the old OpenBSD generation method, once 32-bit systems support multipliedFullWidth on UInt64.
2019-06-10 22:44:09 -04:00
Karoy Lorentey
89b918a35a [Foundation] Temporarily revert to 9999 versions 2019-06-10 17:46:03 -07:00
Scott Perry
b10632811f [Foundation] Bridge difference APIs between Foundation and swift stdlib
rdar://problem/51604652
2019-06-10 17:45:54 -07:00
Gwen Mittertreiner
2a76bcb032 Add WinSDK constants to get Symlink Information
Added FSCTL_GET_REPARSE_POINT, FSCTL_SET_REPARSE_POINT,
FSCTL_DELETE_REPARSE_POINT to allow manipulation of reparse points via
DeviceIoControl
2019-06-10 14:12:31 -07:00
Saleem Abdulrasool
ad913239ee Merge pull request #25161 from drodriguez/android-backtraces
[android] Basic support for backtraces.
2019-06-10 13:44:51 -07:00
Steve (Numerics) Canon
4b5a85a34d Fix a bug in root and add a test case for it.
For odd roots of negative values, we need to take the root of the *magnitude* of the number to avoid a NaN from the platform's implementation of `pow`, then restore the sign afterwards. We had the basic logic in place already, but were missing the step of taking the magnitude first. Also modified a test case to find this error.
2019-06-10 11:50:36 -04:00
Saleem Abdulrasool
2bc397be59 Merge pull request #25292 from drodriguez/windows-fix-numeric-parsing
[windows] Fix usage of strtof/d/ld function usage.
2019-06-08 16:21:00 -07:00
Azoy
f79eb3b8d0 swift_demangle: update buffer size after copying 2019-06-07 18:06:32 -05:00
Kristaps Grinbergs
f0e3a99f97 [Doc] [SR-10094] Add missing documentation for SE-0237
https://bugs.swift.org/browse/SR-10094
2019-06-07 14:32:42 -07:00
Daniel Rodríguez Troitiño
19a1e2c07d [windows] Fix usage of strtof/d/ld function usage.
The error conditions for underflow or overflow weren't being checked,
which caused problems in some tests.
2019-06-06 13:09:15 -07:00
Mishal Shah
c2848e793f Merge pull request #25236 from apple/update-master-xcode-11-beta1
Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs
2019-06-06 11:22:40 -07:00
Mishal Shah
817ea129f2 Revert "Use the remaining half bit in the refcount to bypass ObjC deallocation overhead" 2019-06-05 23:10:34 -07:00
swift-ci
189bd6c13b Merge pull request #25102 from Catfish-Man/no-objc-complications-2 2019-06-05 21:24:41 -07:00
David Smith
8abffa7d89 Use the remaining half bit in the refcount to bypass ObjC deallocation overhead 2019-06-05 14:10:19 -07:00
Saleem Abdulrasool
1d1c362aba StdlibUnittest: consume the carriage return on stdout
This was already being done for the stderr, but not for stdout.  Doing
this means that we no longer get spurious carriage returns on the stdout
output stream on Windows.  This is needed for supporting the
validation test suite on Windows.
2019-06-05 13:59:22 -07:00
Daniel Rodríguez Troitiño
a7025522a4 [android] Basic support for backtraces.
Android doesn't support the GNU backtrace call, but unwind.h is there to
help. The code is a little bit more complicated than a simple backtrace
call, but it is just a callback and the context struct.

Sadly, it seems that -funwind-tables is needed in every piece of code
that the backtrace needs to traverse, which means that at least the
runtime and the stubs need -funwind-tables. However, the flag has been
enabled for all targets (only on Android), just in case some other code
ends up being in the stack. This might only be necessary for ARM
targets, but currently we only build ARM targets in Android. The Swift
parts of the stack seems to have unwind information and can be unwind.

Another problem at the moment is the symbols from the executable are
normally missing. To get symbol names two things need to happen: the
symbol has to be public (so it is an exported symbol, and not just a
local symbol that dladdr seems to not provide the name), and the linker
has to be invoked with -export-dynamic. Without those two pieces, the
addresses are returned (and match the binary just fine), but no names
are printed.
2019-06-05 13:12:04 -07:00
Saleem Abdulrasool
c63114f12c stdlib: enable RuntimeUnittest on Windows
No longer limit this to POSIX platforms.  The threading has been
generalised to support all targets.
2019-06-05 09:04:05 -07:00
mishal_shah
1e38fc3030 Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs 2019-06-03 22:50:02 -07:00
Joe Groff
4ed8de10f9 Revert "Revert "Use autolinking to pull in compatibility libraries."" 2019-06-03 20:10:51 -07:00
Joe Groff
a7cc3a38cc Revert "Use autolinking to pull in compatibility libraries." 2019-06-03 14:18:39 -07:00
Mishal Shah
6c69c8d0bb Merge pull request #25135 from porglezomp-misc/fix/stdlib-unittest-over-release
FIx an overrelease in StdlibUnittest's getSystemVersionPlistProperty
2019-06-03 13:35:04 -07:00
Saleem Abdulrasool
5fa42c06d8 Merge pull request #25203 from compnerd/more-suites-more-better
stdlib: permit builtin Collections and Unicode tests everywhere
2019-06-03 10:38:34 -07:00
Saleem Abdulrasool
651045f66a Merge pull request #25208 from compnerd/tautologically-incomplete
swift-reflection-test: silence tautological warning
2019-06-03 08:43:23 -07:00
Joe Groff
a740ee55b2 Merge pull request #25148 from jckarter/runtime-compatibility-autolink
Use autolinking to pull in compatibility libraries.
2019-06-03 08:22:49 -07:00
Saleem Abdulrasool
7b1f732b1d swift-reflection-test: silence tautological warning
PE/COFF does not permit weak linking semantics.  This means that the
expression `&symbol == NULL` is tautologically false.  In order to
support this semantic, the symbol needs to be dynamically looked up at
runtime.  Since the ObjC runtime is not in use on Windows currently,
just ignore this for the time being.  Silences a warning from clang
about the tautological comparison.
2019-06-02 11:36:49 -07:00
Saleem Abdulrasool
33767d6052 runtime: silence a unused definition warning (NFC)
When building without assertions, the variable will be unreferenced on
non-ObjC runtimes.  Sink the evaluation into the assertion and move the
declaration into the ObjC runtime case.
2019-06-02 11:22:35 -07:00
Saleem Abdulrasool
114e812631 stdlib: permit builtin Collections and Unicode tests everywhere
The pthread dependency has been lifted through the Windows port
generalising the SwiftThreadExtras.  Enable building these unit test
binaries which are needed for the validation test suite.
2019-06-02 11:19:25 -07:00