Skip to content

[SendNonSendable] Diagnose consumption sites not requirement sites #67318

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 4 commits into from
Jul 19, 2023

Conversation

JTurcotti
Copy link
Contributor

In prior versions of the SendNonSendable pass, diagnostics were reported when it was discovered that a value in a consumed region was accessed. This is confusing as the site that performed the consumption is the site that actually invoked a cross-isolation call or other concurrency primitive. This PR changes the behavior to instead search for the site at which an original consumption took place, and diagnose that site along with notes of some potential accesses.

@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

@@ -196,7 +211,7 @@ class Partition {
return;
canonical = true;

std::map<signed, unsigned> relabel;
std::map<unsigned, unsigned> relabel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no now I can't tell what this means at all. can your next PR at least include those typealiases for unsigned and signed to give them a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, performing this refactor!

Comment on lines +669 to +679
enum class LocalConsumedReasonKind {
LocalConsumeInst,
LocalNonConsumeInst,
NonLocal
};

// Why was a value consumed, without looking across blocks?
// kind == LocalConsumeInst: a consume instruction in this block
// kind == LocalNonConsumeInst: an instruction besides a consume instruction
// in this block
// kind == NonLocal: an instruction outside this block
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to move these explainer comments directly onto the LocalConsumedReasonKind cases instead of on top of the struct containing it so it shows up in IDE documentation windows for what LocalConsumedReasonKind::X means.

@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

1 similar comment
@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

…ions, and ensure that all SILValues are converted once to TrackableSILValues in the SendNonSendable analysis pass
@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

@JTurcotti
Copy link
Contributor Author

@swift-ci please smoke test

@JTurcotti JTurcotti merged commit 992fc6c into swiftlang:main Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants