Commit Graph

10155 Commits

Author SHA1 Message Date
David Smith
35e21b0bbd SR-10556 _foreignGrow should use the uninitialized-buffer String initializer once it's in 2020-02-19 11:17:11 -08:00
David Smith
6616e812c6 Merge pull request #29909 from Catfish-Man/cant-switch-off-a-switched-off-lightswitch
Avoid incorrectly asserting when we disable pure Swift deallocation on an object that has a side table
2020-02-18 15:10:56 -08:00
David Smith
4bd56334ef Avoid incorrectly asserting when we disable pure Swift deallocation on an object that has a side table 2020-02-18 11:44:37 -08:00
Mike Ash
2763e13a9a [Stdlib] Fix an overrelease in -[__SwiftNativeNSError description].
getDescription takes its argument at +1, but the implementation was passing the value directly. This caused the contained error value to be destroyed.

rdar://problem/59512630
2020-02-18 11:30:03 -05:00
swift-ci
04fafd7e26 Merge pull request #29881 from swiftwasm/swiftwasm-string 2020-02-18 04:22:21 -08:00
Slava Pestov
c4203ddafa Merge pull request #29887 from slavapestov/conformance-cache-sillyness
Runtime: Less eager instantiation of type metadata in the conformance cache
2020-02-17 20:47:47 -05:00
Slava Pestov
4e39455173 Update ProtocolConformance.cpp 2020-02-17 17:54:26 -05:00
Slava Pestov
1ca2b61f7a Runtime: Less eager instantiation of type metadata in the conformance cache
The ConformanceCandidate constructor would eagerly instantiate metadata for
all non-generic types in the conformance cache. This was not the intention
of the code though, because it can compare nominal type descriptors --
which are emitted statically -- for those types that have them, namely
everything except for foreign and Objective-C classes.

Change the order of two calls so that the lazy path has a chance to run.
This fixes a crash when type metadata uses weakly-linked symbols
which are not available, which can come up in backward deployment
scenarios.

