Skip to content

Merge main 2021-03-18 #2876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 142 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
d4fc3e5
Duplicate select Swift Concurrency tests for TSan
Feb 26, 2021
e08cf61
Enable TSan for copied tests
Feb 26, 2021
e023695
actor_counters.swift: allow specifying of parameters
Feb 26, 2021
5187382
Add support for calling TSan's acquire()/release()
Feb 26, 2021
a3ccdd2
Teach TSan about Swift Task and Actor model
Feb 27, 2021
ea5bb77
Fix TSan symbol lookup on Windows
Mar 2, 2021
58056ff
Add positive TSan tests for Swift Concurrency
Mar 9, 2021
1668cfb
Revert "XFAIL TSAN Tests on AS Hosts"
kubamracek Mar 9, 2021
fe4984b
don't filter symbols if they have platform-agnostic availability
QuietMisdreavus Mar 10, 2021
77efd77
[APIDigester] Build the API digester as a frontend tool instead of a …
owenv Feb 20, 2021
df86242
Add leading and trailing space property for Token
kimdv Mar 10, 2021
a770356
[libSyntax] Inline commonly called methods in ParsedRawSyntaxRecorder
ahoppen Mar 11, 2021
b206832
[libSyntax] Eliminate loop and memory allocation translating ParsedRa…
ahoppen Mar 11, 2021
95cf4f3
[libSyntax] Eliminate unnecessary loop when making deferred layout
ahoppen Mar 11, 2021
084e57b
[libSyntax] Don't set hot use memory region if source is empty
ahoppen Mar 8, 2021
74ed2ac
[libSyntax] Store data of RecoredeOrDeferredNode as PointerIntPair
ahoppen Mar 12, 2021
a8ad32d
[ConstraintLocator] Add a new locator accessor to check whether it be…
xedin Mar 11, 2021
fb89d11
[ConstraintLocator] NFC: Adjust name of `isForKeyPathComponent` to cl…
xedin Mar 12, 2021
7e6fb9f
Remove USE_SWIFT_ASYNC_LOWERING CMake setting.
varungandhi-apple Mar 12, 2021
5d1b588
use fully qualified titles for enum elements
QuietMisdreavus Mar 12, 2021
99bcd87
Use `swift_once` instead of C++ static initializers
Mar 12, 2021
dde9fa3
[ConstraintSystem] Re-activate constraints if, due to incorrect refer…
xedin Mar 12, 2021
11a641f
Enable mandatory copy propagation SIL pass.
atrick Mar 12, 2021
5e2bd57
driver: prefer a new driver name as swift-driver instead of swift-dri…
nkcsgexi Mar 10, 2021
b948f20
build-script: keep SwiftDriver as the last product to build
nkcsgexi Mar 11, 2021
efaaee3
[IRGen] Mangling for async, non-constant partial_apply thunks.
nate-chandler Mar 15, 2021
ea8f43a
SILCombine: remove unneeded reference counting instructions from glob…
eeckstein Mar 15, 2021
c62b452
IRGen: don't initialized a global_object static object if not needed.
eeckstein Mar 15, 2021
5871025
Merge pull request #36367 from apple/QuietMisdreavus/symbol-availability
QuietMisdreavus Mar 15, 2021
aac2caf
[stdlib] Speed up the FixedPointConversion tests (#36434)
benrimmington Mar 15, 2021
8416578
Merge pull request #36422 from apple/QuietMisdreavus/enum-titles
QuietMisdreavus Mar 15, 2021
2d463d7
Merge pull request #36436 from nate-chandler/concurrency/irgen/noncon…
nate-chandler Mar 15, 2021
00f495f
Mangling for suspend/await resume partial functions
aschwaighofer Mar 13, 2021
ddb96cd
Merge pull request #36372 from apple/revert-1e3de357
jckarter Mar 15, 2021
2a1a7a8
Merge pull request #36388 from nkcsgexi/75275788
nkcsgexi Mar 15, 2021
2083e1b
[Driver] Use library search group when linking statically (#36356)
drexin Mar 15, 2021
5b2afec
Only produce ConcurrentValue-related diagnostics under -warn-concurre…
DougGregor Mar 15, 2021
8c2a040
Merge pull request #36427 from xedin/rdar-74711236
xedin Mar 15, 2021
4c7f0fd
Split out 'defer' tests into their own file
slavapestov Mar 15, 2021
d608cb5
Merge pull request #36429 from aschwaighofer/mangling_for_async_resum…
aschwaighofer Mar 15, 2021
7ef9cc6
[Gardening] Fixed sigil.
nate-chandler Mar 10, 2021
a066ecb
[Gardening] Tweaked comment.
nate-chandler Mar 10, 2021
218b9c0
[IRGen] Added LinkEntity for partial apply forwarder.
nate-chandler Mar 10, 2021
bf728e7
[IRGen] Added LinkEntity for AFP to PAF.
nate-chandler Mar 10, 2021
95a508a
[Test] Mangling of second PAF for a function.
nate-chandler Mar 15, 2021
6c7063d
[Test] Gave async/partial_apply[_forwarder].sil pa'd funcs sizes.
nate-chandler Mar 9, 2021
c8c39f8
[Test] Passed -g in IRGen/async/partial_apply.sil.
nate-chandler Mar 10, 2021
9501371
[Test] Added for part_ap of async @conv(method).
nate-chandler Mar 10, 2021
fb5c4a1
[Test] Updated FC'd PAF names.
nate-chandler Mar 10, 2021
d29f8b6
[Test] Tested @callee_guaranteed witness_method.
nate-chandler Mar 10, 2021
e371f55
[Test] FC'd part_ap of async dyn witness_method.
nate-chandler Mar 10, 2021
dbe689a
[AST] De/mangling for functions with generic sigs.
nate-chandler Mar 10, 2021
ee63777
[IRGen] Fix ABI for thick async functions.
nate-chandler Mar 15, 2021
2b72725
Special-case the relationship of Error and CodingKey to ConcurrentValue
DougGregor Mar 15, 2021
4e26d84
fix a use-after free in MemoryLocations
eeckstein Mar 15, 2021
b6381d4
Sema: Ban forward references of captured values from 'defer' body
slavapestov Mar 15, 2021
934ec4d
Merge pull request #36440 from DougGregor/concurrentvalue-only-warn-c…
swift-ci Mar 15, 2021
fd2ba30
Remove .#doc_clang_module.swift
kastiglione Mar 15, 2021
3746c35
Merge pull request #36443 from eeckstein/main
swift-ci Mar 15, 2021
2a9903d
[Diagnostics] Check whether missing conformance could be fixed by usi…
xedin Mar 15, 2021
b85b7f1
Merge pull request #36408 from atrick/enable-mandatory-copyprop
atrick Mar 15, 2021
b694698
[Diagnostics] Don't record unwrap fix if `?` was used incorrectly
xedin Mar 16, 2021
e92c6eb
[Diagnostics] NFC: Use non-initializer diagnostic when raw representa…
xedin Mar 16, 2021
029765c
Merge pull request #36424 from varungandhi-apple/vg-remove-cmake-flag
swift-ci Mar 16, 2021
6424eea
Merge pull request #36444 from apple/Remove-.-doc_clang_module.swift
kastiglione Mar 16, 2021
179a707
Merge pull request #36284 from nate-chandler/concurrency/irgen/rdar72…
nate-chandler Mar 16, 2021
56d9bbb
Manually demangle TSan report to make test pass on Linux
Mar 15, 2021
2ccb312
Mark test unsupported on Linux and Windows
Mar 15, 2021
281ce3d
Merge pull request #36442 from DougGregor/error-codingkey-backward-in…
DougGregor Mar 16, 2021
3bd26d0
Merge pull request #36381 from owenv/api-digester-as-frontend-tool
swift-ci Mar 16, 2021
91be112
Merge pull request #36383 from kimdv/kimdv/add-leading-trailing-space…
ahoppen Mar 16, 2021
28a5eee
SILMem2Reg: don't create an "undef" as a replacement of a load of an …
eeckstein Mar 16, 2021
eee33a7
GlobalOpt: bail is the initializer instructions of a global variable …
eeckstein Mar 16, 2021
b12b4e9
Don't crash in RawSILInstLowering if DI produced an error.
eeckstein Mar 16, 2021
898cdc0
Merge pull request #36439 from eeckstein/lookup-table-opt
eeckstein Mar 16, 2021
4fe3214
Merge pull request #36420 from ahoppen/pr/recordedordeferrednode-poin…
ahoppen Mar 16, 2021
eb15f33
Temporarily move FixedPoint.swift.gyb into long_test
atrick Mar 16, 2021
129fca6
Merge pull request #36447 from eeckstein/main
eeckstein Mar 16, 2021
97ed11f
Merge pull request #36449 from eeckstein/fix-rawinstsillowering
eeckstein Mar 16, 2021
8abf12f
Add `swift_task_set_tsan_hooks()`
Mar 16, 2021
d4fae29
[Driver] Emit the `-new-driver-path` option before actual compiler ar…
artemcm Mar 16, 2021
58dbf60
Merge pull request #36441 from slavapestov/ban-defer-forward-reference
slavapestov Mar 16, 2021
7e6b5b2
[Driver] Don't validate arclite linking if the driver is only set up …
ahoppen Mar 16, 2021
fece895
Merge pull request #36417 from ahoppen/pr/libsyntax-performance-impro…
ahoppen Mar 16, 2021
2a46f5f
Merge pull request #36452 from artemcm/NewDriverDummyOptFirst
artemcm Mar 17, 2021
5499235
Merge pull request #36216 from apple/tsan-swift-concurrency2
swift-ci Mar 17, 2021
7f6b681
[Parser] Parse custom attributes on types.
DougGregor Mar 16, 2021
f7800fd
Propagate parsed type attributes to TypeAttributes.
DougGregor Mar 16, 2021
09d7f47
Fix code completion for custom attributes.
DougGregor Mar 17, 2021
6c879d6
Change the async ABI to not pass the active task and executor.
rjmccall Mar 15, 2021
f4f3d52
Merge pull request #36456 from ahoppen/pr/no-xcrun-in-sourcekitd
akyrtzi Mar 17, 2021
4ca67f6
[ConstraintSystem] Teach `getFunctionArgApplyInfo` about `inout` expr…
xedin Mar 17, 2021
8e4598e
GSB: Narrow scope of conditional requirement inference
slavapestov Mar 17, 2021
8256a4e
Update Swift version to 5.5
tkremenek Mar 17, 2021
bab2fb6
Merge pull request #36458 from DougGregor/custom-type-attributes
DougGregor Mar 17, 2021
0a39420
Merge pull request #36450 from atrick/move-fixedpoint
atrick Mar 17, 2021
45c73b3
[Diagnostics] Even though missing conformance could be fixed by `.raw…
xedin Mar 17, 2021
3a357e9
Add global actor-qualified function types.
DougGregor Mar 16, 2021
d6fc1fd
Implement conversions for global-actor-qualified functions.
DougGregor Mar 17, 2021
dbc63eb
Synchronous closures can have global actors as part of their type
DougGregor Mar 17, 2021
0760739
Propagate global actor to a closure from its contextual type.
DougGregor Mar 17, 2021
5eea13e
Improve closure lookahead for custom attributes
DougGregor Mar 17, 2021
0f8e1ca
Clean up and test global actor propagation rules
DougGregor Mar 17, 2021
29cfd3e
Merge pull request #36437 from rjmccall/async-abi-task-executor-args
aschwaighofer Mar 17, 2021
f75fbb7
IRGen: Async ABI passing parameter and results directly
aschwaighofer Mar 17, 2021
3c125a7
arm64e: Workaround ptrauth-returns failure for swifttailcc
aschwaighofer Mar 11, 2021
5b4e056
[IRGen] Fix debug info for direct arguments/return values
aschwaighofer Mar 11, 2021
ea4882e
[mailmap] Make ahoppen@apple.com primary email for Alex Hoppen
ahoppen Mar 17, 2021
5193d76
[Runtime] Fixed shared cache protocol conformance lookup with subclas…
mikeash Mar 17, 2021
ddae275
UnXFAIL Runtime/async_task_handle_cancellation.swift
aschwaighofer Mar 17, 2021
d96760b
Merge pull request #36281 from aschwaighofer/wip_new_abi
aschwaighofer Mar 17, 2021
289840b
Add test case for diagnostic 'because_rethrows_default_argument_throws'
kthchew Mar 16, 2021
19263a7
Merge pull request #36466 from DougGregor/global-actor-function-types
DougGregor Mar 17, 2021
2d6ded2
Merge pull request #36467 from ahoppen/pr/update-mailmap
swift-ci Mar 17, 2021
abab6b3
[cxx-interop] Bail earlier when importing invalid records.
zoecarver Mar 7, 2021
97ed91b
Merge pull request #36469 from aschwaighofer/unxfail_async_task_handl…
swift-ci Mar 17, 2021
24e4aad
Merge pull request #36460 from slavapestov/non-well-founded-condition…
slavapestov Mar 17, 2021
adc3938
GSB: Remove unused parameter to FloatingRequirementSource::isRecursive()
slavapestov Mar 12, 2021
60c1755
GSB: Generalize redundant requirement algorithm to record which requi…
slavapestov Mar 16, 2021
15b83e1
Merge pull request #36468 from mikeash/fix-shared-cache-subclass-conf…
mikeash Mar 17, 2021
afa08f0
GSB: Formalize the old hack where we rebuild a signature that had red…
slavapestov Mar 16, 2021
504d4f5
Add two passing regression tests and a failing one
slavapestov Mar 17, 2021
1dd914a
Merge pull request #36445 from xedin/rdar-75367157
xedin Mar 17, 2021
e50a944
Limit conversion that adds a global actor to a function type to subty…
DougGregor Mar 17, 2021
5e68204
Merge pull request #36459 from xedin/rdar-75146811
xedin Mar 17, 2021
351cee3
[Mangling] Don't mangle global actor types in declarations.
DougGregor Mar 17, 2021
3bdd5cb
IRGen: async error ABI
aschwaighofer Mar 14, 2021
b0472a8
Revert "Disable tests on arm64e"
adrian-prantl Mar 18, 2021
f17b7e2
Merge pull request #36463 from tkremenek/swift-5.5-version-bump
tkremenek Mar 18, 2021
3b2c3d2
Merge pull request #36473 from DougGregor/global-actor-function-type-…
swift-ci Mar 18, 2021
72eb0d3
Merge pull request #36476 from DougGregor/global-actor-mangling-hack
swift-ci Mar 18, 2021
891e053
Merge pull request #36454 from slavapestov/rebuild-signature-without-…
slavapestov Mar 18, 2021
17e3ee7
GSB: Don't emit diagnostics with <<error type>> in them
slavapestov Mar 18, 2021
568d99f
Sema: Clean up @_specialize diagnostics
slavapestov Mar 18, 2021
b534552
Merge pull request #36479 from apple/revert-36106-arm64e-disable
swift-ci Mar 18, 2021
26831c6
Merge pull request #36455 from kthchew/SR-14270
varungandhi-apple Mar 18, 2021
69cf113
Merge pull request #36480 from slavapestov/specialize-attr-cleanup
slavapestov Mar 18, 2021
79f7745
Merge pull request #36343 from zoecarver/fix/inherit-deleted-copy-ctor
zoecarver Mar 18, 2021
f99b477
Merge pull request #36475 from aschwaighofer/wip_error_async_abi
aschwaighofer Mar 18, 2021
74389af
Merge remote-tracking branch 'apple/main' into katei/merge-main-2021-…
kateinoigakukun Mar 18, 2021
f5d3fce
Fix "Option 'o' registered more than once!" for merge-module-summary
kateinoigakukun Mar 18, 2021
04ba2d9
Fix compilation failure on concurrency thread sanitizer
kateinoigakukun Mar 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Adrian-Constantin Popescu <epsilon.gamma@gmail.com> <adrian-constantin.popescu@outlook.com>
Alex Blewitt <alblue@apple.com> <alex.blewitt@gmail.com>
Alex Hoppen <alex@alexhoppen.de> <alex@ateamer.de>
Alex Hoppen <alex@alexhoppen.de> <ahoppen@apple.com>
Alex Hoppen <ahoppen@apple.com> <alex@ateamer.de>
Alex Hoppen <ahoppen@apple.com> <alex@alexhoppen.de>
Alexis Beingessner <abeingessner@apple.com> <a.beingessner@gmail.com>
Alper Çugun <github@alper.nl> <alper@users.noreply.github.com>
Amr Aboelela <amraboelela@gmail.com> <amraboelela@users.noreply.github.com>
Expand Down
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
# can be reused when a new version of Swift comes out (assuming the user hasn't
# manually set it as part of their own CMake configuration).
set(SWIFT_VERSION "5.4")
set(SWIFT_VERSION "5.5")

set(SWIFT_VENDOR "" CACHE STRING
"The vendor name of the Swift compiler")
Expand Down Expand Up @@ -196,13 +196,6 @@ if(SWIFT_PROFDATA_FILE AND EXISTS ${SWIFT_PROFDATA_FILE})
add_definitions("-fprofile-instr-use=${SWIFT_PROFDATA_FILE}")
endif()

option(USE_SWIFT_ASYNC_LOWERING
"Indicates if Swiftc should use async-specific lowering for async
functions if it is supported for the target. The runtime also checks
this setting before using async-specific attributes. This only applies
to the async calling convention and not to the async context attribute."
TRUE)

#
# User-configurable Swift Standard Library specific options.
#
Expand Down
5 changes: 4 additions & 1 deletion docs/ABI/Mangling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ Globals
// TODO check this::
global ::= mangled-name 'TA' // partial application forwarder
global ::= mangled-name 'Ta' // ObjC partial application forwarder
global ::= mangled-name 'Tw' index // async partial apply thunk for a non-constant function
global ::= mangled-name 'TQ' index // Async await continuation partial function
global ::= mangled-name 'TY' index // Async suspend continuation partial function

global ::= type 'w' VALUE-WITNESS-KIND // value witness

Expand Down Expand Up @@ -209,7 +212,7 @@ types where the metadata itself has unknown layout.)
global ::= global 'TD' // dynamic dispatch thunk
global ::= global 'Td' // direct method reference thunk
global ::= global 'TI' // implementation of a dynamic_replaceable function
global :== global 'Tu' // async function pointer of a function
global ::= global 'Tu' // async function pointer of a function
global ::= global 'TX' // function pointer of a dynamic_replaceable function
global ::= entity entity 'TV' // vtable override thunk, derived followed by base
global ::= type label-list? 'D' // type mangling for the debugger with label list for function types.
Expand Down
4 changes: 2 additions & 2 deletions include/swift/ABI/Executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ class ExecutorRef {

using JobInvokeFunction =
SWIFT_CC(swiftasync)
void (Job *, ExecutorRef);
void (Job *);

using TaskContinuationFunction =
SWIFT_CC(swiftasync)
void (AsyncTask *, ExecutorRef, SWIFT_ASYNC_CONTEXT AsyncContext *);
void (SWIFT_ASYNC_CONTEXT AsyncContext *);

template <class AsyncSignature>
class AsyncFunctionPointer;
Expand Down
75 changes: 51 additions & 24 deletions include/swift/ABI/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ class alignas(2 * alignof(void*)) Job : public HeapObject {
/// Given that we've fully established the job context in the current
/// thread, actually start running this job. To establish the context
/// correctly, call swift_job_run or runJobInExecutorContext.
void runInFullyEstablishedContext(ExecutorRef currentExecutor);
void runInFullyEstablishedContext();

/// Given that we've fully established the job context in the
/// current thread, and that the job is a simple (non-task) job,
/// actually start running this job.
void runSimpleInFullyEstablishedContext(ExecutorRef currentExecutor) {
RunJob(this, currentExecutor);
void runSimpleInFullyEstablishedContext() {
RunJob(this);
}
};

Expand Down Expand Up @@ -193,8 +193,8 @@ class AsyncTask : public Job {
/// in the current thread, start running this task. To establish
/// the job context correctly, call swift_job_run or
/// runInExecutorContext.
void runInFullyEstablishedContext(ExecutorRef currentExecutor) {
ResumeTask(this, currentExecutor, ResumeContext);
void runInFullyEstablishedContext() {
ResumeTask(ResumeContext);
}

/// Check whether this task has been cancelled.
Expand Down Expand Up @@ -390,7 +390,7 @@ class AsyncTask : public Job {
}

/// Retrieve the error.
SwiftError *&getError() { return *&error; }
SwiftError *&getError() { return error; }

/// Compute the offset of the storage from the base of the future
/// fragment.
Expand Down Expand Up @@ -433,7 +433,7 @@ class AsyncTask : public Job {
///
/// Upon completion, any waiting tasks will be scheduled on the given
/// executor.
void completeFuture(AsyncContext *context, ExecutorRef executor);
void completeFuture(AsyncContext *context);

// ==== ----------------------------------------------------------------------

Expand All @@ -456,11 +456,11 @@ static_assert(sizeof(AsyncTask) == 14 * sizeof(void*),
static_assert(alignof(AsyncTask) == 2 * alignof(void*),
"AsyncTask alignment is wrong");

inline void Job::runInFullyEstablishedContext(ExecutorRef currentExecutor) {
inline void Job::runInFullyEstablishedContext() {
if (auto task = dyn_cast<AsyncTask>(this))
task->runInFullyEstablishedContext(currentExecutor);
task->runInFullyEstablishedContext();
else
runSimpleInFullyEstablishedContext(currentExecutor);
runSimpleInFullyEstablishedContext();
}

/// An asynchronous context within a task. Generally contexts are
Expand All @@ -484,6 +484,7 @@ class alignas(MaximumAlignment) AsyncContext {
ResumeParent;

/// The executor that the parent needs to be resumed on.
/// FIXME: remove this
ExecutorRef ResumeParentExecutor;

/// Flags describing this context.
Expand All @@ -496,10 +497,9 @@ class alignas(MaximumAlignment) AsyncContext {

AsyncContext(AsyncContextFlags flags,
TaskContinuationFunction *resumeParent,
ExecutorRef resumeParentExecutor,
AsyncContext *parent)
: Parent(parent), ResumeParent(resumeParent),
ResumeParentExecutor(resumeParentExecutor),
ResumeParentExecutor(ExecutorRef::generic()),
Flags(flags) {}

AsyncContext(const AsyncContext &) = delete;
Expand All @@ -509,10 +509,10 @@ class alignas(MaximumAlignment) AsyncContext {
///
/// Generally this should be tail-called.
SWIFT_CC(swiftasync)
void resumeParent(AsyncTask *task, ExecutorRef executor) {
void resumeParent() {
// TODO: destroy context before returning?
// FIXME: force tail call
return ResumeParent(task, executor, Parent);
return ResumeParent(Parent);
}
};

Expand All @@ -529,11 +529,10 @@ class YieldingAsyncContext : public AsyncContext {

YieldingAsyncContext(AsyncContextFlags flags,
TaskContinuationFunction *resumeParent,
ExecutorRef resumeParentExecutor,
TaskContinuationFunction *yieldToParent,
ExecutorRef yieldToParentExecutor,
AsyncContext *parent)
: AsyncContext(flags, resumeParent, resumeParentExecutor, parent),
: AsyncContext(flags, resumeParent, parent),
YieldToParent(yieldToParent),
YieldToParentExecutor(yieldToParentExecutor) {}

Expand All @@ -550,19 +549,47 @@ class YieldingAsyncContext : public AsyncContext {
/// futures.
class FutureAsyncContext : public AsyncContext {
public:
SwiftError **errorResult = nullptr;
OpaqueValue *indirectResult;

using AsyncContext::AsyncContext;
};

/// An asynchronous context within a task that describes a general "Future"
/// task that was started with a closure context.
class FutureClosureAsyncContext : public FutureAsyncContext {
/// This matches the ABI of a closure `() async throws -> ()`
using AsyncVoidClosureEntryPoint =
SWIFT_CC(swiftasync)
void (SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT HeapObject *);

/// This matches the ABI of a closure `<T>() async throws -> T`
using AsyncGenericClosureEntryPoint =
SWIFT_CC(swiftasync)
void(OpaqueValue *,
SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT HeapObject *);

/// This matches the ABI of the resume function of a closure
/// `() async throws -> ()`.
using AsyncVoidClosureResumeEntryPoint =
SWIFT_CC(swiftasync)
void(SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT SwiftError *);

class AsyncContextPrefix {
public:
// Async closure entry point adhering to compiler calling conv (e.g directly
// passing the closure context instead of via the async context)
AsyncVoidClosureEntryPoint *__ptrauth_swift_task_resume_function
asyncEntryPoint;
HeapObject *closureContext;
SwiftError *errorResult;
};

/// Storage that is allocated before the AsyncContext to be used by an adapter
/// of Swift's async convention and the ResumeTask interface.
class FutureAsyncContextPrefix {
public:
OpaqueValue *indirectResult;
// Async closure entry point adhering to compiler calling conv (e.g directly
// passing the closure context instead of via the async context)
AsyncGenericClosureEntryPoint *__ptrauth_swift_task_resume_function
asyncEntryPoint;
HeapObject *closureContext;

using FutureAsyncContext::FutureAsyncContext;
SwiftError *errorResult;
};

} // end namespace swift
Expand Down
2 changes: 1 addition & 1 deletion include/swift/ABI/TaskGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class alignas(Alignment_TaskGroup) TaskGroup {
void *PrivateData[NumWords_TaskGroup];

/// Upon a future task's completion, offer it to the task group it belongs to.
void offer(AsyncTask *completed, AsyncContext *context, ExecutorRef executor);
void offer(AsyncTask *completed, AsyncContext *context);
};

} // end namespace swift
Expand Down
17 changes: 10 additions & 7 deletions include/swift/AST/ASTDemangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ASTBuilder {
using BuiltType = swift::Type;
using BuiltTypeDecl = swift::GenericTypeDecl *; // nominal or type alias
using BuiltProtocolDecl = swift::ProtocolDecl *;
using BuiltSubstitution = std::pair<Type, Type>;
using BuiltRequirement = swift::Requirement;
explicit ASTBuilder(ASTContext &ctx) : Ctx(ctx) {}

ASTContext &getASTContext() { return Ctx; }
Expand Down Expand Up @@ -99,11 +101,14 @@ class ASTBuilder {
Type output, FunctionTypeFlags flags);

Type createImplFunctionType(
Demangle::ImplParameterConvention calleeConvention,
ArrayRef<Demangle::ImplFunctionParam<Type>> params,
ArrayRef<Demangle::ImplFunctionResult<Type>> results,
Optional<Demangle::ImplFunctionResult<Type>> errorResult,
ImplFunctionTypeFlags flags);
Demangle::ImplParameterConvention calleeConvention,
BuiltRequirement *witnessMethodConformanceRequirement,
ArrayRef<BuiltType> GenericParameters,
ArrayRef<BuiltRequirement> Requirements,
ArrayRef<Demangle::ImplFunctionParam<Type>> params,
ArrayRef<Demangle::ImplFunctionResult<Type>> results,
Optional<Demangle::ImplFunctionResult<Type>> errorResult,
ImplFunctionTypeFlags flags);

Type createProtocolCompositionType(ArrayRef<ProtocolDecl *> protocols,
Type superclass,
Expand All @@ -128,8 +133,6 @@ class ASTBuilder {

Type createSILBoxType(Type base);
using BuiltSILBoxField = llvm::PointerIntPair<Type, 1>;
using BuiltSubstitution = std::pair<Type, Type>;
using BuiltRequirement = swift::Requirement;
using BuiltLayoutConstraint = swift::LayoutConstraint;
Type createSILBoxTypeWithLayout(ArrayRef<BuiltSILBoxField> Fields,
ArrayRef<BuiltSubstitution> Substitutions,
Expand Down
6 changes: 0 additions & 6 deletions include/swift/AST/AnyFunctionRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,6 @@ class AnyFunctionRef {
return TheFunction.dyn_cast<AbstractClosureExpr*>();
}

bool isDeferBody() const {
if (auto *fd = dyn_cast_or_null<FuncDecl>(getAbstractFunctionDecl()))
return fd->isDeferBody();
return false;
}

/// Return true if this closure is passed as an argument to a function and is
/// known not to escape from that function. In this case, captures can be
/// more efficient.
Expand Down
Loading