Skip to content

[NFC] Explicitly control alignment of Identifiers #27414

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
Oct 2, 2019

Conversation

beccadax
Copy link
Contributor

Identifier contains a pointer to character data, and we need to ensure that this pointer has enough spare bits in it for DeclBaseName and DeclName. This currently happens to be true because the StringMap used to intern Identifier pointers happens to place a 32-bit size field in the MapTableEntry object, but it would be better to explicitly force the alignment we want and assert that it’s correct.

(I need this commit because I will soon need to add spare bits to Identifier so that there are spare bits in DeclName.)

@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax
Copy link
Contributor Author

There's no real way to unit test this, but I've checked that bumping the spare bits to 3 breaks the things it ought to break.

@jrose-apple
Copy link
Contributor

The custom addresses for special DeclBaseNames should probably be pointers to Identifier::Aligner now too.

Identifier contains a pointer to character data, and we need to ensure that this pointer has enough spare bits in it for DeclBaseName and DeclName. This currently happens to be true because the StringMap used to intern Identifier pointers happens to place a 32-bit size field in the MapTableEntry object, but it would be better to explicitly force the alignment we want and assert that it’s correct.
@beccadax
Copy link
Contributor Author

beccadax commented Oct 1, 2019

@swift-ci please smoke test

@beccadax
Copy link
Contributor Author

beccadax commented Oct 1, 2019

@swift-ci please smoke test macos platform

@beccadax
Copy link
Contributor Author

beccadax commented Oct 2, 2019

Might need a rebase, but let’s try one more time.

@swift-ci please smoke test macos platform

@beccadax beccadax merged commit c712938 into swiftlang:master Oct 2, 2019
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