Fixes <rdar://problem/59460603>.
2020-02-17 16:24:42 -05:00
Mike Ash
57a3df5da9 Merge pull request #29848 from mikeash/eagerly-realize-empty-singletons
[Stdlib] Eagerly realize EmptyDictionarySingleton and EmptySetSingleton.
2020-02-17 09:56:19 -05:00
Max Desiatov
8e705f3413 [WebAssembly] Add wasm32 support to stdlib String 2020-02-17 12:51:34 +00:00
tbkka
4d0e2adbef Further refinement of {Float,Double,Float80}.init(_:String) (#29028)
* Further refinement of {Float,Double,Float80}.init(_:String)

After talking with @stephentyrone, I found some additional simplifications. No
functional change, just shorter/simpler.

This makes the generic inlineable part a small stub that delegates to the full
non-inlined version.

ABI compatibility:
* We support the same generic init() as before
* _swift_stdlib_strtoXYZ_clocale is still available to
  support old inlined code

API addition:
* We now have a public specialized form of init?(_: Substring)
  in addition to the generic init?<S:StringProtocol> form.

* Add @available marker to new API

* Support back-deployment to older OSes by inlining the full version
2020-02-14 16:16:29 -08:00
Mike Ash
440d2799f7 [Stdlib] Eagerly realize EmptyDictionarySingleton and EmptySetSingleton.
These objects can escape into ObjC without their class being realized first, which can cause a crash if the unrealized class gets passed into the ObjC runtime.

rdar://problem/59295395
2020-02-14 11:57:52 -05:00
Devin Coughlin
664e7cc00e [Availability] Make _stdlib_isOSVersionAtLeast() no longer inlinable
To make it possible to change the implementation of
_stdlib_isOSVersionAtLeast(), remove the @inlinable attribute from it.

Since it is currently inlinable and calls the helper function
_swift_stdlib_operatingSystemVersion(), we’ll have to keep the
helper around as ABI.

This change causes a minor pessimization where the LLVM optimizer can no
longer reason that, for example, a successful check for 10.12 availability
means that a later check for 10.11 will always succeed. I don't expect this
pessimization to be a problem, but if needed we could write a custom SIL
optimizer pass to claw back the performance.

<rdar://problem/59447474>
2020-02-13 20:08:48 -08:00
Dmitri Gribenko
3566e6ed7a Merge pull request #29530 from swiftwasm/swiftwasm-ifdefs
[WebAssembly] Add ifdefs for the WASI target
2020-02-13 17:40:45 +01:00
tbkka
74df8725ab SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta (#29779)
* SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta

An earlier fix for certain protocol casts inadvertently disabled
the check for a protocol being cast to its own metatype.
This rearranges the code so that identical types always succeed.
It also updates swift_dynamicCastMetatypeUnconditional to
include recent changes to swift_dynamicCastMetatype.

Note: These fixes only apply to debug/non-optimized builds.
Cast optimizations still break a lot of these cases.
2020-02-12 14:24:31 -08:00
Karoy Lorentey
bbd888f727 Merge pull request #29498 from xwu/any-hashable-docs
[docs] Update AnyHashable documentation
2020-02-12 13:16:15 -08:00
nate-chandler
b62871047d Merge pull request #29345 from nate-chandler/generic-metadata-prespecialization-components/enums
Generic metadata prespecialization: enums
2020-02-12 13:09:59 -08:00
Saleem Abdulrasool
97df90fbf1 Merge pull request #29581 from drexin/wip-fix-atomics
Remove dependency on libatomic on Linux
2020-02-11 20:03:10 -08:00
Robert Widmann
054d7b9913 Merge pull request #29713 from CodaFi/unused-unwanted-unloved
[Gardening] Silence Some Warning Spew
2020-02-11 15:46:16 -08:00
Nate Chandler
949029a788 [metadata prespecialization] Create enum records.
Extracted implementation of SpecializedGenericStructMetadataBuilder into
SpecializedGenericNominalMetadataBuilderBase, a CRTP with a template
template argument for the CRTP superclass and a template argument for
the implementation.  That new type is now subclassed by
SpecializedGenericStructMetadataBuilder.  Additionally, this new type is
also subclassed by the newly added SpecializedGenericEnumMetadataBuilder
which is responsible for build the prespecialization of generic enum
metadata.

rdar://problem/56960887
2020-02-11 09:57:22 -08:00
swift-ci
e7e6d27ac9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-08 10:24:29 -08:00
Max Desiatov
67297904ac [WebAssembly] Add ifdefs for the WASI target 2020-02-08 07:37:10 +00:00
Ravi Kandhadai
ec9844b2d9 [SIL Optimization] Add a new mandatory pass for unrolling forEach
calls over arrays created from array literals. This enables optimizing
further the output of the OSLogOptimization pass, and results in
highly-compact and optimized IR for calls to the new os log API.

<rdar://58928427>
2020-02-07 20:06:29 -08:00
Robert Widmann
d2360d2e8c [Gardening] dyn_cast -> isa 2020-02-07 16:09:31 -08:00
swift-ci
0cbfcbb517 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 21:44:26 -08:00
Robert Widmann
1ed846d852 Merge pull request #25696 from kelvin13/comparable-enums
synthesized comparable for enums
2020-02-06 21:38:36 -08:00
Xiaodi Wu
06f12fc268 Incorporate further review comments 2020-02-05 20:30:33 -05:00
swift-ci
6fb97ab34e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 08:25:22 -08:00
NevinBR
a7f28785c9 Fixes for FixedWidthInteger.random(in: ClosedRange<Self>, using:) (#29633)
Allow the closed-range version of `FixedWidthInteger.random(in:using:)` to work for types larger than 64 bits when the entire valid range (`.min ... .max`) is passed in.

Also, closed ranges are never empty, so the unnecessary `!isEmpty` precondition has been removed.
2020-02-05 17:17:20 +01:00
Butta
3f4109b3a2 [android] Get build scripts working natively, fix tests and install
The build scripts assume Android cross-compilation using the NDK, so avoid
that configuration if building on an Android host. Fix or disable some tests,
and don't install a glibc.modulemap without a native sysroot prefix.
2020-02-05 11:36:33 +05:30
Kelvin
19a8759cee Merge branch 'master' into comparable-enums 2020-02-04 22:08:40 -06:00
Dario Rexin
d913eefcc9 Remove dependency on libatomic on Linux
Due to some unfortunate interplay between clang and libstdc++, clang was
not able to correctly identify to alignment of PoolRange and
SideTableRefCountBits, causing it to emit library calls instead of
inlining atomic operations. This was fixed by adding the appropriate
alignment to those types. In addition to that the march for the Linux
target was set to 'core2', which is the earliest architecture to support
cx16, which is necessary for the atomic operations on PoolRange.
2020-01-31 15:59:54 -08:00
Xiaodi Wu
4ee0cc16e1 Update stdlib/public/core/AnyHashable.swift
Co-Authored-By: Karoy Lorentey <klorentey@apple.com>
2020-01-29 21:15:04 -05:00
swift-ci
770f5e252c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 18:44:06 -08:00
Max Desiatov
44a6475566 [WebAssembly] enable shims and stubs for WASI (#29505)
* [WebAssembly] enable shims and stubs for WASI

* Implement _swift_stdlib_getUnsafeArgvArgc for WASI

* Make include unconditional, add JIRA links
2020-01-28 18:29:52 -08:00
Xiaodi Wu
518ccce520 Optimize documentation wording for clarity 2020-01-28 21:07:58 -05:00
Xiaodi Wu
1e861acd1f Incorporate review comments 2020-01-28 21:00:52 -05:00
swift-ci
98bd56e58d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 11:03:20 -08:00
Ravi Kandhadai
566d574f4d Merge pull request #29501 from ravikandhadai/constexpr-binary-integer-description
[Constant Evaluator] Add support for BinaryInteger.description which converts an integer to a string
2020-01-28 11:01:47 -08:00
Ravi Kandhadai
c198c1a2aa [Constant Evaluator] Add support for BinaryInteger.description which
converts an integer to a string. This patch adds a @_semantics
annotation to the BinaryInteger.description function.
2020-01-27 21:13:50 -08:00
Xiaodi Wu
31e9807fc8 Update AnyHashable documentation 2020-01-27 22:00:33 -05:00
swift-ci
52f62ce7da Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:03:21 -08:00
David Smith
c6a428f3d9 Update fast dealloc to match libobjc 2020-01-24 15:32:27 -08:00
swift-ci
3e462f7502 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 13:44:38 -08:00
eeckstein
7b12c2efbf Merge pull request #29353 from eeckstein/dict-code-size
stdlib: move Dictionary's find functions into __RawDictionaryStorage.
2020-01-24 22:37:14 +01:00
swift-ci
bea4bf586d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 13:23:36 -08:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
Saleem Abdulrasool
5280fb081f build: remove SWIFT_BUILD_STDLIB check (NFC)
The swiftReflection library is only being built under a standard library
build.  The check is already present at a higher level, so there is no
need to replicate the check.
2020-01-24 08:22:19 -08:00
Erik Eckstein
78728d8df5 stdlib: extract the common code of _NativeDictionary.resize and copyAndResize into a separate function
For code size reduction.
2020-01-24 10:40:41 +01:00
Doug Gregor
660d124cda Revert accidental change that removed the Network overlay 2020-01-23 22:05:41 -08:00