Skip to content

[6.0][Modules] Avoid false swift module sharing #75134

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

Conversation

cachemeifyoucan
Copy link
Contributor

@cachemeifyoucan cachemeifyoucan commented Jul 10, 2024

Explanation: When the swiftmodule is built with different clang importer arguments, they can have the same module hash, causing them to be wrongly re-used even they contains different interfaces.
Scope: Affect projects with the same swift module (interface) is imported by multiple modules with different clang importer args.
Issue: rdar://131408266
Original PR: #75133
Reviewer: @artemcm
Risk: Low. It can cause slow down in projects with such false sharing but the most common cases where -Xcc -D is used, it should not be a problem.
Test: UnitTest

@cachemeifyoucan cachemeifyoucan requested a review from a team as a code owner July 10, 2024 18:26
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@fredriss fredriss enabled auto-merge July 10, 2024 19:40
@cachemeifyoucan cachemeifyoucan changed the title [6.0][Modules] Avoid false swift module sharing [WIP][6.0][Modules] Avoid false swift module sharing Jul 10, 2024
@fredriss fredriss disabled auto-merge July 10, 2024 19:47
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-131408266-swift-6 branch from ce00aef to 88de8a9 Compare July 10, 2024 20:12
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

When the swiftmodule is built with different clang importer arguments,
they can have the same module hash, causing them to be wrongly re-used even
they contains different interfaces. Add ReducedExtraArgs to the module hash to
disambiguate them.

However, some Xcc arguments, most commonly `-D` options do not affect the
swiftmodule being generated. Do not pass `-Xcc -DARGS` to swift
interface compilation to reduce the amount of module variants in the
build.

rdar://131408266
(cherry picked from commit a32dd95)
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-131408266-swift-6 branch from 88de8a9 to ecc5b6e Compare July 11, 2024 16:37
@cachemeifyoucan cachemeifyoucan changed the title [WIP][6.0][Modules] Avoid false swift module sharing [6.0][Modules] Avoid false swift module sharing Jul 11, 2024
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 15, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 15, 2024
Fix a memory leak from swiftlang#75134.

(cherry picked from commit d8c3ebd)
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 15, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 15, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 15, 2024
Fix a memory leak from swiftlang#75134.

(cherry picked from commit 180e8d4)
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 16, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 16, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 16, 2024
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 16, 2024
Fix a memory leak from swiftlang#75134.

(cherry picked from commit ed93685)
cachemeifyoucan added a commit to cachemeifyoucan/swift that referenced this pull request Jul 16, 2024
Fix a memory leak from swiftlang#75134.

(cherry picked from commit ed93685)
susmonteiro pushed a commit that referenced this pull request Jul 19, 2024
@cachemeifyoucan
Copy link
Contributor Author

Not merging this into 6.0.

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