-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DiscardingTG] Undo pointer auth workaround; fix memory leaks #65613
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
swift-ci
merged 7 commits into
swiftlang:main
from
ktoso:wip-discarding-error-task-leak
May 26, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
44aff27
[lit] introduce target-run-simple-leaks-swift to run with `leaks`
ktoso cad608e
[Discarding] Don't leak retained "first error" task when retaining it
ktoso b039691
make (normal) task group "dont leak" test use `leaks` and enable by d…
ktoso 9f5a707
back to println tests
ktoso d82de55
less code duplication
ktoso 760cb44
remove extra debug statements
ktoso e3d4b55
fix lit config on windows
ktoso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,6 +940,7 @@ static AsyncTaskAndContext swift_task_create_commonImpl( | |
// be is the final hop. Store a signed null instead. | ||
initialContext->Parent = nullptr; | ||
|
||
// FIXME: add discarding flag | ||
concurrency::trace::task_create( | ||
task, parent, group, asyncLet, | ||
static_cast<uint8_t>(task->Flags.getPriority()), | ||
|
@@ -1060,21 +1061,40 @@ void swift::swift_task_run_inline(OpaqueValue *result, void *closureAFP, | |
|
||
SWIFT_CC(swift) | ||
AsyncTaskAndContext swift::swift_task_create( | ||
size_t taskCreateFlags, | ||
size_t rawTaskCreateFlags, | ||
TaskOptionRecord *options, | ||
const Metadata *futureResultType, | ||
void *closureEntry, HeapObject *closureContext) { | ||
FutureAsyncSignature::FunctionType *taskEntry; | ||
size_t initialContextSize; | ||
std::tie(taskEntry, initialContextSize) = | ||
TaskCreateFlags taskCreateFlags(rawTaskCreateFlags); | ||
|
||
if (taskCreateFlags.isDiscardingTask()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the pointer auth dance for the nullary function type: |
||
ThinNullaryAsyncSignature::FunctionType *taskEntry; | ||
size_t initialContextSize; | ||
|
||
std::tie(taskEntry, initialContextSize) = | ||
getAsyncClosureEntryPointAndContextSize< | ||
FutureAsyncSignature, | ||
SpecialPointerAuthDiscriminators::AsyncFutureFunction>(closureEntry); | ||
ThinNullaryAsyncSignature, | ||
SpecialPointerAuthDiscriminators::AsyncThinNullaryFunction>(closureEntry); | ||
|
||
return swift_task_create_common( | ||
rawTaskCreateFlags, options, futureResultType, | ||
reinterpret_cast<TaskContinuationFunction *>(taskEntry), closureContext, | ||
initialContextSize); | ||
|
||
return swift_task_create_common( | ||
taskCreateFlags, options, futureResultType, | ||
reinterpret_cast<TaskContinuationFunction *>(taskEntry), closureContext, | ||
initialContextSize); | ||
} else { | ||
FutureAsyncSignature::FunctionType *taskEntry; | ||
size_t initialContextSize; | ||
|
||
std::tie(taskEntry, initialContextSize) = | ||
getAsyncClosureEntryPointAndContextSize< | ||
FutureAsyncSignature, | ||
SpecialPointerAuthDiscriminators::AsyncFutureFunction>(closureEntry); | ||
|
||
return swift_task_create_common( | ||
rawTaskCreateFlags, options, futureResultType, | ||
reinterpret_cast<TaskContinuationFunction *>(taskEntry), closureContext, | ||
initialContextSize); | ||
} | ||
} | ||
|
||
#ifdef __ARM_ARCH_7K__ | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This entire change to
() -> T
was a hotfix to temporarily unbreak but it is very wrong, we must get back to -> Void✅ This fixes the (b) leaks the by undoing what introduced them in the first place.