Commit Graph

192 Commits

Author SHA1 Message Date
Mishal Shah
3722bcb85a Revert "[concurrency] Implement a compatibility .a library for Concurrency." 2021-07-29 11:26:51 -07:00
Michael Gottesman
8441871a04 [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-07-23 17:30:18 -07:00
Saleem Abdulrasool
c0300296a7 Revert "[CMake] Better dependency checking" 2021-07-02 14:44:14 -07:00
David Zarzycki
1bbce7cf81 [CMake] Better dependency checking 2021-06-29 11:01:27 -04:00
Michael Gottesman
c0d6d8f190 [cmake] Respect SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER when compiling the stdlib if SWIFT_NATIVE_SWIFT_TOOLS_PATH is not set and CMake_Swift_COMPILER is.
Previously, no matter if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER was set, we
would use for swiftc SWIFT_NATIVE_SWIFT_TOOLS_PATH/bin/swiftc. This is correct
assuming that the user always passed in that flag. This will no longer always be
true since we are attempting to transition the stdlib slowly to use more
standard cmake. Instead, in that case if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
is set and SWIFT_NATIVE_SWIFT_TOOLS_PATH is not set /and/ we have a
CMAKE_Swift_COMPILER, we just use CMAKE_Swift_COMPILER. Hopefully with time we
get rid of SWIFT_NATIVE_SWIFT_TOOLS_PATH.
2021-06-27 16:40:20 -07:00
Egor Zhdan
64113270df ClangImporter: run Clang with a proper executable path (pt 2)
This change re-applies https://github.com/apple/swift/pull/36749 after it has been reverted in https://github.com/apple/swift/pull/37805 because of a broken standalone stdlib build.
2021-06-22 22:28:55 +03:00
Saleem Abdulrasool
fe870d005a Revert "ClangImporter: run Clang with a proper executable path" 2021-06-05 16:13:40 -07:00
Egor Zhdan
fc80a9a7bf Merge pull request #36749 from egorzhdan/clang-executable-path
ClangImporter: run Clang with a proper executable path
2021-06-04 20:28:00 +03:00
Konrad `ktoso` Malawski
6008b32789 [Distributed] initial distributed support, fixed availability (#37650)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

* [Distributed] Fix availability and remove actor class tests

* [actorIndependent] do not apply actorIndependent implicitly to values where it would be illegal to apply

* [Distributed] disable tests until issue fixed

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-28 07:22:03 +09:00
Konrad `ktoso` Malawski
0c75bd2a39 Revert Initial distributed, some issues to be fixed first (#37556)
* Revert "[Distributed] disable tests until issue fixed"

This reverts commit 0a04278920.

* Revert "[Distributed] Initial `distributed` actors and functions and new module (#37109)"

This reverts commit 814ede0cf3.
2021-05-21 19:28:48 +09:00
Konrad `ktoso` Malawski
814ede0cf3 [Distributed] Initial distributed actors and functions and new module (#37109)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-21 09:12:29 +09:00
David Zarzycki
654234ad64 [Testing] Unbreak minimal Swift builds
For various reasons, it can be useful/interesting to create builds of
Swift that minimize dependencies. Let's try to keep that working as long
as we can.
2021-04-16 17:39:01 -04:00
Egor Zhdan
6650a891f1 ClangImporter: run Clang with a proper executable path
Clang deduces its installation directory from the `argv[0]` parameter (see clang/lib/Frontend/CreateInvocationFromCommandLine.cpp), and the default include search paths are computed based on the installation directory.

This change allows compiling Swift code that imports the C++ stdlib without having to manually specify the include search path of `std` headers.
2021-04-07 21:54:12 +03:00
Michael Gottesman
24f6c799b6 [cmake] Add support for building the swift stdlib with LTO.
This is controlled with the option SWIFT_STDLIB_ENABLE_LTO=thin|full.
2021-03-24 12:18:35 -07:00
buttaface
e6f5913772 [android] Move to the NDK's unified sysroot (#34491)
Since the NDK removes the platforms/ and sysroot/ directories in the latest NDK
22, switch to the unified sysroot in toolchains/llvm/ and take advantage of a
bunch of simplification that's now possible.
2021-02-07 09:19:18 -08:00
Eric Miotto
41dddf4a20 [CMake] Extend copy-legacy-layouts dependency to swiftmodules (#34846)
... and other products as well.

Before this change, the dependency was enforced only for stdlib object
files -- since according to the Ninja dependency graph other libraries
can be scheduled as soon as the swiftmodules are ready, there is a
chance that we attempt to build those before legacy layours are copied.

Addresses rdar://71559791
2020-11-30 08:18:41 -08:00
Eric Miotto
c813732676 Pass include paths when emitting macOS swiftmodule for zippered libraries (#34547)
This matches the behaviour for emitting macCatalyst swiftmodules and should avoid preferring dependencies from the SDK instead of just built ones.

Addresses rdar://70682224
2020-11-04 11:16:04 -08:00
Kuba (Brecka) Mracek
e6da0c2eea Make MinSizeRel builds of stdlib (but not the compiler) produce debug info (#33787) 2020-09-24 09:26:39 -07:00
Kuba (Brecka) Mracek
58f2ae695b Add a SWIFT_STDLIB_STABLE_ABI flag to be able to build the stdlib without -enable-library-evolution (#33443) 2020-09-21 16:33:00 -07:00
Saleem Abdulrasool
b0a13e7e55 build: repair cross-compilation for Windows after #33908
`CMAKE_SYSTEM_NAME` specifies the host, not the build.  Use the correct
executable extension for the host.
2020-09-16 09:56:03 -07:00
Robert Widmann
399b190ea9 Merge pull request #33908 from stevapple/check-windows
[test] Fix line-directive on Windows
2020-09-15 18:56:00 -06:00
Saleem Abdulrasool
af868e5c8f build: migrate towards the unified directory layout for modules
This changes the install layout to be similar across Darwin and
non-Darwin platforms.  This will enable simplifying the user experience,
build infrastructure, and the driver as the SDK layout converges towards
a single layout on all the platforms.
2020-09-13 17:46:54 -07:00
stevapple
fa6a8eceff [test] Fix line-directive on Windows 2020-09-12 00:55:03 +08:00
Kuba (Brecka) Mracek
aa0f8e670b Add a SWIFT_STDLIB_OS_VERSIONING flag to avoid querying OS version at runtime, use it in the freestanding build (#33791) 2020-09-11 08:09:14 -07:00
Kuba (Brecka) Mracek
b5252eb0e3 Fix incorrect build type regression from ef89b0dc51 (#33894) 2020-09-10 17:25:37 -07:00
Kuba (Brecka) Mracek
9de7b59388 Subsume SWIFT_STDLIB_USE_NONATOMIC_RC into SWIFT_STDLIB_SINGLE_THREADED_RUNTIME (#33643) 2020-08-26 21:28:30 -07:00
Kuba (Brecka) Mracek
925835f158 NFC: Use SWIFT_APPLE_PLATFORMS and remove is_darwin_based_sdk 2020-08-14 21:04:02 -07:00
Kuba (Brecka) Mracek
e2e69578a6 For the 'minimal' stdlib, disable Objective-C interop (#33427) 2020-08-13 15:26:04 -07:00
Kuba (Brecka) Mracek
ef89b0dc51 Add a 'standalone_minimal' preset to build a minimal, static, OS independent, self-contained binaries of stdlib. (#33286) 2020-08-12 07:28:34 -07:00
Dario Rexin
7e60a73335 Merge pull request #33168 from drexin/wip-fix-resource-folder
Properly compute resource folder when linking statically
2020-08-04 12:52:38 -07:00
Kuba (Brecka) Mracek
c6ea30c963 Instead of random file name, use a hash as a deterministic name for Swift source file list in _compile_swift_files (#33190) 2020-08-03 10:33:00 -07:00
Dario Rexin
0850436d9f Properly compute resource folder when linking statically
- deduplicate the logic to compute the resource folder
- install headers and module files in shared and static resource folders
- forward -static flag when calling swiftc with -print-target-info
2020-07-30 15:07:03 -07:00
Michael Gottesman
2ea7cd2b87 [cmake] Generate opt-remark bitstream files for the stdlib. 2020-07-18 20:19:27 -07:00
Doug Gregor
f71f6207b5 [CMake] Make swift-frontend the primary Swift binary.
Build swift-frontend as the primary Swift binary, and have
swift/swiftc/etc. symlink over to it. This is a step toward allowing
swift-driver to replace the swift and swiftc binaries.
2020-06-23 13:00:26 -07:00
Michael Gottesman
46432404f3 [ownership] Remove dead option: enable-ownership-stripping-after-serialization.
We always lower ownership now after the diagnostic passes (what this option
actually controlled). So remove it.

NFC.
2020-06-16 10:52:02 -07:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Brent Royal-Gordon
02d5e6650f Fix module triples for “ios-like” Mac Catalyst modules
The “ios-like” build flavor is used to build modules that do not exist on macOS for Mac Catalyst. Even though they are built for the “OSX” SDK, they need to have a “MACCATALYST”-style module triple; unfortunately, the transition to naming swiftmodules by module triple in #31170 did not handle this edge case correctly.

This commit handles that by piggybacking on a similar special case used to change the lib/swift subdirectory.
2020-04-28 18:39:30 -07:00
Doug Gregor
b27b4d4bb6 [CMake] Use proper module triples for the names of standard library modules.
The standard library (and other Swift modules built by our CMake build system)
has been building module files with an architecture only (e.g., x86_64.swiftmodule)
rather than a proper module triple (x86_86-apple-macosx10.15,
x86_64-apple-ios13.0-simulator, etc.), unlike every other build
system. There are hacks in the compiler and other tools to cope with
this unnecessary build difference. Fix the module file names so we'll
be able to remove the hacks later.

Fixes rdar://problem/49071536.
2020-04-20 21:16:14 -07:00
Saleem Abdulrasool
41958f95fc Merge pull request #30992 from compnerd/the-impossible-future
build: explicitly execute `line-directive-tool` with Python3
2020-04-13 17:11:19 -07:00
Saleem Abdulrasool
cba8723d61 build: explicitly execute line-directive-tool with Python3
The `line-directive-tool` is Python3 compliant.  Use the Python3
interpreter to execute this tool.
2020-04-13 09:53:50 -07:00
Saleem Abdulrasool
87cbb3132d build: duplicate and rename the _add_variant_* functions
This allows us to start splitting up the swift and C/C++ specific paths.
2020-04-11 13:24:31 -07:00
Dario Rexin
6dc4329398 Move SwiftSource.cmake to stdlib 2020-03-08 12:48:34 -07:00