Commit Graph

10155 Commits

Author SHA1 Message Date
Alex Langford
50a0e87c69 [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.
2019-08-08 11:50:35 -07:00
Alexander Shaposhnikov
791ca54397 Add .note.swift_reflection_metadata 2019-08-08 01:02:46 -07:00
Karoy Lorentey
d7e57347ee [stdlib] Unify _NativeDictionary.subscript._modify’s two yields to work around SR-10604 2019-08-07 17:15:04 -07:00
David Smith
5a1f068415 Remove dead shim code 2019-08-07 16:50:47 -07:00
swift-ci
b2d83d4c99 Merge pull request #26422 from Catfish-Man/its-about-sending-a-message 2019-08-07 15:57:00 -07:00
David Smith
d0ed51925b Review comments and subsequent build fix on https://github.com/apple/swift/pull/26422 2019-08-07 13:42:51 -07:00
Michael Munday
bb2740e540 IRGen: fix enum bit packing on big-endian platforms.
This change modifies spare bit masks so that they are arranged in
the byte order of the target platform. It also modifies and
consolidates the code that gathers and scatters bits into enum
values.

All enum-related validation tests are now passing on IBM Z (s390x)
which is a big-endian platform.
2019-08-07 03:54:16 -04:00
Doug Gregor
8340e0b745 Merge pull request #26509 from DougGregor/runtime-protocol-extension-fail-fast-search
[Runtime] Short-circuit search for context descriptor for protocol extensions
2019-08-06 15:26:49 -07:00
Stephen Canon
fb2128b33b Remove doc comments from concrete floating-point types (#26399)
* Remove doc comments from concrete floating-point types

... when they are already present on the protocol. I don't *think* that we need them anymore for xcode documentation purposes. There are reasonable arguments both ways on this:
1. when you're editing the concrete implementations, it's sometimes nice to have the doc comment right there.
2. but it needlessly repetitive, and introduces the opportunity for comments to get out of sync.
3. it also adds noise; it would be nice for information density if the implementation only had implementation notes.

* Add examples to documentation for FloatingPoint.isCanonical

In particular, document that subnormal encodings are treated as non-canonical zeros on platforms that flush to zero.

* Additional fixes by @xwu and @natecook1000 .
2019-08-06 18:17:37 -04:00
Mike Ash
9fd03e24ad [Runtime] Avoid function pointer indirection in refcounting functions.
Functions like swift_retain call through a function pointer so that Instruments can interpose. This slows down the common case where there is no interposition. Instead, initialize the function pointers to NULL and call through directly to the real implementation when it's NULL. The compiler is smart enough to inline this call and the result is a single conditional branch rather than a function pointer call.

rdar://problem/18307425
2019-08-06 14:29:51 -04:00
Doug Gregor
17b917fef9 [Runtime] Short-circuit search for context descriptor for protocol extensions
When looking for a context descriptor for a protocol extension, we
search based on the mangled name--"x", a generic type parameter with
depth and index 0--and are guaranteed to fail because there is no such
concrete type. However, _findContextDescriptor will fail very slowly,
spinning through all of the types and conformances in all of the
loaded images. Moreover, negative results aren't cached, so this can
happen repeatedly.

Short-circuit _findContextDescriptor when it receives a dependent
generic type parameter type, avoiding the expensive search when it
will find nothing.

Potential fix for rdar://problem/53560010.
2019-08-05 22:05:53 -07:00
Daniel Rodríguez Troitiño
7e332e4437 Merge pull request #23208 from buttaface/droid
[android] Add support for natively building on Android
2019-08-05 08:39:40 -07:00
Azoy
ab5ef84046 Fix crash on tuple metadata dump 2019-08-03 01:27:44 -04:00
David Smith
0887299d9e Fix sub-scalar index distances in foreign UTF8 views 2019-08-02 16:45:42 -07:00
Alex Langford
184d942ba0 [CMake] add_swift_target_library shouldn't implicitly set INSTALL_IN_TARGET
This makes it more explicit what the install component of a target
library is if you don't see one (and its marked as IS_SDK_OVERLAY).
Explicit in this case makes more sense, as you don't have to rely on
knowledge of how `add_swift_target_library` is implemented to understand
what component is used to install the target.
2019-08-02 13:51:52 -07:00
swift-ci
749d4b018d Merge pull request #26442 from alexshap/fix_glibc 2019-08-02 10:32:07 -07:00
David Smith
c5fc715746 Reimplement the CF stub system using ObjC. The primary effect of this is to break the link-time dependency on the CF symbols, but it also improves performance a bit.
One additional tweak (setting the scalar-aligned bit on foreign indices) had to be made to avoid a performance regression for long non-ASCII foreign strings.
2019-08-01 19:56:45 -07:00
swift-ci
d5d4ac672b Merge pull request #26338 from xiaobai/debride-option 2019-08-01 18:42:33 -07:00
Alexander Shaposhnikov
4a66d9f55f [Glibc] Add missing entry for link.h 2019-07-31 16:35:09 -07:00
JF Bastien
31e6a989f5 [NFC] Don't use LLVM_ALIGNAS (#26411)
It's not useful anymore, and I'm about to remove it in upstream.
2019-07-30 13:14:02 -07:00
Karoy Lorentey
a25e53468e [gardening] Delete StringGutsVisitor.swift (#26393) 2019-07-29 19:08:46 -07:00
Butta
796d6ade9a [android] Add support for natively building on Android
Check if building on Android through the ANDROID_DATA environment variable, then set
SWIFT_ANDROID_NATIVE_SYSROOT to the default layout for the Termux app, and key all the
include, lib, and other SDK paths off of that. The system libc and a few other libraries
are linked against from /system/lib[64]. Finally, check if lit is running natively on
Android and don't use adb if so.
2019-07-30 00:38:36 +05:30
Xiaodi Wu
a078c33ceb [stdlib] Change documented behavior of FloatingPoint.significand (#26390) 2019-07-29 11:08:04 -04:00
Karoy Lorentey
62c1cf31d2 Merge pull request #26022 from anandabits/Identifiable
Add Identifiable protocol to the standard library
2019-07-26 17:38:26 -07:00
David Smith
e7b1107212 Merge pull request #26374 from Catfish-Man/unindex-set
Remove unused Foundation subclasses
2019-07-26 17:09:45 -07:00
David Smith
48266a6f56 Remove unused Foundation subclasses 2019-07-26 14:47:43 -07:00
swift-ci
f34ef5db85 Merge pull request #24356 from zetasq/zetasq-fix-KVO 2019-07-25 15:14:18 -07:00
Alex Langford
a16c71cc86 [CMake] Remove TARGET_LIBRARY option from add_swift_target_library
If you're calling add_swift_target_library, you already know it's a
target library.
2019-07-24 14:55:08 -07:00
Saleem Abdulrasool
f26048df0e Merge pull request #26210 from compnerd/dynamic-only
stdlib: prevent static builds on Darwin
2019-07-23 19:22:54 -07:00
Saleem Abdulrasool
de2dc570dc Merge pull request #26295 from Lukasa/cb-crash-on-invalid-random-buffer-size
Avoid uninitialized "random" bytes on Windows.
2019-07-23 19:17:33 -07:00
Ross Bayer
3257761ae0 [Build System: CMake] Move the CompatibilityDynamicReplacements library into the stdlib/toolchain source directory. 2019-07-23 15:34:17 -07:00
Ross Bayer
1a8dff82be [Build System: CMake] Move the Compatibility50 library into the stdlib/toolchain source directory. 2019-07-23 15:34:17 -07:00
Ross Bayer
6d0450a688 [Build System: CMake] Move the legacy_layouts content into stdlib/toolchain, a new directory of content that is installed only in the toolchain. 2019-07-23 14:15:36 -07:00
Cory Benfield
c2b6c8aa16 Avoid uninitialized "random" bytes on Windows.
__swift_size_t on Windows is a size_t, which makes it potentially a
64-bit integer. ULONG, however, is always a 32-bit integer, and so this
cast risks shrinking the apparent size of the cbBuffer argument to
BCryptGenRandom. The effect of that will be to underfill the buffer,
leaving it full of uninitialized memory that we would treat as random.

The actual risk from this in the current implementation is basically
zero, as user code can only ever invoke this with an argument size of 8.
There's no good reason to leave this sharp edge on the API though.
2019-07-23 17:50:34 +01:00
Saleem Abdulrasool
9fb525006c stdlib: prevent static builds on Darwin
Static builds of the standard library and the SDK overlay are
unsupported post ABI stability.  Disallow building of the standard
library and SDK overlay statically for Darwin platforms.
2019-07-19 08:05:57 -07:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
eeckstein
63a1a42643 Merge pull request #26185 from eeckstein/old-condfail
Support the old single-parameter Builtin.condfail
2019-07-18 13:38:47 +02:00
swift-ci
70d4630690 Merge pull request #26194 from Catfish-Man/if-it-quacks-like-a-key 2019-07-17 20:39:55 -07:00
David Smith
5e83f80d6f Let NSMutableDictionary check for -copy on keys, rather than doing it ourselves with a full (slow) conformance check 2019-07-17 15:50:03 -07:00
Michael Gottesman
eb9b24104e Merge pull request #26158 from gottesmm/pr-ed0fb2c51d1ce701156c957f511f6ee3b57f1e7a
[ast] Refactor Builtin printing logic from ASTPrinter -> BuiltinInst.
2019-07-17 11:24:56 -07:00
Erik Eckstein
117b1dafe6 Rename the two-parameter Builtin.condfail(c, message) to Builtin.condfail_message(c, message)
This is necessary to also support the old single paramter Builtin.condfail(c)
2019-07-17 17:41:59 +02:00
Michael Gottesman
f952ff0ee4 [ast] Move printing code from ASTPrinter onto a helper on BuiltinType and have ASTPrinter call that instead. 2019-07-16 23:26:01 -07:00
swift-ci
c76925c4ea Merge pull request #26152 from Catfish-Man/serrated-surrogates 2019-07-16 15:38:25 -07:00
David Smith
d091ecb009 Restore more-correct behavior of getting the full contents of bridged NSStrings containing invalid UTF-8 2019-07-16 12:05:56 -07:00
Saleem Abdulrasool
8b1079de45 Merge pull request #26163 from compnerd/correct-case-is-useful
Platform: fix library link names
2019-07-16 11:45:46 -07:00
Saleem Abdulrasool
a2ceae970b Platform: fix library link names
This adjusts the library link names so that linking works properly on
case sensitive file systems (e.g. ext4) when cross-linking.
2019-07-16 10:26:42 -07:00
Michael Munday
3844cb2177 Merge pull request #26144 from linux-on-ibm-z/runtime-enum-simplifications
Runtime: simplify loading and storing enum values
2019-07-16 18:19:53 +01:00
Erik Eckstein
6ed8a084d9 stdlib: Use the new failure message method for the "unexpected found nil while unwrapping an optional" failure message.
Advantage: the failure message is now also visible in release builds.
2019-07-16 14:51:18 +02:00
Erik Eckstein
3195bdc973 stdlib: let _precondition include the file+line info in debug builds.
For using the improved condfail messages in the stdlib, we need a function, like precondition(), just taking a StaticString instead of a String for the message.
The existing (underscored) _precondition is a perfect fit for this, except that it's not printing the location info in debug builds.
This change makes _precondition() equivalent to precondition, just taking a StaticString as argument.

The other alternative would be to add another variant of precondition, just taking a StaticString. But we already have so many failure functions in Assert.swift, so adapting an existing one seems to be a better solution.
This effectively undos a change from 5 years ago which intentionally removed the location info from _precondition (rdar://problem/16958193).  But this was at a time where swift was not open source yet. So I think today it's okay to always add location information, even if it's from inside the stdlib. It can be even very useful for expert users for looking up the location the stdlib source.
2019-07-16 14:51:18 +02:00
Erik Eckstein
b40ce6b34f SIL: add a failure message operand to Builtin.condfail
The SIL generation for this builtin also changes: instead of generating the cond_fail instructions upfront, let the optimizer generate it, if the operand is a static string literal.
In worst case, if the second operand is not a static string literal, the Builtin.condfail is lowered at the end of the optimization pipeline with a default message: "unknown program error".
2019-07-16 14:44:09 +02:00