Commit Graph

12522 Commits

Author SHA1 Message Date
Mike Ash
213efbbfaa [Runtime] Avoid +class overrides when initializing an ObjC class.
swift_getInitializedObjCClass called [c class] to trigger class initialization, and returned the value. This wreaked havoc when the class in question overrides +class. Instead, ignore the return value and return c. Switch from +class to +self, which is much less likely to be overridden. Calling an overridden method could have performance downsides or even cause unwanted side effects.

rdar://problem/49853091
2019-05-08 16:17:56 -04:00
Mike Ash
0ea82d6890 Merge pull request #24534 from mikeash/swiftnativexxx-warnings-fix
[Stdlib] Fix warnings about designated initializers in SwiftNativeXXX classes.
2019-05-08 13:26:28 -04:00
Daniel Rodríguez Troitiño
47be3d68bd Merge pull request #24547 from drodriguez/android-remove-uuid-from-glibc
[android] Remove uuid.h from Android's Glibc.
2019-05-07 10:58:44 -07:00
Davide Italiano
92daf4ba04 Merge pull request #24217 from dcci/check-boundaries-reflection
[Reflection] Check that the offset is within the section.
2019-05-07 10:10:18 -07:00
Daniel Rodríguez Troitiño
562b79dcf7 [android] Remove uuid.h from Android's Glibc.
Android doesn't ship with uuid.h, so having a module pointing to that
header is an error.
2019-05-06 17:31:45 -07:00
Davide Italiano
b4434fdd8d [Reflection] Fix the computation of boundaries in getFieldName(). 2019-05-06 17:27:20 -07:00
Saleem Abdulrasool
8047351375 WinSDK: correct FIONBIO 2019-05-06 17:24:21 -07:00
Daniel Rodríguez Troitiño
7d0b78d00f [android] Stop leaking FDs in parent test process.
In the Android paths of the spawnChild function, the parent was creating
a pipe that was never closed, which led to FD starvation. In some tests
with a lots of expected crashes, the childs will not spawn anymore since
the linker would not have enough descriptors to open the shared
libraries, while in other tests which closed the child descriptors as
part of the last test, the parent process will hang waiting those
descriptors to be closed, which will never had happened.

The solution is implement the missing parts of the code, which tried to
read from the pipe in the parent side (using select and read, taking
pieces from other parts of the code). This should match the fork/execv
path used by Android and Haiku to the spawn code used by the rest of the
platforms.

