Commit Graph

1782 Commits

Author SHA1 Message Date
swift-ci
03c738e9ec Merge remote-tracking branch 'origin/master' into master-next 2018-05-11 00:29:02 -07:00
Joe Groff
0d438c91c4 [Demangle to metadata] Support simple extension contexts.
Support demangling for types nested within some simple extension contexts.
Still does not support nested types within constrained extensions that
involve same-type constraints among generic parameters, nor
deeply-nested types in extensions. However, it fixes
rdar://problem/40071688.
2018-05-10 23:36:01 -07:00
swift-ci
8daaa4ea35 Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 14:49:25 -07:00
Mike Ash
75450e5b3c Merge pull request #16472 from mikeash/silence-offsetof-warning
[Runtime] Silence warnings for offsetof usage on TupleCacheEntry.
2018-05-10 17:29:31 -04:00
swift-ci
8733e2bdaf Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 09:49:16 -07:00
Saleem Abdulrasool
f4c24d6e2e Merge pull request #16403 from lanza/inspect-arch-sdk
Configure the swiftImageInspectionShared to generate arch & sdk speci…
2018-05-10 09:42:35 -07:00
Mike Ash
89bf915e99 Merge branch 'master' into runtime-conformance-scanning-lockless-array 2018-05-09 15:23:36 -04:00
Mike Ash
b821a2ef6d [Runtime] Silence warnings for offsetof usage on TupleCacheEntry.
rdar://problem/39739801
2018-05-09 13:51:59 -04:00
Nathan Lanza
9815368788 Configure the swiftImageInspectionShared to generate arch & sdk specific libraries
Previously, swiftImageInspectionShared generated one specific library at
`lib/libswiftImageInspectionShared.a` for only the main arch and sdk.
Generic cross compilation and various changes to the build system to get
cross compilation to work will require swiftImageInspectionShared to
generate libraries at the proper subdirectory. Change the outputs to
agree with paths such as `lib/swift/linux/x86_64`
2018-05-03 12:33:45 -07:00
swift-ci
49b2c7fe2a Merge remote-tracking branch 'origin/master' into master-next 2018-05-01 12:08:52 -07:00
Arnold Schwaighofer
1f65ee25f6 Distinguish between withoutActuallyEscaping and passing @noescape
Objective C closures when reporting that a closure has escaped

rdar://39682865
2018-05-01 07:24:19 -07:00
swift-ci
13ab622cba Merge remote-tracking branch 'origin/master' into master-next 2018-04-30 17:09:26 -07:00
Michael Gottesman
54137ed302 Merge pull request #16242 from davezarzycki/nfc_misc_warning_fixes
[Misc] NFC: Fix random build warnings
2018-04-30 17:04:29 -07:00
swift-ci
b80f58cbcf Merge remote-tracking branch 'origin/master' into master-next 2018-04-30 13:29:16 -07:00
Mike Ash
8459167b3e Merge pull request #16253 from mikeash/disable-mangled-name-verification
[Runtime] Disable mangled name verification unless specifically enabled with an environment variable.
2018-04-30 13:18:52 -07:00
Michael Gottesman
0d1f98a4ef Merge pull request #16259 from gottesmm/pr-aab473d24268b0934ac216bf2683f0a2c8e3be0f
[+0-all-args] Make _bridgeAnythingNonVerbatimToObjectiveC() take its …
2018-04-30 13:14:46 -07:00
swift-ci
9d81e603c3 Merge remote-tracking branch 'origin/master' into master-next 2018-04-30 12:29:27 -07:00
Michael Gottesman
c31033c525 [+0-all-args] Make _bridgeAnythingNonVerbatimToObjectiveC() take its parameter at +1.
This hoists out the retain into Swift code from the casting runtime and along a
few paths in the runtime allows us to eliminate a dynamic retain release.

rdar://38196046
rdar://38771331
2018-04-30 11:05:00 -07:00
Michael Gottesman
87681375e2 [+0-all-args] Change _swift_stdlib_bridgeErrorToNSError to take its parameter at +1.
This is truly a consuming operation. This can be seen since we always would need
to retain the argument here. This makes guaranteed -> owned less transformation
effective. Instead represent it taking a +1 argument so that the retain happens
outside the builtin instead of inside the builtin.

This also allows me to remove an extra copy from dynamicCastValueToNSError

