-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLVM][DWARF] Refactor code for generating DWARF V5 .debug_names acce… #82264
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -613,6 +613,24 @@ enum AcceleratorTable { | |
DW_hash_function_djb = 0u | ||
}; | ||
|
||
// Uniquify the string hashes and calculate the bucket count for the | ||
// DWARF v5 Accelerator Table. | ||
inline uint32_t | ||
ComputeDebugNamesUniqueHashes(SmallVector<uint32_t, 0> &hashes) { | ||
uint32_t BucketCount = 0; | ||
|
||
llvm::sort(hashes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICT we are already inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, thanks. |
||
uint32_t uniqueHashCount = llvm::unique(hashes) - hashes.begin(); | ||
if (uniqueHashCount > 1024) | ||
BucketCount = uniqueHashCount / 4; | ||
else if (uniqueHashCount > 16) | ||
BucketCount = uniqueHashCount / 2; | ||
else | ||
BucketCount = std::max<uint32_t>(uniqueHashCount, 1); | ||
|
||
return BucketCount; | ||
} | ||
|
||
// Constants for the GNU pubnames/pubtypes extensions supporting gdb index. | ||
enum GDBIndexEntryKind { | ||
GIEK_NONE, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We avoid putting the SmallSize of SmallVectors in the interface, using SmallVectorImpl instead.
However, this function should just use a
MutableArrayRef<uint32_t>
instead, to communicate the fact that we are not inserting nor removing from the vector.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New functions should use the
functionName
convention. (Older code may useFunctionName
, which should be ignored.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see
SmallVector<uint32_t, 0>
? forgot to push maybe?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, you're right! I've having a bit of trouble with my git push right now :-( -- git is rejecting the push: "Updates were rejected because the remote contains work that you do not have locally..." I tried a 'git merge' but that didn't fix the issue. I hope I don't have to abandon this branch & PR and create a new one. If you know how to fix this, please let me know! Otherwise, I'll keep you posted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you show me the output of
git status
and the first few lines ofgit log --oneline --graph
I might be able to tell you what's happening.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ git status
On branch llvm-unique
Untracked files:
...
nothing added to commit but untracked files present (use "git add" to track)
$ git log --oneline --graph* 260397dcb8e4 (HEAD -> llvm-unique) [LLVM][DWARF] Refactor code for generating DWARF V4 .debug_names accelerator table
{s|u}rem C, x
{s|u}rem C, x
; NFC...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've given up and created a new pull request - it's simpler than fighting with git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to merge with the other branch where you did the ADT work? My guess is that the two branches had different bases, and if you merged without rebasing, your commits ended up buried in other commits from
main
.