Commit Graph

1813 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
c59c79318b Merge pull request #68928 from kubamracek/embedded-concurrency
[embedded] Initial Swift Concurrency for embedded Swift
2023-10-07 19:33:54 -07:00
swift-ci
745d48ad03 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-07 09:34:00 -07:00
Arnold Schwaighofer
e4fbde8063 Merge pull request #68996 from aschwaighofer/objective_c_protocol_symbolic_ref
Add support for objective c protocol symbolic references
2023-10-07 09:18:33 -07:00
Kuba Mracek
5d8c55eacb [embedded] Initial Swift Concurrency for embedded Swift 2023-10-06 20:04:03 -07:00
swift-ci
f07b1aefb2 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 09:16:41 -07:00
Artem Chikin
bde05b3eeb Merge pull request #69000 from artemcm/FineGrainedAutolinkControls
Fine-grained autolinking control
2023-10-06 09:13:37 -07:00
Arnold Schwaighofer
894095a5f2 Add a flag to enable/disable usage of objective c protocol symbolic references 2023-10-06 08:43:00 -07:00
Artem Chikin
57e4f244d1 Fine-grained autolinking control
This change adds the following options to allow for greater control over the compiler's autolinking directive use:
- '-disable-autolink-library': equivalent to an existing '-disable-autolink-framework', this option takes a library name as input and ensures the compiler does not produce an autolink directive '-l<library-name>'.
- '-disable-autolink-frameworks': a boolean disable flag which turns off insertion of autolinking directives for all imported frameworks (of the type '-framework <framework-name>')
- '-disable-all-autolinking': a boolean disable flag which turns off insertion of *any* autolinking directives.

Resolves rdar://100859983
2023-10-05 15:12:48 -07:00
Evan Wilde
0453158f8e Merge remote-tracking branch 'main' into rebranch
Conflict in CAS options when
`std::vector<std::string> CacheReplayPrefixMap;` was added.

Conflicts:
  include/swift/Frontend/FrontendOptions.h

Resolution: Take both
2023-10-04 14:28:43 -07:00
Steven Wu
c8bc08107c Merge pull request #68684 from cachemeifyoucan/eng/PR-path-remapping
[CompilerCaching] Path Remapping for canonicalization
2023-10-04 12:57:27 -07:00
swift-ci
75ce2f5734 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 07:13:54 -07:00
Kuba (Brecka) Mracek
0d2f98a368 Merge pull request #68912 from kubamracek/embedded-closures-heap
[embedded] Support closures with captures and promoting locals to refcounted heap objects
2023-10-03 07:00:46 -07:00
swift-ci
8b0b25f404 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-02 13:33:12 -07:00
Artem Chikin
08533c94ec Always disable requiring Foundation for '@objc' when building/typechecking interfaces 2023-10-02 10:42:00 -07:00
Kuba Mracek
c6d0e4f76f [embedded] Support closures with captures and promoting locals to refcounted heap objects 2023-10-02 09:45:45 -07:00
swift-ci
2e9555437f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 20:19:54 -07:00
Alexis Laferrière
e820854784 Merge pull request #68831 from xymus/report-superfluously-public-imports
Sema: warn on imports that are too public and remark source of entities in API
2023-09-29 20:15:56 -07:00
Alexis Laferrière
c15a576a1c [Sema] Introduce remarks about the source of each decl in API
Using `-Rmodule-api-import` the compiler prints a remark about the
import bringing in every decl used in public function signatures or
inlinable code. It also remarks on the source of conformances where they
are used and the source of typealias underlying types.
2023-09-28 13:00:04 -07:00
swift-ci
2e6b1cd2f7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-28 07:13:53 -07:00
Kuba Mracek
8b1aca9ff5 [embedded] Only run the late DeadFunctionElimination if embedded mode is on 2023-09-26 22:55:53 -07:00
Steven Wu
7b89afbb6e [DepScan] Teach dependency scanner to remap path for canonicalization
Allow DependencyScanner to canonicalize path using a prefix map. When
option `-scanner-prefix-map` option is used, dependency scanner will
remap all the input paths in following:
* all the paths in the CAS file system or clang include tree
* all the paths related to input on the command-line returned by scanner

This allows all the input paths to be canonicalized so cache key can be
computed reguardless of the exact on disk path.

