forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 30
Merge main 2021-01-30 #2618
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
Merge main 2021-01-30 #2618
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The CoreFoundation implementation on non-Darwin platforms included in Foundation is not meant to be used as a general purpose CoreFoundation implementation. Since non-Darwin targets do not default to providing a CoreFoundation implementation, we should generally assume that the symbol is not present. This changes the non-Darwin paths to always use `dispatch_main` rather than `CFRunLoopRun`.
…Task. Debugging tools can use _swift_concurrency_debug_asyncTaskMetadata to identify memory blocks as async task allocations by looking at their isa/metadata pointer. rdar://72906895
Introduce `@concurrent` attribute on function types, including: * Parsing as a type attribute * (De-/re-/)mangling for concurrent function types * Implicit conversion from @Concurrent to non-@Concurrent - (De-)serialization for concurrent function types - AST printing and dumping support
…functions. @Concurrent functions are, of course, concurrent. Treat them that way.
Used to just crash: > Assertion failed: (loc.isValid() && "Diagnosing attribute with invalid location"), function diagnoseAndRemoveAttr but now includes at least information what attribute caused the crash: > Attribute '@actorIndependent ' has invalid location, failed to diagnose! Assertion failed: (false && "Diagnosing attribute with invalid location"), function diagnoseAndRemoveAttr
This ensures that they enable concurrency-related checks.
Part of rdar://problem/73625623.
We want to use the 'just built' compiler for the runtime tests because of the recently added `swiftasync` parameter support. But ASAN won't link if we use the 'just built' compiler because libgtest and LLVMSupport are compiled by the host compiler. Disable the runtime test when running under ASAN. rdar://73664504
The last outstanding usage is in Concurrency/Runtime/checked_continuation.swift
…e async methods Resilient witness tables and resilient class vtables are built from descriptors. Make sure we reference the AsyncFunctionPointer of a method implementation, and not the implementation itself, if the method is async. Part of rdar://problem/73625623.
[Test] Replaced temporary function with async main.
Make sure that we check the isolation of the context in which a reference to `self` is made, rather than the context in which `self` is declared, when checking whether we are within actor-isolated code. This ensures that we report errors as actor-isolation errors rather than falling back to the "may execute concurrently with" checking.
Concurrent functions need to be actor-independent because they wouldn't ever be safe to run concurrently while isolated on an actor. This allows us to elimate the "may execute concurrently with" check related to actor isolation, which is a cleaner overall story.
This reverts commit 7a1065c.
This reverts commit fe928d5. This causes an ASAN failure. Reverting until it can be debugged.
Revert JumpThreadingCost improvements
Try to fix the ASAN build
This was broken by commit cf1f240. This commit reverts the 2 lines which broke the inclusion of header files in the generated Xcode project.
…n-types [Concurrency] Add @Concurrent function types
Concurrency: avoid `CFRunLoopRun` on non-Darwin
The async handler code doesn't really run concurrently with where it is launched, despite the implementation currently using `runDetached` internally. Drop the @Concurrent and bitcase it back on when needed.
Add @Concurrent to SIL function types, mirroring what's available on AST function types. @Concurrent function types will have by-value capture semantics.
PointsToStartBit: was never set. IsInTopLevel: was never checked (except for SIL printing)
My goal was to reduce the size of SILLocation. It now contains only of a storage union, which is basically a pointer and a bitfield containing the Kind, StorageKind and flags. By far, most locations are only single pointers to an AST node. For the few cases where more data needs to be stored, this data is allocated separately: with the SILModule's bump pointer allocator. While working on this, I couldn't resist to do a major refactoring to simplify the code: * removed unused stuff * The term "DebugLoc" was used for 3 completely different things: - for `struct SILLocation::DebugLoc` -> renamed it to `FilePosition` - for `hasDebugLoc()`/`getDebugSourceLoc()` -> renamed it to `hasASTNodeForDebugging()`/`getSourceLocForDebugging()` - for `class SILDebugLocation` -> kept it as it is (though, `SILScopedLocation` would be a better name, IMO) * made SILLocation more "functional", i.e. replaced some setters with corresponding constructors * replaced the hand-written bitfield `KindData` with C bitfields * updated and improved comments
No need to have a static get function - the constructor can be used directly. NFC
Store the 1-byte kindAndFlags of SILLocation in the instruction's SILNode bitfield and only store SILLocation::storage in SILInstruction directly. This reduces the space for the location from 2 to 1 word in SILInstruction.
Header files from within the lib directory were missing. Also: use get_filename_component instead of regex matching.
No one has touched this pass in years and I am going to do a little work in it to help with concurrency. So I am formatting the pass before I make further changes. All I did was I renamed CamelCase -> camelCase and git-clang-format the diff. I used clangd to incrementally perform the renaming using some integration into my editor.
SIL: shrink SILLocation and some refactoring
Replace the existing warning about any access to a local variable from concurrently-executing code with a more tailored error: concurrently-executing code may read a mutable varable, but cannot modify it. This is safe so long as we either always do by-value captures in concurrent closures or we ensure that no mutation of that variable can occur after the point of capture. We'll follow up with one of those. For now... be careful out there. Since we're promoting this to an error, narrow it down to concurrent closures and local functions, dropping the assumption that escaping closures "may execute concurrently."
…unctions. Concurrent closures and functions are, of course... concurrent. Treat them as such for the warnings about unsafe accesses to global variables.
…n-types-sil [SIL] Add `@concurrent` function types to SIL
Fixes rdar://73476584.
…2aab8b5ed2dc264026b6646
Fixes rdar://73695354.
…async-convention
…ispatch-thunks Support async calling convention for resilient class and protocol method dispatch thunks
…t-access-errors
…metadata [Concurrency] Add a debug variable pointing to the metadata for AsyncTask.
Diagnostics: improve error message at attr diagnosis failure
MaxDesiatov
approved these changes
Jan 30, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.