Skip to content

[IRGen/Distributed] Adjust protocol requirement and witness table to handle distributed thunks #60184

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 3 commits into from
Jul 22, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jul 21, 2022

  • Determine whether protocol requirement is async using SILDeclRef

    This is necessary because SILDeclRef of the distributed thunk witness is anchored
    on the requirement declaration which might not be async, but the witness itself is
    always async throws.

  • Mark protocol requirement descriptor for distributed thunk as async

    Fixes a bug where descriptor for protocol requirement associated with
    distributed thunk wasn't marked as async that results in ptrauth failures
    because discriminator would be misaligned between requirement and witness.

Resolves: rdar://96520492
Resolves: rdar://97228310

@xedin xedin requested review from rjmccall and ktoso July 21, 2022 21:32
@xedin
Copy link
Contributor Author

xedin commented Jul 21, 2022

@swift-ci please test

xedin added 3 commits July 21, 2022 14:33
…lRef`

While building witness table record, let's use `hasAsync()` check on
`SILDeclRef` of the requirement instead of reaching for the underlying
declaration because the reference should be the source of truth about
`async` and other attributes.

In case of distributed thunk witness, which is always `async throws`,
the underlying declaration could be sync because it's the protocol
requirement declaration.
… async

Fixes a bug where descriptor for protocol requirement associated with
distributed thunk wasn't marked as `async` that results in ptrauth failures
because discriminator would be misaligned between requirement and witness.

Resolves: rdar://96520492
@xedin
Copy link
Contributor Author

xedin commented Jul 21, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jul 21, 2022

@swift-ci please test apple silicon

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Jul 21, 2022

@swift-ci please test apple silicon

@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Jul 21, 2022
if (entry.getFunction().isDistributedThunk()) {
flags = flags.withIsAsync(true);
declRef = declRef.asDistributed();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

okey so this piece we did yesterday did matter... 👍

@@ -1388,8 +1389,9 @@ class AccessorConformanceInfo : public ConformanceInfo {
witness = llvm::ConstantExpr::getBitCast(witness, IGM.Int8PtrTy);

PointerAuthSchema schema =
afd->hasAsync() ? IGM.getOptions().PointerAuth.AsyncProtocolWitnesses
: IGM.getOptions().PointerAuth.ProtocolWitnesses;
isAsyncRequirement
Copy link
Contributor

Choose a reason for hiding this comment

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

aha that's what we were missing I see 👀

@ktoso
Copy link
Contributor

ktoso commented Jul 21, 2022

Apple silicon failing to start, times out;

@ktoso
Copy link
Contributor

ktoso commented Jul 21, 2022

@swift-ci please test apple silicon

@ktoso
Copy link
Contributor

ktoso commented Jul 21, 2022

Also resolves rdar://97228310

@xedin
Copy link
Contributor Author

xedin commented Jul 22, 2022

swiftlang/swift-package-manager#5684
@swift-ci please test apple silicon

@ktoso
Copy link
Contributor

ktoso commented Jul 22, 2022

The revert got merged so the above AS run failed:


/Users/ec2-user/jenkins/workspace/swift-pr-arm64-macos/branch-main/swiftpm failed (ret=128): ['git', 'fetch', 'origin', 'pull/5684/merge:ci_pr_5684', '--tags']
fatal: couldn't find remote ref pull/5684/merge

update-checkout failed, fix errors and try again

@ktoso
Copy link
Contributor

ktoso commented Jul 22, 2022

@swift-ci please test apple silicon

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Jul 22, 2022

@swift-ci please test apple silicon

@xedin xedin merged commit a613bce into swiftlang:main Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants