Commit Graph

2139 Commits

Author SHA1 Message Date
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
swift-ci
f316c11bd3 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-16 08:12:44 -07:00
zoecarver
a5d7d2f020 [embedded] Require whole module optimization in embedded mode. 2023-09-15 16:41:06 -06:00
swift-ci
a9f9785399 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 21:02:48 -07:00
Shubham Sandeep Rastogi
712e87c23c Merge pull request #68441 from rastogishubham/MCCASSwift2
Add driver options to swift to enable MCCAS
2023-09-13 10:18:07 -07:00
Kuba Mracek
d90cf10fae [embedded] Avoid marking all public symbols as 'do not dead strip' in embedded Swift 2023-09-12 22:25:27 -07:00
Shubham Sandeep Rastogi
7a1a3d61ed Add MCCAS options to swift and guard mccas.swift properly
Revert "Revert "Add driver options to swift to enable MCCAS.""

This reverts commit 0e8554bb15.
2023-09-12 14:10:59 -07:00
swift-ci
1363f59915 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-12 03:54:25 -07:00
Evan Wilde
0e8554bb15 Revert "Add driver options to swift to enable MCCAS."
This reverts commit 3c949028e8.
2023-09-11 13:36:36 -07:00
Kuba Mracek
9a380212c1 [embedded] Add an interim attr to mark declarations as unavailable in embedded Swift
Implemented as custom parsing logic instead of a proper attribute because we want it to be rewritten at parse time (into nothing in regular Swift mode, and into unconditional unavailable attr in embedded Swift mode), no serialization, printing, etc.
2023-09-10 08:23:31 -07:00
swift-ci
e77b2ee5b0 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 18:56:08 -07:00
Shubham Sandeep Rastogi
585c700965 Merge pull request #68138 from rastogishubham/MCCASSwift
Add driver options to swift to enable MCCAS.
2023-09-08 10:17:10 -07:00
Shubham Sandeep Rastogi
3c949028e8 Add driver options to swift to enable MCCAS.
To enable MCCAS, the following driver options have been added

-cas-backend: Enable MCCAS backend in swift, the option
-cache-compile-job must also be used.

-cas-backend-mode=native: Set the CAS Backend mode to emit an object
file after materializing it from the CAS.

-cas-backend-mode=casid: Emit a file with the CASID for the CAS that was
created.

-cas-backend-mode=verify: Verify that the object file created is
identical to the object file materialized from the CAS.

-cas-emit-casid-file: Emit a .casid file next to the object file when
CAS Backend is enabled.
2023-09-08 07:13:57 -07:00
Pavel Yaskevich
b8fb94b73c [Frontend] NFC: Add a flag to enable bridging of completion handlers to checked continuations 2023-09-07 17:35:35 -07:00
swift-ci
f52fc06ac7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 18:14:46 -07:00
zoecarver
9f75a262ab [embedded] Error if embedded Swift enables library evolution. 2023-09-06 10:48:17 -07:00
swift-ci
1582741df2 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 21:56:51 -07:00
Michael Gottesman
fa1558a175 [frontend] Add an option called -verify-additional-prefix to add additional check prefixes to the DiagnosticVerifier.
This enables one to use varying prefixes when checking diagnostics with the
DiagnosticVerifier. So for instance, I can make a test work both with and
without send-non-sendable enabled by adding additional prefixes. As an example:

```swift
// RUN: %target-swift-frontend ... -verify-additional-prefix no-sns-
// RUN: %target-swift-frontend ... -verify-additional-prefix sns-

let x = ... // expected-error {{This is always checked no matter what prefixes I added}}
let y = ... // expected-no-sns-error {{This is only checked if send non sendable is disabled}}
let z = ... // expected-sns-error {{This is only checked if send non sendable is enabled}}
let w = ... // expected-no-sns-error {{This is checked for a specific error when sns is disabled...}}
// expected-sns-error @-1 {{and for a different error when sns is enabled}}
```

rdar://114643840
2023-08-30 13:40:17 -07:00
swift-ci
fca0dc0a16 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 07:34:13 -07:00
Allan Shortlidge
3a02629be4 Frontend: Make lazy typechecking a TC opt instead of a frontend action. 2023-08-28 08:28:56 -07:00
swift-ci
787a51879c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-25 19:33:11 -07:00
Doug Gregor
339d31fabb [Macros] Add a frontend flag -Rmacro-loading to remark on macro resolution
Macro implementations can come from various locations associated with
different search paths. Add a frontend flag `-Rmacro-loading` to emit
a remark when each macro implementation module is resolved, providing
the kind of macro (shared library, executable, shared library loaded
via the plugin server) and appropriate paths. This allows one to tell
from the build load which macros are used.

Addresses rdar://110780311.
2023-08-25 15:09:49 -07:00
swift-ci
8d3034d4a4 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 08:33:53 -07:00
Sophia Poirier
aec59f2f9c Merge pull request #67974 from sophiapoirier/global-static-data-race-safety
enforce under strict concurrency that globals and statics be either…
2023-08-19 08:28:02 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00