Commit Graph

397 Commits

Author SHA1 Message Date
Philippe Hausler
6c26b80e6e [Foundation] Rework the backing storage for CharacterSet to be more performant and bridge correctly to objective-c and CF
Some cases of using isSuperset can cause crashes, this was caused by improper subclassing callouts; this pr resolves those failures (and provides unit tests for that case)
The cases where the bridge was traversed too much now only causes a single bridge out call (without needing to reallocate or thrash retain/release)
String.components(separatedBy: CharacterSet) should be considerably faster now not only for more apporpriate bridging calls but also no longer needing to bridge arrays back and forth.

Resolves the following issues:
rdar://problem/17281998
rdar://problem/26611771
rdar://problem/29738989
2017-03-31 11:06:38 -07:00
Hugh Bellamy
bcc3f82cb5 Use correct __builtin_sqrtf instead of __builtin_sqrt for float type (#7978) 2017-03-19 10:17:43 -04:00
Hugh Bellamy
1e919d2f4e Fix attribute fallout from new refcount representation 2017-03-18 17:56:34 +07:00
Hugh Bellamy
bd8d214383 Copy entire swiftShims directory to avoid very long command line paths that break the Windows build 2017-03-16 22:09:35 +07:00
Greg Parker
7e38792bdd [stdlib] Thou shalt not call objc_msgSend() without a function pointer cast.
Fixes test stdlib/ErrorBridged.swift on arm64.

rdar://30900987
2017-03-14 12:33:10 -07:00
Hugh Bellamy
fe48ea7cbc Fix MSVC/GCC compilation failures resulting from new refcount representation 2017-03-14 00:18:17 +07:00
practicalswift
95e74d54ad [gardening] Fix includes 2017-03-07 16:44:53 +01:00
swift-ci
8741d12001 Merge pull request #7900 from phausler/silgen_removal 2017-03-06 13:32:34 -08:00
Philippe Hausler
dc783c064c [Foundation] Remove @_silgen thunks and replace them with shims instead
This avoids indirection by making calls directly to the C implementations which prevents potentials of mismatched intent or changes of calling convention of @_silgen. The added benefit is that all of the shims in this case are no longer visible symbols (anyone using them was not authorized out side of the Foundation overlay). Also the callout methods in the headers now all share similar naming shcemes for easier refactoring and searching in the style of __NS<class><action> style. The previous compiled C/Objective-C source files were built with MRR the new headers MUST be ARC by Swift import rules.

The one caveat is that certain functions MUST avoid the bridge case (since they are part of the bridging code-paths and that would incur a recursive potential) which have the types erased up to NSObject * via the macro NS_NON_BRIDGED.

The remaining @_silgen declarations are either swift functions exposed externally to the rest of Swift’s runtime or are included in NSNumber.gyb which the Foundation team has other plans for removing those @_silgen functions at a later date and Data.swift has one external function left with @_silgen which is blocked by a bug in the compiler which seems to improperly import that particular method as an inline c function.
2017-03-06 09:59:37 -08:00
Argyrios Kyrtzidis
6038e2d12e Fix -Wextra-semi warnings. 2017-03-02 21:56:40 -08:00
Hugh Bellamy
bb34e2a959 Fix attribute fallout from new refcount representation 2017-03-02 19:44:37 +07:00
practicalswift
bf50a9ad4a [gardening] Fix double spaces 2017-02-28 17:14:44 +01:00
Mikio Takeuchi
2741535ee0 Add non-atomic variants to SideTable 2017-02-27 23:41:20 +09:00
Mikio Takeuchi
69768ad540 Update for the new reference counting mechanism 2017-02-27 16:56:32 +09:00
Mikio Takeuchi
488d531846 Enhance -assume-single-threaded option (SR-3945) 2017-02-27 12:17:53 +09:00
Greg Parker
ae1c984920 New refcount representation (#5282)
New refcount representation and weak variable implementation. See SwiftShims/RefCount.h for details.
2017-02-24 14:19:11 -08:00
Hugh Bellamy
52a362270c Attempt to fix Linux build - a clang/ubuntu bug means we can't find stddef.h 2017-02-20 19:52:39 +07:00
Hugh Bellamy
387ecad7b5 Cleanup redundant #ifdefs working around libc's stdint.h implementation pulling in Darwin 2017-02-20 17:58:57 +07:00
Hugh Bellamy
3a96ded085 Don't use certain attributes in shims or stubs if the attribute doesn't exist 2017-02-20 10:16:30 +07:00
Mishal Shah
92ef777085 Update master to build with Xcode 8.3 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2017-01-25 16:13:36 -08:00
Saleem Abdulrasool
ac57b66c99 Merge pull request #6820 from hughbe/extern-c
Introduce SWIFT_EXTERN_RUNTIME_EXPORT for Windows
2017-01-24 19:34:44 -08:00
Brian Croom
42b6577aa9 [XCTest] Reduce bridging overhead from the exception-catching trampoline
By returning `nil` instead of an empty dictionary in the common case where
no exception is encountered, we skip any dictionary-bridging work which
can become expensive if making assertions in a tight loop.
2017-01-23 15:02:38 -08:00
Hugh Bellamy
05a50fd978 Remove extern "C" from uses of SWIFT_RUNTIME_STDLIB_INTERFACE 2017-01-22 18:32:17 +00:00
Hugh Bellamy
b6ee5b21f2 Change definition of SWIFT_RUNTIME_EXPORT 2017-01-22 18:32:16 +00:00
Stephen Canon
e6c84d7a63 Mark libc math shims with always_inline attribute (#6956)
* Mark libc math shims with always_inline attribute

We want these to always be inlined, so mark them with ... always_inline.
The compiler happened to do the right thing with them previously, but we
shouldn't depend on that.

<rdar://problem/30043258> master-next: IRGen/builtin_math.swift failing because sqrt(4) is not constant folded
2017-01-20 18:09:30 -05:00
Stephen Canon
d89f8f423e Go back to using static inline stubs for sqrt and remainder (#6769)
* Go back to using static inline implementations of sqrt and remainder now that SR-2089 is resolved.

* Fix typo: sqrt -> squareRoot.

* Added test for constant-folding sqrt with -O.

* Added test case requested by jrose.
2017-01-13 13:26:46 -05:00
Max Moiseev
195691523f [stdlib] Eliminating some 'unsafeBitcast' related warnings 2017-01-10 12:36:22 -08:00
Slava Pestov
dfebf20670 Merge pull request #6387 from hughbe/symlink-win32
[CMake] fix symlink creation on Windows
2017-01-09 12:27:21 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Hugh Bellamy
888afe139c Fix creating symlinks on Windows 2016-12-27 14:55:05 +00:00
Hugh Bellamy
60e1cd1271 Fix condition in the runtime from _MSC_VER to _WIN32 2016-12-08 21:23:45 +00:00
Hugh Bellamy
87012b85cf Fix warning building with compiler without __has_feature 2016-12-08 21:22:51 +00:00
practicalswift
cfdaf9f14a [gardening] Fix invalid Swift URLs. 2016-12-06 20:12:20 +01:00
Jordan Rose
7d61a5e6a2 [SDK] Use an extra shims header to remove _silgen_name from Dispatch.
We still have a bunch of redeclarations of Dispatch functions to avoid
the automatic bridging of dispatch_data_t and dispatch_block_t, but
mostly this is a vast reduction in complexity (and increase in safety).
2016-12-01 16:06:15 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Alexis Beingessner
21405f1ac1 [runtime] statically construct the Dictionary and Set singletons 2016-11-18 13:56:57 -05:00
practicalswift
b864577bf5 [gardening] Fix inconsistent headers. 2016-10-21 22:05:44 +02:00
Jordan Rose
dce51edf06 [SDK] Remove the -*- C++ -*- tag from the new overlay shim headers.
These get imported by Swift, so "Objective-C" would be more appropriate.
For now, though, just let it fall back to C mode.
2016-10-15 15:08:27 -07:00
Jordan Rose
c0304aef84 [SDK] Fix circularity issues with overlay shim headers.
Loading a Clang module eagerly brings in overlays for anything it re-exports,
but this is a problem for these new "shim header" modules, which generally
import the underlying module for an overlay and are in turn imported by the
overlay. That means that when we try to import an overlay, we'll end up with
a circular reference before it's done loading all its dependencies. Break the
cycle by not exporting anything from these modules, which are mostly just an
implementation detail anyway.
2016-10-15 14:59:29 -07:00
Jordan Rose
1589ca1b8d [SDK] Use an extra shims header to remove _silgen_name from the XPC overlay. 2016-10-15 14:59:29 -07:00
Jordan Rose
26e24f7bee [SDK] Use an extra shim header to remove _silgen_name from SafariServices. 2016-10-15 14:59:28 -07:00
Jordan Rose
cb59b94135 [SDK] Use an extra shim header to eliminate _silgen_name from ObjectiveC. 2016-10-15 14:59:28 -07:00
Jordan Rose
244cf50c0c [SDK] Use an extra shims header to remove _silgen_name from the os overlay. 2016-10-15 14:59:27 -07:00
Jordan Rose
2e560b0319 [SDK] Use an extra shim header to remove _silgen_name from XCTest. 2016-10-15 14:59:27 -07:00
Brian Gesiak
a6a072f38f [SwiftShims] Improve CMake Clang headers error
When Clang headers could not be found, print all the locations that
were searched.
2016-10-03 17:34:33 -04:00
Chris Bieneman
58ca217e8d [CMake] Fix bad dependency in symlink_clang_headers
The problem here is a bit complicated. The symlink_clang_headers target creates two symlinks to clang's headers, one under the build directory at lib/swift/clang, and the other under a temporary path.

The one under the temporary path is a bad symlink, and it is only created during the build so that it can be installed. It isn't actually used by the build. Ninja treats the bad symlink as a non-existing file, and since the build rule that creates it has the restat property on it this results in the commands to symlink the clang headers directory running over and over and over again during the build.

This patch prevents that by not generating the bad symlink during the build. Instead we generate it at install time using the LLVMInstallSymlink script that is vended as part of LLVM's distribution.
2016-09-27 15:29:29 -07:00
practicalswift
8d6251de66 [gardening] Fix accidental uses of \t 2016-09-17 13:15:26 +02:00
practicalswift
9185c052a9 [gardening] Fix inconsistent headers 2016-09-14 20:48:28 +02:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Dmitri Gribenko
daa7bfc281 stdlib: add a secret key for hashing 2016-09-06 20:41:03 -07:00