rdar://38771331
2018-04-30 10:16:41 -07:00
David Zarzycki
95473a10d7 [Misc] NFC: Fix random build warnings
Unused variables/methods, language extensions, extra semicolons, intentional
self assignment, platform specific quirks, etc.
2018-04-30 12:52:43 -04:00
Mike Ash
8b59295a92 [Runtime] Change protocol conformance scanning to use a concurrent array rather than a locked vector.
rdar://problem/37173156
2018-04-30 12:24:47 -04:00
Mike Ash
09e1e355a4 [Runtime] Disable mangled name verification unless specifically enabled with an environment variable.
rdar://problem/39821779 rdar://problem/39821761 rdar://problem/39821758
2018-04-30 10:56:09 -04:00
swift-ci
3aa10bbefc Merge remote-tracking branch 'origin/master' into master-next 2018-04-27 20:29:05 -07:00
Mike Ash
5fc07b8709 Merge pull request #16188 from mikeash/assert-metadata-mangled-name-roundtrip
[Runtime] Assert that metadata mangled names successfully roundtrip.
2018-04-27 20:09:24 -07:00
swift-ci
1f1646b88b Merge remote-tracking branch 'origin/master' into master-next 2018-04-27 08:49:00 -07:00
Mike Ash
91619c4cd0 [Runtime] Make mangled name roundtrip verification a soft failure. Disable it entirely when running tests and when bootstrapping swiftpm, for now.
rdar://problem/37551850
2018-04-27 10:09:06 -04:00
Arnold Schwaighofer
dab3b0b184 Runtime: Fix swift_bridgeObjectRetain family of functions to return the input
object

