Skip to content

SIL: remove the private_external SILLinkage #39632

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 2 commits into from
Oct 11, 2021

Conversation

eeckstein
Copy link
Contributor

The private_external linkage was a relict from the sil-serialize-all days. This linkage doesn't make any sense because a private function cannot be referenced from another module (or file, in case of non-wmo compilation).

This PR also contains another change: diagnose body-less private functions with an _silgen_name attribute

Functions with an @_silgen_name attribute can be declared without a body - for referencing externally defined C functions. But this does not make sense for private functions.
So far, this error was not diagnosed - and it didn't cause any problem, because such functions were generated with a private_external linkage.
With removing the linkage, it does not work anymore and would result in SILVerifier errors.

@eeckstein eeckstein requested a review from slavapestov October 7, 2021 17:22
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

I love these cleanups!

@swift-ci
Copy link
Contributor

swift-ci commented Oct 7, 2021

Build failed
Swift Test Linux Platform
Git Sha - c6b608b2c6ca50e5d68bece9c5c37a10ff63ae79

@swift-ci
Copy link
Contributor

swift-ci commented Oct 7, 2021

Performance (x86_64): -O

Regression OLD NEW DELTA RATIO
NSStringConversion.Rebridge.Medium 151 168 +11.3% 0.90x (?)
NSStringConversion.Rebridge.Long 151 168 +11.3% 0.90x (?)
NSStringConversion.Rebridge.UTF8 376 418 +11.2% 0.90x (?)
NSStringConversion.Rebridge.LongUTF8 45 50 +11.1% 0.90x (?)
DataAppendArray 3300 3600 +9.1% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
NSError 145 134 -7.6% 1.08x (?)

Code size: -O

Performance (x86_64): -Osize

Code size: -Osize

Performance (x86_64): -Onone

Improvement OLD NEW DELTA RATIO
ArrayAppendGenericStructs 2070 1160 -44.0% 1.78x (?)

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 Pro
  Model Identifier: MacPro6,1
  Processor Name: 8-Core Intel Xeon E5
  Processor Speed: 3 GHz
  Number of Processors: 1
  Total Number of Cores: 8
  L2 Cache (per Core): 256 KB
  L3 Cache: 25 MB
  Memory: 64 GB

@swift-ci
Copy link
Contributor

swift-ci commented Oct 7, 2021

Build failed
Swift Test OS X Platform
Git Sha - c6b608b2c6ca50e5d68bece9c5c37a10ff63ae79

@eeckstein eeckstein force-pushed the remove-private-external-linkage branch from c6b608b to 8e0fad2 Compare October 8, 2021 07:24
@eeckstein
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Build failed
Swift Test Linux Platform
Git Sha - 8e0fad2629a8452a515edede2fd8a8fd77daa27e

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Build failed
Swift Test OS X Platform
Git Sha - 8e0fad2629a8452a515edede2fd8a8fd77daa27e

@eeckstein eeckstein force-pushed the remove-private-external-linkage branch from 8e0fad2 to e526abc Compare October 8, 2021 13:00
@eeckstein
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Build failed
Swift Test Linux Platform
Git Sha - e526abc792714880c63a6ba35bc31bdc1df2cedc

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Build failed
Swift Test OS X Platform
Git Sha - e526abc792714880c63a6ba35bc31bdc1df2cedc

@eeckstein eeckstein force-pushed the remove-private-external-linkage branch from e526abc to 70e96d4 Compare October 8, 2021 15:10
@eeckstein
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Build failed
Swift Test OS X Platform
Git Sha - 70e96d48b9f4956e810b3f40c3d21f11266f9daf

…ey don't have a valid linkage for "fragile ref".

E.g. a serialized witness table must not reference a private function. Just like a serialized function must not reference a private function.
This was a relict from the -sil-serialize-all days. This linkage doesn't make any sense because a private function cannot be referenced from another module (or file, in case of non-wmo compilation).
@eeckstein eeckstein force-pushed the remove-private-external-linkage branch from 70e96d4 to 30a74f6 Compare October 10, 2021 17:53
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit 4bed0e4 into swiftlang:main Oct 11, 2021
@eeckstein eeckstein deleted the remove-private-external-linkage branch October 11, 2021 07:07
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.

3 participants