The sourceFile field is not remapped so build system can track the exact
file as on the local file system.
2023-09-26 12:36:43 -07:00
swift-ci
5ff7257ec3 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 22:10:35 -07:00
swift-ci
f14b426802 Merge pull request #68568 from apple/embedded-wmo-via-primaryfiles
[embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presence
2023-09-25 21:55:07 -07:00
swift-ci
daeae9870d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 21:51:57 -07:00
Kuba Mracek
d2f8530391 [embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presense 2023-09-25 17:22:10 -07:00
Allan Shortlidge
50fdfbf7b4 Sema: Support multiple -debug-forbid-typecheck-prefix arguments.
An existing test (Frontend/skip-function-bodies.swift) was designed under the
assumption that multiple `-debug-forbid-typecheck-prefix` arguments were
already supported, and as a result the test was not actually asserting what it
was written to assert.
2023-09-25 16:43:11 -07:00
swift-ci
fc3a226c60 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-24 16:13:49 -07:00
Kuba (Brecka) Mracek
f88c919636 Merge pull request #68727 from kubamracek/embedded-serialize-everything2
[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions
2023-09-24 15:57:17 -07:00
swift-ci
72e3d66404 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-23 15:35:20 -07:00
Kuba Mracek
770dcd1614 [embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions 2023-09-23 13:38:41 -07:00
swift-ci
a1910384fb Merge remote-tracking branch 'origin/main' into rebranch 2023-09-23 13:38:10 -07:00
eeckstein
2a039b412c Revert "[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions" 2023-09-23 19:13:04 +02:00
swift-ci
148c09b54d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-22 21:51:50 -07:00
Kavon Farvardin
a238d3ea17 fix -typecheck -verify and experimental features
When using `-enable-experimental-feature` on a non-asserts build,
we only emit an error diagnostic that has no source-line information
and continue to enable the feature.

That doesn't actually prevent use of the experimental feature when
you are passing `-typecheck -verify`, since in diagnostics verification
mode, a diagnostic with an unknown error location is ignored. Thus,
the experimental feature is enabled and run for type-checking, but
the compiler would exit with a zero error code.

This patch takes a hammer to that escape-hatch, forcing an early
non-zero exit the moment an experimental feature is requested. The
error message is output to stderr so that CI and other tools should see
what happened.
2023-09-22 13:23:06 -07:00
Kuba Mracek
d8907ceec2 [embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions 2023-09-21 16:35:58 -07:00
swift-ci
c55b21f2b5 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-21 16:10:25 -07:00
swift-ci
151d7409c0 Merge pull request #68198 from kavon/async-optimizations-pt1
Async Demotion (Part 1)
2023-09-21 15:44:54 -07:00
swift-ci
bc73f15add Merge remote-tracking branch 'origin/main' into rebranch 2023-09-21 15:22:08 -07:00
Kuba (Brecka) Mracek
cf6b7cba29 Merge pull request #68530 from kubamracek/embedded-no-objc
[embedded] Disable Objective-C interop in embedded Swift
2023-09-21 14:52:43 -07:00
Kuba (Brecka) Mracek
a559d24cdb Merge pull request #68649 from kubamracek/embedded-throw-as-trap
[embedded] Add a temporary flag that turns throws into traps so that programs that use throwing can at least be compiled for now
2023-09-21 14:52:29 -07:00
Kavon Farvardin
b688a1f4a1 [SILOpt] experimental async demotion pass
For chains of async functions where suspensions can be statically
proven to never be required, this pass removes all suspensions and
turns the functions into synchronous functions.

For example, this function does not actually require any suspensions,
once the correct executor is acquired upon initial entry:

```
func fib(_ n: Int) async -> Int {
  if n <= 1 { return n }
  return await fib(n-1) + fib(n-2)
}
```

So we can turn the above into this for better performance:

```
func fib() async -> Int {
  return fib_sync()
}

func fib_sync(_ n: Int) -> Int {
  if n <= 1 { return n }
  return fib(n-1) + fib(n-2)
}
```

while rewriting callers of `fib` to use the `sync` entry-point
when we can prove that it will be invoked on a compatible executor.

This pass is currently experimental and under development. Thus, it
is disabled by default and you must use
`-enable-experimental-async-demotion` to try it.
2023-09-21 12:21:02 -07:00
swift-ci
5a9893a62a Merge remote-tracking branch 'origin/main' into rebranch 2023-09-20 14:34:28 -07:00
Kuba Mracek
37160dfa0b [embedded] Don't force disable ObjC interop, produce an error instead 2023-09-20 12:16:18 -07:00
Kuba Mracek
78be31cca4 [embedded] Disable Objective-C interop in embedded Swift 2023-09-20 11:29:59 -07:00
Kuba Mracek
a31c3388e4 [embedded] Add a temporary flag that turns throws into traps so that programs that use throwing can at least be compiled for now 2023-09-19 22:00:51 -07:00
Kuba Mracek
e898a9a4fd [embedded] Build the stdlib for x86_64 too, and run executable tests on x86_64 2023-09-18 20:25:32 -07:00
swift-ci
7d8091fe2e Merge remote-tracking branch 'origin/main' into rebranch 2023-09-18 12:14:41 -07:00
Kuba Mracek
11221d815c [embedded] DisableLegacyTypeInfo in embedded mode and add missing REQUIRES: swift_in_compiler in a test 2023-09-17 13:17:08 -07:00
Kuba Mracek
9f9e90657d [embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presense 2023-09-16 12:56:23 -07:00
Kuba Mracek
ae2e903574 [embedded] Build an initial embedded Swift standard library
This isn't a "complete" port of the standard library for embedded Swift, but
something that should serve as a starting point for further iterations on the
stdlib.

- General CMake logic for building a library as ".swiftmodule only" (ONLY_SWIFTMODULE).
- CMake logic in stdlib/public/core/CMakeLists.txt to start building the embedded stdlib for a handful of hardcoded target triples.
- Lots of annotations throughout the standard library to make types, functions, protocols unavailable in embedded Swift (@_unavailableInEmbedded).
- Mainly this is about stdlib functionality that relies on existentials, type erasure, metatypes, reflection, string interpolations.
- We rely on function body removal of unavailable functions to eliminate the actual problematic SIL code (existentials).
- Many .swift files are not included in the compilation of embedded stdlib at all, to simplify the scope of the annotations.
- EmbeddedStubs.swift is used to stub out (as unavailable and fatalError'd) the missing functionality.
2023-09-16 12:38:46 -07:00