Commit Graph

1195 Commits

Author SHA1 Message Date
Xi Ge
5c5715f626 Serialization: embed subminor and build version in the user module version entry 2021-05-17 10:15:47 -07:00
Xi Ge
ae4781dd90 test: specify touch time to ensure mod time difference
rdar://78027229
2021-05-14 13:04:44 -07:00
Doug Gregor
2b9ca315fe [Concurrency] Remove asyncHandler attribute.
The `asyncHandler` attribute turned out to be the wrong solution
to the problem of creating a sync->async bridge. Remove it.
2021-05-13 17:01:39 -07:00
Xi Ge
b6cd513534 Frontend: teach the compiler to use a backup directory to find .swiftinterface files to compile
This mechanism allows the compiler to use a backup interface file to build into a binary module when
a corresponding interface file from the SDK is failing for whatever reasons. This mechansim should be entirely opaque
to end users except several diagnostic messages communicating backup interfaces are used.

Part of rdar://77676064
2021-05-13 09:11:45 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Alex Hoppen
7462a62b37 Merge pull request #37238 from ahoppen/pr/dont-print-dollar-internal-labels
[AST] Don’t print internal function labels if they start with '$'
2021-05-04 18:34:20 +02:00
Alex Hoppen
66e416b604 [AST] Don’t print internal function labels if they start with '$'
We might infer internal function labels as `$0` from a closure with which a variable is initialised. But we don’t want to print the function signature as `(_ $0: Int) -> Int` because `$0` is not a valid variable name to declare.

So, in the case described above, only print the type.

Fixes rdar://77462547
2021-05-04 12:42:58 +02:00
Kavon Farvardin
e17e09c294 Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency.
2. Updates eff. prop tests to remove experimental flag,
   and also adjusts some tests slightly to avoid things
   that are still behind that flag.
2021-05-03 14:10:44 -07:00
Kavon Farvardin
c5ec5bf5b1 fix feature guards in swiftinterface for eff. props 2021-04-30 17:07:18 -07:00
Alexis Laferrière
a232ebbf43 [Test] Disable ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift for hangs 2021-04-30 15:36:02 -07:00
Xi Ge
c7b383c1e7 Merge pull request #37177 from nkcsgexi/73992299-1
ModuleInterface/Serialization: allow library authors to define a custom module version number
2021-04-30 14:43:16 -07:00
Xi Ge
043d492c65 Merge branch 'main' into 73992299-1 2021-04-30 10:19:57 -07:00
Xi Ge
fe5c7ef995 ModuleInterface/Serialization: allow library authors to define a custom module version number
This allows library authors to pass down a project version number so that library users can conditionally
import that library based on the available version in the search paths.

Needed for rdar://73992299
2021-04-30 10:00:45 -07:00
John McCall
186c53000d Introduce basic support for custom executors.
- Introduce an UnownedSerialExecutor type into the concurrency library.
- Create a SerialExecutor protocol which allows an executor type to
  change how it executes jobs.
- Add an unownedExecutor requirement to the Actor protocol.
- Change the ABI for ExecutorRef so that it stores a SerialExecutor
  witness table pointer in the implementation field.  This effectively
  makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that
  default actors are represented without a witness table pointer (just
  a bit-pattern).
- Synthesize the unownedExecutor method for default actors (i.e. actors
  that don't provide an unownedExecutor property).
- Make synthesized unownedExecutor properties `final`, and give them
  a semantics attribute specifying that they're for default actors.
- Split `Builtin.buildSerialExecutorRef` into a few more precise
  builtins.  We're not using the main-actor one yet, though.

Pitch thread:
  https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
2021-04-30 03:11:56 -04:00
Kavon Farvardin
c1f48c6855 fix missing effects specifiers on eff props in swiftinterface
I missed the case where the body is also being printed in the
interface file.
2021-04-29 20:29:50 -07:00
Doug Gregor
b88e678694 [SE-0306] Disable actor inheritance.
Actor inheritance was removed in the second revision of SE-0306. Remove
the ability to inherit actors.

Note that this doesn't fully eliminate all vestigates of inheritance
from actors. There are simplifications that need to be performed
still, e.g., there's no need to distinguish
designated/convenience/required initializers. That will follow.
2021-04-23 15:08:57 -07:00
Doug Gregor
cdd6ad8bfd Introduce a feature for @_inheritActorContext
Add a feature for this new attribute, and make sure we use the feature
guard for functions that use it, e.g., the new `async`.

Finishes rdar://76927008.
2021-04-22 15:49:48 -07: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
Alex Hoppen
6e36a051ec [test] Fix CI failure in bad stdlib test
https://github.com/apple/swift/pull/36928 changed the error message while https://github.com/apple/swift/pull/36594 added a test case looking for the old error message. Update the test to look for the non-dynamic substring of the new error message.
2021-04-16 13:11:48 +02:00
eeckstein
f53f80ff04 Merge pull request #36928 from eeckstein/module-build-error-message
ModuleInterfaceBuilder: give a more specific error message in case of a compiler mismatch
2021-04-16 08:55:32 +02:00
Doug Gregor
c1328bd83f Merge pull request #36857 from DougGregor/import-concurrency-by-default-take-2
Enable import of the _Concurrency module by default.
2021-04-15 13:12:45 -07:00
Becca (née Brent) Royal-Gordon
6e710b2806 Merge pull request #36594 from beccadax/nonstandard-library
Preload standard library in ModuleInterfaceBuilder
2021-04-15 10:43:28 -07:00
Erik Eckstein
d49de1a982 ModuleInterfaceBuilder: give a more specific error message in case of a compiler mismatch 2021-04-15 14:06:17 +02:00
Becca Royal-Gordon
28c260e38d Disable ModuleInterface/BadStdlib.swiftinterface on Windows (SR-14489) 2021-04-14 17:29:51 -07:00
Doug Gregor
568e943115 Enable import of the _Concurrency module by default. 2021-04-13 23:14:06 -07:00
Arnold Schwaighofer
9286ece71c Revert "Enable import of the _Concurrency module by default." 2021-04-09 13:20:30 -07:00
Doug Gregor
95fd3ede09 Update tests and testing tools for implicit _Concurrency import 2021-04-06 14:08:41 -07:00
Doug Gregor
878d6c258c [Module interface] Ensure that we keep #ifs for compiler workarounds.
Fixes rdar://76236364.
2021-04-05 21:46:53 -07:00
Mike Ash
6d2fc9e9bd Add @availability to some concurrency tests that were missing it. 2021-04-01 15:34:33 -04:00
Becca Royal-Gordon
02c747609b Preload standard library in ModuleInterfaceBuilder
Previously, when the standard library module interface was broken, Swift would try to rebuild it repeatedly during -compile-module-from-interface jobs because `ASTContext::getStdlibModule()` would try to load the standard library again each time it was called. This led to extremely slow compilations that repeatedly emitted the same errors.

To avoid this, we make ModuleInterfaceBuilder try to load the standard library right away and bail out if it can’t.

Fixes rdar://75669548.
2021-03-25 18:48:00 -07:00
Doug Gregor
c76dac7155 Banish @asyncHandler to a hidden flag.
We don't want @asyncHandler to be part of the concurrency model, so put
it behind a different flag.
2021-03-25 16:45:21 -07:00
Erik Eckstein
78ec15cf38 tests: remove some unused FileCheck prefix options
Such tests would fail with the -allow-unused-prefixes FileCheck option.

diff --git a/test/lit.cfg b/test/lit.cfg
-run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s' % (
+run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s -allow-unused-prefixes=false' % (

It helps avoiding some wrong CHECK patterns.
I just looked briefly at some of the fails. TODO: fix remaining tests, too.

rdar://74189761
2021-03-25 15:19:30 +01:00
David Zarzycki
00533e8712 [NFC] Change magic emoji to __ 2021-03-23 13:41:16 -04:00
Michael Gottesman
9aa211112f Merge pull request #36379 from gottesmm/pr-cff5438783955ec4ac3e7b541e54eb87b9cc3b04
[ossa][frontend] Separately namespace enable-ossa-modules in the module cache so that the flag causes recompilation of imported resilient modules.
2021-03-19 04:02:14 -07:00
Doug Gregor
52096a640e SE-0302: Rename ConcurrentValue/@concurrent to Sendable/@Sendable. 2021-03-18 23:48:21 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Michael Gottesman
05f8d933da Eliminate a subshell from a test so test works on windows. 2021-03-18 21:14:20 -07:00
Michael Gottesman
ae835036cb [ossa-modules] Add a new lit pattern %relative-platform-module-dir-prefix so tests can use the proper prefix to have Swift find a fake sdk module. 2021-03-18 18:36:40 -07:00
Michael Gottesman
504b5f2058 [ossa][frontend] Separately namespace enable-ossa-modules in the prebuilt module cache so that the flag causes recompilation of imported resilient modules when the flag is enabled.
This will enable users to try out the '-enable-ossa-modules' flag if their
compiler supports it and get OSSA code on all inlinable code that they use. The
idea is that this is a nice way to stage this in and get more testing.

The specific implementation is that the module interface loader:

1. Knows if enable ossa modules is enabled not to search for any compiled
modules. We always rebuild from the interface file on the system.

2. Knows that if enable ossa modules is enabled to mixin a bit into the module
interface loader cache hash to ensure that we consider the specialized ossa
compiled modules to be different than the modules in that cache from the system.

This ensures that when said flag is enabled, the user transparently gets all
their code in OSSA form from transparent libraries.
2021-03-18 13:03:51 -07:00
Doug Gregor
7f5c5695d1 Merge pull request #36405 from DougGregor/mangle-module-abi-name-concurrency 2021-03-12 19:29:05 -08:00
Doug Gregor
c18ef1af94 Properly collect all enclosing features. 2021-03-12 11:23:27 -08:00
Doug Gregor
2a28fed34d Allow one to separately specify the ABI name of a module.
Introduce a new compiler flag `-module-abi-name <name>` that uses the
given name as the ABI name for the module (rather than the module's
name in source code). The ABI name impacts name mangling and metadata.
2021-03-12 07:42:07 -08:00
Doug Gregor
7015543c9c [Module interfaces] More aggressively #if-out declarations.
Extend the checks for marker protocols and rethrows protocols to ensure
that we #if out more code that relies on them in module interface
generation. This makes the _Concurrency module parseable by much older
compilers.

Fixes rdar://75291705.
2021-03-11 22:03:29 -08:00
Alexis Laferrière
eeab067a45 Merge pull request #36380 from xymus/private-over-prebuilt
[Frontend] Don't load modules from the prebuilt cache for private interfaces
2021-03-10 11:22:57 -08:00
Alexis Laferriere
82cb31d629 [Frontend] Don't load modules from the prebuilt cache for private interfaces
rdar://73007024
2021-03-09 19:21:14 -08:00
Slava Pestov
6615e16bfa AST: Skip stub initializers when printing module interfaces
When a derived class does not inherit a designated initializer from
its base class, we override the designated initializer's vtable
entry with a stub which traps with a fatal error.

The stub cannot be called and clients do not need to be aware of
its existence, so don't print it at all in the module interface.

Fixes rdar://problem/71122015 / https://bugs.swift.org/browse/SR-13832.
2021-03-05 23:53:57 -05:00
Doug Gregor
2b9fa92914 [AST Printing] Consider the storage decl as the "enclosing" decl of an acccessor
Fixes spurious #if's when printing for backward compatibility, rdar://75074036
2021-03-04 21:47:17 -08:00
Doug Gregor
b5e4b085aa Infer ConcurrentValue conformances for structs and enums.
When a struct or enum has only ConcurrentValue-conforming instance
data, infer conformance to ConcurrentValue.
2021-03-02 00:23:33 -08:00
Doug Gregor
e7d7585503 Add a feature for global actors & module interface support 2021-02-22 20:46:58 -08:00
Doug Gregor
f21c60928c Add feature for rethrows protocols and use it in module interface generation 2021-02-22 16:18:47 -08:00