Skip to content

[SIL] NFC: Make SILVTable follow C++ and LLVM best practices #32296

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
Jun 12, 2020

Conversation

davezarzycki
Copy link
Contributor

  1. Convert the Entry type to a class with getters/setters
  2. Use llvm::TrailingObjects
  3. Use llvm::PointerIntPair

This builds on #32238, so please ignore that commit (or comment on that PR).

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test

@@ -178,7 +178,7 @@ class SILModule {
llvm::DenseMap<const ClassDecl *, SILVTable *> VTableMap;

/// The list of SILVTables in the module.
VTableListType vtables;
std::vector<SILVTable*> vtables;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're following LLVM best practices, maybe this should be a SmallVector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That change was from the prior pull request but otherwise yes that could be a SmallVector

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you like me to change it? If so, then what should the magic SmallVector constant be?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, it's probably fine as a std::vector come to think of it. It's hard to think of a reasonable small threshold of number of vtables that most modules would hold.

1) Convert the `Entry` type to a class with getters/setters
2) Use llvm::TrailingObjects
3) Use llvm::PointerIntPair
@davezarzycki
Copy link
Contributor Author

I've rebased to avoid the distraction of the required prior pull request: #32238

@swift-ci please smoke test

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test macos

@davezarzycki davezarzycki merged commit 23c7fc5 into swiftlang:master Jun 12, 2020
@davezarzycki davezarzycki deleted the pr32296 branch June 12, 2020 11:46
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