Skip to content

Fix ExistentialSpecializer: inherited conformance #28430

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 1 commit into from
Nov 22, 2019
Merged

Fix ExistentialSpecializer: inherited conformance #28430

merged 1 commit into from
Nov 22, 2019

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Nov 22, 2019

The ExistentialSpecializer incorrectly assumed that an existential's conformances match an opened archetype. They don't. Opened archetypes strip inherited conformances per the ABI for generic argument passing. Existential values retain those inherited conformances (for some inexplicable reason).

  • Rename ASTContext::getExistentialSignature() to
    getOpenedArchetypeSiganture() because it was doing exactly the wrong
    thing for existentials.

  • Fix ConcreteExistentialInfo to produce the correct SubstitutionMap.

  • Fix ExistentialSpecializer to generate the correct conformances for
    init_existential by adding a collectExistentialConformances() helper.

Fixes rdar://problem/57025861 "Assertion failed: (conformances.size() == numConformanceRequirements)" in ExistentialSpecializer on inlined code

@atrick atrick requested a review from slavapestov November 22, 2019 04:50
@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ArrayAppendGenericStructs 630 1250 +98.4% 0.50x (?)
 
Improvement OLD NEW DELTA RATIO
DropLastArrayLazy 5 4 -20.0% 1.25x (?)
PolymorphicCalls 15 14 -6.7% 1.07x (?)

Code size: -O

Performance: -Osize

Improvement OLD NEW DELTA RATIO
PrefixWhileCountableRangeLazy 14 13 -7.1% 1.08x (?)

Code size: -Osize

Performance: -Onone

Code size: -swiftlibs

How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac mini
  Model Identifier: Macmini8,1
  Processor Name: Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9a6a83bd8854d5888053a4c60993e0d665a4d70c

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9a6a83bd8854d5888053a4c60993e0d665a4d70c

@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9a6a83bd8854d5888053a4c60993e0d665a4d70c

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9a6a83bd8854d5888053a4c60993e0d665a4d70c

@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci smoke test

The ExistentialSpecializer incorrectly assumed that an existential's conformances match an opened archetype. They don't. Opened archetypes strip inherited conformances per the ABI for generic argument passing. Existential values retain those inherited conformances (for some inexplicable reason).

- Rename ASTContext::getExistentialSignature() to
  getOpenedArchetypeSiganture() because it was doing exactly the wrong
  thing for existentials.

- Fix ConcreteExistentialInfo to produce the correct SubstitutionMap.

- Fix ExistentialSpecializer to generate the correct conformances for
  init_existential by adding a collectExistentialConformances() helper.

Fixes <rdar://problem/57025861> "Assertion failed: (conformances.size() == numConformanceRequirements)" in ExistentialSpecializer on inlined code
@atrick
Copy link
Contributor Author

atrick commented Nov 22, 2019

@swift-ci smoke test

@atrick atrick merged commit 8052a61 into swiftlang:master Nov 22, 2019
@atrick atrick deleted the fix-existential-conformance branch December 23, 2019 03:10
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