Commit Graph

192 Commits

Author SHA1 Message Date
Alastair Houghton
f5bdb858e0 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alastair Houghton
0cf687aa2b [Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.
SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
63a09007a1 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-05-24 14:57:39 +01:00
Alastair Houghton
dadcb04ae2 [Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.
SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

rdar://90776105
2022-05-24 14:57:38 +01:00
Karoy Lorentey
1e6bab05f7 [build] Add build options to force-enable debug preconditions and to set a trap function in the stdlib
(The underlying functionality was added in #41445 and #41449, respectively.)
2022-05-06 18:39:39 -07:00
Xi Ge
f7f7baa874 cmake: specify stdlib and overlays with an API library-level 2022-04-10 19:34:23 -07:00
Slava Pestov
ed23f4fd9d Merge pull request #42113 from slavapestov/gsb-off
Turn off the GenericSignatureBuilder
2022-04-02 11:04:24 -04:00
Slava Pestov
703d89c8bd Turn off the GenericSignatureBuilder
The Requirement Machine has been enabled in 'verify' mode for a while,
where we run both the GenericSignatureBuilder and Requirement Machine
minimization algorithm and compare the results, with the
GenericSignatureBuilder being used to emit diagnostics.

Now, it's time to flip the flags to 'enabled' mode, where the
GenericSignatureBuilder doesn't run at all, and the Requirement Machine
emits diagnostics. This finally allows us to realize the correctness
and performance gains from using the Requirement Machine.

See https://forums.swift.org/t/the-requirement-machine-a-new-generics-implementation-based-on-term-rewriting/55601/9
for details.

Correctness:

- https://bugs.swift.org/browse/SR-7353
- https://bugs.swift.org/browse/SR-9595
- https://bugs.swift.org/browse/SR-10532
- https://bugs.swift.org/browse/SR-10752
- https://bugs.swift.org/browse/SR-11100
- https://bugs.swift.org/browse/SR-11532
- https://bugs.swift.org/browse/SR-11997
- https://bugs.swift.org/browse/SR-12120
- https://bugs.swift.org/browse/SR-12736
- https://bugs.swift.org/browse/SR-12980
- https://bugs.swift.org/browse/SR-13018
- https://bugs.swift.org/browse/SR-13491
- https://bugs.swift.org/browse/SR-13502
- https://bugs.swift.org/browse/SR-14484
- https://bugs.swift.org/browse/SR-14485
- https://bugs.swift.org/browse/SR-14659
- https://bugs.swift.org/browse/SR-14776
- https://bugs.swift.org/browse/SR-14917
- https://bugs.swift.org/browse/SR-15009
- https://bugs.swift.org/browse/SR-15790
- https://bugs.swift.org/browse/SR-15920
- rdar://25065503
- rdar://39225307
- rdar://44590919
- rdar://45957015
- rdar://50169558
- rdar://51068593
- rdar://52921168
- rdar://54394068
- rdar://55758433
- rdar://58455439
- rdar://59132837
- rdar://62894047
- rdar://64953119
- rdar://65015626
- rdar://65558829
- rdar://68084643
- rdar://68376692
- rdar://75329340
- rdar://76646764
- rdar://77683844
- rdar://77794156
- rdar://78233378
- rdar://78481510
- rdar://78643612
- rdar://80820294
- rdar://81276358
- rdar://81425392
- rdar://83308672
- rdar://83373331
- rdar://83848546
- rdar://83955123
- rdar://88514540
- rdar://89641532
- rdar://90264856
- rdar://90343419

Performance:

- rdar://33654588
- rdar://47821930
- rdar://51908331
- rdar://59037195
- rdar://65131776
- rdar://73771235
- rdar://75188696

GSB crashes with no reduced test case that are likely fixed:

- https://bugs.swift.org/browse/SR-4872
- rdar://32144681
- rdar://42376632
- rdar://46270030
- rdar://47199993
- rdar://48648900
- rdar://49535930
- rdar://49712445
- rdar://49712637
- rdar://49713096
- rdar://49713107
- rdar://60334839
- rdar://66593156
- rdar://68982368
- rdar://76706682
- rdar://77794745
- rdar://84724541
2022-04-02 01:55:21 -04:00
Yuta Saito
8c598e98f7 [Wasm][Runtime] Interpret absolute function pointer in runtime structures
When SWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER is enabled, relative direct
pointers whose pointees are functions will be turned into absolute
pointer at compile-time.
2022-04-02 04:32:41 +00:00
David Smith
c05e47dd60 Only use SIMD when stdlib vector types are available 2022-03-22 15:48:24 -07:00
Slava Pestov
2028a030f5 stdlib: Build with -requirement-machine-inferred-signatures=verify 2022-03-08 15:57:19 -05:00
Slava Pestov
8d81d46a8f stdlib: Don't explicitly pass requirement machine flags that are on by default 2022-03-07 23:20:41 -05:00
Slava Pestov
f53756aebb stdlib: Build with -requirement-machine-abstract-signatures=verify 2022-03-02 17:42:40 -05:00
Michael Gottesman
7f02653a99 Merge pull request #41327 from gottesmm/pr-5939707c6d758909b99bd67cd865a5f1adf02128
Rather than turning off sil-verify-all on all stdlib builds... Re-enable it only on the macOS x86_64 platform.
2022-02-19 20:41:40 -08:00
Kuba (Brecka) Mracek
9b661aa2fe Specify missing dependencies on swift_static .swiftmodule files (#41320) 2022-02-11 18:04:25 -08:00
Michael Gottesman
392e02d58f Rather than turning off sil-verify-all on all stdlib builds... Re-enable it only on the macOS x86_64 platform.
Most of the stdlibs at the SIL level are the same so by not verifying them all,
we aren't losing that much coverage. This gives us back some of the coverage we
lost when we disabled -sil-verify-all everywhere without causing us to have the
huge slow down when building multiple stdlibs.
2022-02-10 17:16:04 -08:00
Michael Gottesman
59feb67645 [build-script] Add support for running sil-verify-all only on macOS x86_64.
This will let us save some build time without losing the coverage of
sil-verify-all everywhere since much of the code in all of the stdlibs are the
same.
2022-02-10 12:08:03 -08:00
Kuba (Brecka) Mracek
be9d93fbe2 Enable -reflection-metadata-for-debugger-only for the freestanding stdlib (#41168) 2022-02-07 15:00:14 -08:00
Slava Pestov
3a4bb96e40 Merge pull request #41200 from slavapestov/enable-rqm-protocols-for-stdlib
Enable RequirementMachine for the standard library's protocol signatures
2022-02-04 22:45:21 -05:00
Slava Pestov
3d7888cc00 stdlib: Enable -requirement-machine-protocol-signatures=verify
Fixes rdar://problem/46313629.
2022-02-04 19:10:59 -05:00
Kuba Mracek
33c53ef51b Fix missing quotes in CMake for SWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES 2022-02-04 09:32:08 -08:00
Kuba (Brecka) Mracek
05a17cc622 Enable -disable-preallocated-instantiation-caches for the freestanding stdlib (#41170) 2022-02-04 06:53:32 -08:00
David Smith
48399afb03 Merge branch 'main' into unicodectomy 2022-01-03 22:57:37 -08:00
Erik Eckstein
ba364a17ef libswift: rename cmake targets and functions
libswift -> swiftCompilerModules or swiftCompilerSources
2021-12-22 11:31:52 +01:00
David Smith
f1a5e27821 Add a build flag to disable building Unicode support 2021-12-21 17:26:15 -08:00
Saleem Abdulrasool
bd9b42772d build: allow building libswift for Windows
There is no special environment variable to be set, the dlls must be
co-located or be found in `Path`.
2021-12-20 09:07:44 -08:00
Kuba (Brecka) Mracek
b48e148fed Merge pull request #40204 from kubamracek/swift_stdlib_support_back_deployment
Rename SWIFT_ENABLE_COMPATIBILITY_OVERRIDES -> SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT and avoid building more back-deployment stdlib parts when not set
2021-12-15 07:03:56 -08:00
Alastair Houghton
0e5a620917 Merge pull request #40331 from al45tair/problem/84393438
[Runtime] Don't use threading APIs when building single threaded.
2021-12-14 22:19:20 +00:00
Kuba Mracek
d441f85358 Rename SWIFT_ENABLE_COMPATIBILITY_OVERRIDES -> SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT and avoid building more back-deployment stdlib parts when not set 2021-12-14 09:59:44 -08:00
eeckstein
1b2ac8cccb Merge pull request #40277 from buttaface/boot
libswift: add support for Android and OpenBSD in the CMake config
2021-12-06 20:10:31 +01:00
David Smith
fc3e718771 Initial support for compile-time generation of vprintf format strings, behind the SWIFT_STDLIB_STATIC_PRINT flag 2021-12-02 16:58:36 -08:00
Butta
4c493ef5d3 libswift: add support for Android and OpenBSD in the CMake config
Add a new libswift build mode for cross-compilation in the process, that currently
only works for non-Darwin hosts.
2021-12-01 15:27:40 +05:30
Alastair Houghton
2d335062e2 [Runtime] Don't use threading related APIs when building single threaded.
Mostly this consists of #if-ing out code that we don't need when running
single threaded.

rdar://84393438
2021-11-30 16:18:26 +00:00
Richard Wei
65bffd7ad7 Add _MatchingEngine and _StringProcessing modules.
These modules are part of the experimental declarative string processing feature. If accepted to the Standard Library, _StringProcessing will be available via implicit import just like _Concurrency, though _MatchingEngine will still be hidden as an implementation detail.

`_MatchingEngine` will contain the general-purpose pattern matching engine ISA, bytecode, and executor. `_StringProcessing` will contain regular expression and pattern matching APIs whose implementation depends on the matching engine..

Also consolidates frontend flag `-enable-experimental-regex` as `-enable-experimental-string-processing`.

Resolves rdar://85478647.
2021-11-19 09:27:33 -08:00
Kuba (Brecka) Mracek
66bd5e6a39 Add ASTMangler.AllowStandardSubstitutions to allow using a stripped-down libswiftCore (#40009) 2021-11-15 15:40:35 -08:00
Kuba (Brecka) Mracek
c63a93c37a Add SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS and SWIFT_STDLIB_EXTRA_C_COMPILE_FLAGS CMake options (#40171) 2021-11-15 10:27:50 -08:00
Kuba (Brecka) Mracek
367b4c1355 Enable -experimental-hermetic-seal-at-link for the stdlib on 'freestanding' (#39961) 2021-11-02 10:05:33 -07:00
Kuba (Brecka) Mracek
557bf685be Don't include support for old mangling in runtimes without ObjC interop (#39675) 2021-10-13 19:47:05 -07:00
Kuba (Brecka) Mracek
7538949859 Split out CommandLine enum into a separate static library, allow removing it from stdlib (#39591)
This is for the 'freestanding' build to stop assuming the platform has argc/argv.

- Introduce a new sub-library, libswiftCommandLineSupport.a
- Move stubs/CommandLine.cpp into this library
- Conditionally embed it into libswiftCore
- Conditionally embed it into libswiftPrivateLibcExtras if not in libswiftCore to support testing
- Add SWIFT_STDLIB_HAS_COMMANDLINE CMake (and build-script) flag
2021-10-13 07:02:43 -07:00
Kuba (Brecka) Mracek
1147d08ae3 Disable stable ABI on freestanding stdlib (#39674) 2021-10-12 15:25:57 -07:00
Kuba (Brecka) Mracek
c2c1bfb053 Add SWIFT_STDLIB_HAS_ENVIRON to remove usage of getenv/environ from stdlib (#39599) 2021-10-12 07:16:36 -07:00
Erik Eckstein
af71088d29 libswift: bootstrapping build
Adding build modes for libswift: off, hosttools, bootstrapping, bootstrapping-with-hostlibs
The two bootstrapping modes are new. For details see libswift/README.md
2021-09-28 18:51:42 +02:00
Egor Zhdan
e1c4ea50c8 Merge pull request #37806 from egorzhdan/clang-executable-path-reapply
ClangImporter: run Clang with a proper executable path (pt 2)
2021-09-24 21:46:03 +03:00
Kuba (Brecka) Mracek
6766824d51 Add a SWIFT_STDLIB_HAS_STDIN flag to compile out the Swift.readLine() API from the stdlib (for the 'freestanding' preset) (#39332) 2021-09-17 10:42:14 -07:00
Argyrios Kyrtzidis
f72cf2bdb5 [SwiftSource.cmake] Include the line-directive tool and its input as dependencies of the custom command 2021-09-12 16:40:03 -07:00
Kuba (Brecka) Mracek
404badb49a Introduce SWIFT_ENABLE_REFLECTION to turn on/off the support for Mirrors and reflection (#33617) 2021-09-08 13:08:13 -07:00
Doug Gregor
9d4ce58ed6 Merge pull request #38930 from DougGregor/concurrency-compatibility-library
[concurrency] Implement a compatibility .a library for Concurrency.
2021-08-28 22:40:37 -07:00
Kuba (Brecka) Mracek
c079c0897b Split SWIFT_DARWIN_PLATFORMS and SWIFT_APPLE_PLATFORMS in CMake. SWIFT_APPLE_PLATFORMS may contain 'FREESTANDING' when building the freestanding SDK and SWIFT_FREESTANDING_FLAVOR is set to 'apple'. (#38997) 2021-08-23 19:16:28 -07:00
Michael Gottesman
1bc94bfa6a [concurrency] Implement a compatibility .a library for Concurrency.
In a back deployment scenario, this will provide a place where one could provide
function implementations that are not available in the relevant stdlib.

This is just setting up for future work and isn't doing anything interesting
beyond wiring it up/making sure that it is wired up correctly with tests.
2021-08-18 09:35:37 -07:00