[6.2][Distributed] fix distributed thunk method descriptor mangling in IRGen #81831
+265
−0
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.
Description: While we mangle distributed thunks correctly in Mangler we did not update IRGenMangler to also handle them. This remained undiscovered until developers needed to use library evolution where these method descriptors are used, and the distributed_thunk descriptors would be mangled the same as the not-thunks, leading to duplicate symbols. This would result in .N suffixes and break the manled names in resilient witness tables.
Finally, this would manifest in runtime not being able to obtain a witness from the resilient witness table when library evolution is enabled, and causing null witnesses and crashes at runtime when attempting to make remote calls in such project.
This corrects the missing mangling part, which then corrects everything else implicitly -- since we no longer have duplicated symbols, and the thunks are uniqued correctly, everything falls into place and works well.
Scope/Impact: Distributed actors adopters which use library evolution. Specifically, attempts to make a remote call on a https://github.com/resolvable protocol would crash without this fix, making https://github.com/resolvable and the "server / client split" approach of distributed actors not usable at all with library evolution.
Risk: Low, the fix is very centralized to distributed thunks and sil witness tables of distributed protocol witnessing actors.
Testing: Added test verifying the emitted witness tables. Confirmed in real project hitting this problem that the solution is correct and resolves the crashes.
Reviewed by: @xedin
Original PR: #81805
Radar: rdar://144568615