This change fixes StdlibUnittest/Stdin.swift,
stdlib/InputStream.swift.gyb,
stdlib/Collection/FlattenCollection.swift.gyb and
stdlib/Collection/LazyFilterCollection.swift.gyb, which were the last 4
tests failing in Android AArch64.
2019-05-06 17:15:07 -07:00
Mike Ash
3ad6e46930 [Stdlib] Fix warnings about designated initializers in SwiftNativeXXX classes. 2019-05-06 17:15:53 -04:00
Michael Gottesman
4d4d6f6779 Merge pull request #24508 from compnerd/matchy-matchy
build: rename `LLVM_COMPONENT_DEPENDS`
2019-05-06 11:45:36 -07:00
Nicholas Maccharoli
cd5055711a Fix syntax error in comment code
Closing parentheses is missing in the example code.
2019-05-06 01:38:47 +09:00
Saleem Abdulrasool
218b37e1bb build: rename LLVM_COMPONENT_DEPENDS
This is not a target dependency but a target link.  Name the parameter
to be less misleading.  This also makes the name identical to the LLVM
parameter.
2019-05-04 19:58:28 -07:00
Karoy Lorentey
fbe5563d60 [Foundation] Fix availability of NSValue.value(of:) 2019-05-03 19:55:03 -07:00
David Smith
1192b914d2 Merge pull request #24457 from Catfish-Man/two-by-two-length-of-blue
Fix bounds check in bridged ASCII String comparison
2019-05-03 18:28:55 -07:00
Davide Italiano
1acedc6c69 [Reflection] Check that the offset is within the section.
<rdar://problem/49043621>
2019-05-03 17:09:09 -07:00
Patrick Pijnappel
87f02b173b [stdlib] Refactor range overlaps for performance 2019-05-04 09:15:21 +10:00
David Smith
008699e52d Fix bounds check in bridged ASCII String comparison 2019-05-03 15:55:58 -07:00
Ross Bayer
2493986369 Merge pull request #24419 from Rostepher/toolchain-apinotes
[Build System: CMake] Install the apinotes in the 'compiler' install component.
2019-05-03 11:45:18 -07:00
Joe Groff
6c779bb487 Merge pull request #24445 from jckarter/opaque-type-remote
Debugger support for opaque types.
2019-05-03 08:18:59 -07:00
Ross Bayer
c10b815ba4 [Build System: CMake] Install the apinotes in the 'compiler' install component when compiling for Darwin platforms.
Setting the CMake cache variable SWIFT_INCLUDE_APINOTES to true will override the default behavior and unconditionally create the install targets.
2019-05-02 18:42:37 -07:00
ravikandhadai
6069814d66 Merge pull request #24335 from ravikandhadai/oslog-refactoring
[os_log][stdlib-private] Refactor new os log APIs based on string interpolation for enabling optimizations.
2019-05-02 15:16:43 -07:00
Karoy Lorentey
d6f44ccdd8 Merge pull request #24421 from lorentey/blow-up-overlays
[CMake] Split overlay list to multiple lines (NFC)
2019-05-02 11:50:09 -07:00
Mike Ash
8d2b1bbf7b Merge pull request #24394 from mikeash/decode-the-undecodable
[Stdlib] Make the SwiftNativeNSXXXBase classes gracefully handle being decoded with NSKeyedUnarchiver.
2019-05-02 10:06:06 -04:00
Karoy Lorentey
1dbb4830c5 [CMake] Split overlay list to multiple lines 2019-05-01 18:53:52 -07:00
swift-ci
0d955da8e6 Merge pull request #24397 from ravikandhadai/consteval-string-append-changes 2019-05-01 16:23:35 -07:00
Keita Nonaka
0613cd3e6b Merge remote-tracking branch 'origin' into fix-build-warnings 2019-05-01 19:10:31 -04:00
Ravi Kandhadai
37f00edabc [os_log][stdlib-private] Refactor implementation and add optimization
attributes to the new os log APIs based on string interpolation so
that it can be optimized by the new OSLogOptimization compiler pass.
2019-05-01 15:42:37 -07:00
Mike Ash
7506e9c4f8 [Stdlib] Make the SwiftNativeNSXXXBase classes gracefully handle being decoded with NSKeyedUnarchiver.
These would never be decoded in normal use, but it's possible to construct an archive that will attempt to decode them. Without this override, that throws an exception or worse.

rdar://problem/48429185
2019-05-01 10:04:14 -04:00
Saleem Abdulrasool
2e7c328077 Merge pull request #24168 from xiaobai/sink_component_arg
[CMake] Modify swift_install_in_component to support cmake install components
2019-04-30 21:06:32 -07:00
Ravi Kandhadai
a7b7db7854 [Constant Evaluator] Move "string.append" semantics attribute from
`String.+=` function to `String.append` function, and use a new
semantics attribute for String.+=.

Teach the constant evaluator about `String.Append` instead of `String.+=`.
2019-04-30 14:26:06 -07:00
swift-ci
59a11983bc Merge pull request #24286 from drodriguez/android-glibc-modulemap 2019-04-30 13:02:43 -07:00
simon gladman
a55641a1b2 [vImage] Don't Infer Pixel Size in Buffer Copy
A buffer's `rowBytes` doesn't have a direct relationship with its `height`, so `rowBytes / Int(width)` isn't a good way to calculate pixel size. To resolve this, I've added `pixelSize` as a parameter to `vImage_Buffer.copy`.
2019-04-30 17:50:10 +01:00
David Smith
b6d0362204 Merge pull request #24289 from Catfish-Man/bulk-discount
SR-10555 foreignCopyUTF8 should do bulk access
2019-04-29 22:17:29 -07:00
Jordan Rose
d20a7ca64e [CMake] Switch to building the overlays in Swift 5 mode (#24350)
Now that that's stabilized, we don't have to keep them in Swift 4 mode
any longer. (Arguably we don't need the CMake variable at all, but it
may be useful again in the future.)

rdar://problem/49040980
2019-04-29 17:55:20 -07:00
Ross Bayer
dfb2d31e74 Rename the LIBRARY_INSTALL_NAME_DIR argument in add_swift_target_library to DARWIN_INSTALL_NAME_DIR which better explains that this argument only controls the install_name_dir for Darwin platforms. 2019-04-29 16:46:09 -07:00
Ross Bayer
b855119fbe Added a new CMake cache variable to control the private standard library install_name_dir. Those libraries are not going to be installed in /usr/lib/swift and thus need to be controlled via a separate mechanism. 2019-04-29 16:46:09 -07:00
David Smith
fd0d4d858e SR-10555 foreignCopyUTF8 should do bulk access 2019-04-29 16:23:55 -07:00
Stephen Canon
d2f695935f Add availability information to the new Math function protocols (#24187)
* Add availability information to the new Math function protocols

The protocols ElementaryFunctions, RealFunctions, and Real are new in Swift 5.1 and accordingly need to have availability attached to them for platforms that are ABI-stable. The actual implementation hooks (static functions) are unconditionally defined on scalar types and marked @_alwaysEmitIntoClient, so they are available even when targeting older library versions, but the protocols themselves, and anything defined in terms of them (the global functions and the SIMD extensions) is only available when targeting library versions that have the new protocols.

* Additionally provide concrete implementations of signGamma for each stdlib-builtin floating-point type.

* Remove Real[Functions] protocols pending re-review

Temporarily pull these back so we can make minor tweaks to the design and get a re-review on SE.
2019-04-29 17:39:33 -04:00
Joe Groff
9c6bc9ccd7 Runtime: Generalize TypeMetadataRecords to non-type contexts.
We could introduce non-nominal-type context descriptors, such as those for opaque declarations,
which are also interesting to be able to look up for reflection or remote purposes. This should be
a backward compatible change with old runtimes, which always ignore any context descriptor kind
they don't know about.
2019-04-29 11:30:11 -07:00
Karoy Lorentey
d9c166fdb9 Merge pull request #23832 from lorentey/foundation-hashing
[Foundation] Modernize hashing in Foundation's Swift-only types
2019-04-26 14:59:13 -07:00
Ben Cohen
1096179aaa Merge pull request #24186 from AnthonyLatsis/fix-reversed-index-alias
Stdlib: Fix ReversedIndex compatibility alias
2019-04-26 14:43:55 -07:00
Michael Ilseman
102a3a816a Merge pull request #24198 from troughton/floating-point-parsing-utf8
[stdlib] Use String’s underlying UTF-8 view for Float parsing
2019-04-26 13:28:49 -07:00
Saleem Abdulrasool
f88be05394 Merge pull request #24240 from compnerd/bridge-to-terabithia
WIP: bridge BOOL to Bool
2019-04-26 11:13:41 -07:00
Arnold Schwaighofer
54cb9dfe8f Merge pull request #24278 from aschwaighofer/initialize_extrainhabitantcount_single_case_enum
Initialize the extraInhabitantCount field of single case enums
2019-04-26 07:27:35 -07:00
Stephen Canon
ba0888df5b Really remove static min and max on simd. One slipped through. (#24283) 2019-04-26 07:41:49 -04:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Steve (Numerics) Canon
1fbf0d2b92 Slice should only conform to AB when the Base conforms to AB. 2019-04-25 20:25:29 -04:00
Daniel Rodríguez Troitiño
73fd7d6551 [android] Add missing POSIX/Linux headers to Android build.
Reviewed the cases of Glibc where branching occurred and checked the
skipped headers against the Android NDK sysroot, and added the Android
check in the right places. This will give access to a lot more
functions from libc.
2019-04-25 13:46:40 -07:00
Arnold Schwaighofer
50143048ee Initialize the extraInhabitantCount field of single case enums
rdar://49786768
2019-04-25 12:33:05 -07:00
Stephen Canon
9850150c91 Restore elementwise min/max on SIMD, with explicit naming. (#24136)
* Restore elementwise min/max on SIMD, but as statics instead of free functions.

Having these as free functions causes expression too complex issues due to overload vis-a-vis min<Collection>. There are (at least) three plausible solutions:

1. Fix the typechecker. This is infeasable in the short term; or more precisely, we do not know how much work is involved.

2. Give these operations different names. Candidates discussed with core team include "pointwiseMin", "elementwiseMin", "lanewiseMin"; these all suffer from the flaw that when someone writes "min" in a SIMD context, they are essentially always looking for either the horizontal minimum (reduction) on a single vector or--more often--the lanewise minimum of two vectors (this operation). It would be odd to give the operation that people actually want the unnecessarily verbose name.

3. Make these operations static; this is, in effect, a different name, but it's one which frequently allows eliding the qualifier:

  let x = v + .min(v, w)

This isn't perfect; you will still need to spell out SIMD4.min( ) fairly often, but that's more concise than any of the proposed alternatives, and at least allows elision some of the time. Also, if you squint, you can pretend that the "." prefix is like ".<" and ".&" and indicates lanewise operation.
2019-04-25 14:52:03 -04:00