Skip to content

[AST] NFC: ExtInfo should reserve only needed TypeBase bits #13053

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

Conversation

davezarzycki
Copy link
Contributor

Both AnyFunctionType and SILFunctionType reserve 16 bits in the TypeBase
for their respective "ExtInfo" bits, but then these types use less than
half of the bits they reserve. This patch changes AnyFunctionType and
SILFunctionType to only reserve what they need and then verify at
construction time that ExtInfo bits are not being truncated.

This change is motivated by the need to have more TypeBase bits
available for other uses.

Finally, this change fixes a copy-and-paste error introduced when
AnyFunctionType and SILFunctionType stopped sharing the same ExtInfo
data structure.

Both AnyFunctionType and SILFunctionType reserve 16 bits in the TypeBase
for their respective "ExtInfo" bits, but then these types use less than
half of the bits they reserve. This patch changes AnyFunctionType and
SILFunctionType to only reserve what they need and then verify at
construction time that ExtInfo bits are not being truncated.

This change is motivated by the need to have more TypeBase bits
available for other uses.

Finally, this change fixes a copy-and-paste error introduced when
AnyFunctionType and SILFunctionType stopped sharing the same ExtInfo
data structure.
@davezarzycki
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 882ae3a

@davezarzycki
Copy link
Contributor Author

Weird. A spurious build lock failure on Linux. Let's try again:

@swift-ci please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 882ae3a

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test linux

@davezarzycki
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 882ae3a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 882ae3a

@shahmishal
Copy link
Member

@swift-ci please test Linux

@davezarzycki davezarzycki merged commit a8efe26 into swiftlang:master Nov 25, 2017
@davezarzycki davezarzycki deleted the nfc_fewer_reserved_TypeBase_bits branch November 25, 2017 19:15
@rjmccall
Copy link
Contributor

Could we introduce constants at the top of this file for the number of bits in these ExtInfo structures? I can't think of an obvious way to static_assert that the masks fit within that number of bits, but we could at least have comments explaining the dependency.

@davezarzycki
Copy link
Contributor Author

Sure. Please consider reviewing #13079.

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.

4 participants