Now we can use swift_bridgeObjectRetain's return value in BridgeObjectBox.
2018-04-27 06:14:32 -07:00
swift-ci
647867db68 Merge remote-tracking branch 'origin/master' into master-next 2018-04-26 16:29:08 -07:00
tbkka
924b8e55d5 Updates to Floating-point printing code (SwiftDtoa.cpp) (#16178)
This collects a number of changes I've been testing over the
last month.

* Bug fix: The single-precision float formatter did not always
  round the last digit even in cases where there were two
  possible outputs that were otherwise equally good.

* Algorithm simplification: The condition for determining
  whether to widen or narrow the interval was more complex than
  necessary. I now simply widen the interval for all even
  significands.

* Code simplification: The single-precision float formatter now uses fewer
  64-bit features.  This eliminated some 32-bit vs. 64-bit conditionals in
  exchange for a minor loss of performance (~2%).

* Minor performance tweaks: Steve Canon pointed out a few places
  where I could avoid some extraneous arithmetic.

I've also rewritten a lot of comments to try to make the exposition
clearer.

The earlier testing regime focused on testing from first
principles.  For example, I verified accuracy by feeding the
result back into the C library `strtof`, `strtod`, etc. and
checking round-trip exactness.  Unfortunately, this approach
requires many checks for each value, limiting test performance.
It's also difficult to validate last-digit rounding.

For this round of updates, I've instead compared the digit
decompositions to other popular algorithms:
* David M. Gay's gdtoa library is a robust and well-tested
  implementation based on Dragon4.  It supports all formats, but
  is slow. (netlib.org/fp)
* Grisu3 supports Float and Double.  It is fast but incomplete,
  failing on about 1% of all inputs.
  (github.com/google/double-conversion)
* Errol4 is fast and complete but only supports Double.  The
  repository includes an implementation of the enumeration
  algorithm described in the Errol paper.
  (github.com/marcandrysco/errol)

The exact tests varied by format:

* Float: SwiftDtoa now generates the exact same digits as gdtoa
  for every single-precision Float.

* Double: Testing against Grisu3 (with fallback to Errol4 when
  Grisu3 failed) greatly improved test performance.  This
  allowed me to test 100 trillion (10^14) randomly-selected
  doubles in a reasonable amount of time.  I also checked all
  values generated by the Errol enumeration algorithm.

* Float80: I compared the Float80 output to the gdtoa library
  because neither Grisu3 nor Errol4 yet supports 80-bit extended
  precision.  All values generated by the Errol enumeration
  algorithm have been checked, as well as several billion
  randomly-selected values.
2018-04-26 16:09:49 -07:00
Mike Ash
77e9b967f3 [Runtime] When asserts are enabled, verify that each newly created Metadata successfully roundtrips its mangled name through the demangler.
rdar://problem/37551850
2018-04-25 16:26:23 -04:00
swift-ci
4a97d36810 Merge remote-tracking branch 'origin/master' into master-next 2018-04-23 15:09:14 -07:00
Doug Gregor
d755b38ee5 [Runtime] Teach BridgeObjectBox::retain() not to drop the "not native" bit.
The "not native" bit in a BridgeObject is important, because it tells
us when we need to go through the Objective-C -retain method
vs. swift_retain. Losing the bit means that swift_retain() will stomp
on some memory within an Objective-C object, thinking its the inline
reference count.

Co-debugged with Arnold, who then found where this bit was getting dropped.
Fixes rdar://problem/39629937.
2018-04-23 14:04:22 -07:00
swift-ci
ba738b8e7d Merge remote-tracking branch 'origin/master' into master-next 2018-04-20 23:29:32 -07:00
Slava Pestov
902c0d3586 Runtime: Handle symbolic references inside other mangling nodes
Previously we could only handle symbolic references at the
top level, but this is insufficient; for example, you can
have a nested type X.Y where X is defined in the current
translation unit and Y is defined in an extension of X in
a different translation unit. In this case, X.Y mangles as
a tree where the child contains a symbolic reference to X.

Handle this by adding a new form of Demangle::mangleNode()
which takes a callback for resolving symbolic references.

Fixes <rdar://problem/39613190>.
2018-04-20 21:55:45 -07:00
swift-ci
44b4be86f4 Merge remote-tracking branch 'origin/master' into master-next 2018-04-20 08:27:12 -07:00
Michael Gottesman
636b5f67f0 [runtime] Add support for an asserts only debugging routine called swift_dumpTrackedAccesses().
This makes it easy to perform printf debugging in the debugger. I have found it
to be useful in understanding programs around exclusivity quickly.
2018-04-19 21:37:12 -07:00
swift-ci
add7d7f078 Merge remote-tracking branch 'origin/master' into master-next 2018-04-17 13:29:17 -07:00
Joe Groff
b8426862c1 Runtime: Quell a warning about useless const on a function typedef. 2018-04-17 10:46:01 -07:00
swift-ci
4213f96247 Merge remote-tracking branch 'origin/master' into master-next 2018-04-15 18:29:35 -07:00
Saleem Abdulrasool
d3ab36fd46 Merge pull request #15745 from compnerd/dota
runtime: avoid UB on Windows x86_64 builds
2018-04-15 18:18:47 -07:00
swift-ci
08a91a27dd Merge remote-tracking branch 'origin/master' into master-next 2018-04-12 14:37:29 -07:00
Saleem Abdulrasool
3b45ce660c Merge pull request #15905 from compnerd/protocol
stdlib: correct protocol registration on ELF
2018-04-12 14:29:11 -07:00
Saleem Abdulrasool
9969679515 stdlib: correct protocol registration on ELF
We were misinterpreting the protocol conformances as the protocol sections.  It
is interesting that this never was caught in any of the runs on the build bots
nor was it caught during the normal execution of code.
2018-04-12 10:07:41 -07:00
swift-ci
9494376793 Merge remote-tracking branch 'origin/master' into master-next 2018-04-12 09:53:01 -07:00
tbkka
1cc1832b96 SR-3131: Adjust choice of decimal vs. exponential format (#15805)
Merge SR-3131 fix:

For each floating-point type, there is a range of integers which
can be exactly represented in that type.  Adjust the formatting
logic so that we use decimal format for integers within this
range, exponential format for numbers outside of this range.

For example, Double has a 53-bit significand so can exactly
represent every integer from `-(2^53)...(2^53)`.  With this
change, we now use decimal format for these integers and
exponential format for values outside of this range.  This is
a relatively small change from the previous logic -- we've
basically just moved the cutoff from 10^15 to 2^53 (about 10^17).

The decision for using exponential format for small numbers is
not changed.
2018-04-12 09:35:49 -07:00
swift-ci
4b5a4a963d Merge remote-tracking branch 'origin/master' into master-next 2018-04-11 10:08:16 -07:00
Doug Gregor
5832a6fe12 [CMake] Link demangle tree dumper in +Asserts builds.
When building with assertions enabled, link the demangle tree dumper into
the runtime and remote mirrors libraries. This makes debugging demangling-related issues a whole lot easier.
2018-04-10 21:17:09 -07:00
swift-ci
f10f7caca7 Merge remote-tracking branch 'origin/master' into master-next 2018-04-10 18:29:44 -07:00
Joe Groff
4f26ef749c Merge pull request #15841 from jckarter/box-error-as-nserror
Runtime: Bridge Error-conforming types to id as NSError instances.
2018-04-10 18:19:50 -07:00
Joe Groff
78b5ff8b6b Runtime: Bridge Error-conforming types to id as NSError instances.
NSError is a more useful box for a swift Error than the generic box. Fixes rdar://problem/38631791 | SR-7232.
2018-04-10 12:23:49 -07:00