-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
GH-99554: Pack location tables more effectively #99556
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
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2b90c42
Refactor location emission to not use instructions
brandtbucher 6d96e8c
Compress location entries more effectively
brandtbucher f191f95
blurb add
brandtbucher 24ce84f
fixup
brandtbucher be7eb0a
Catch up with main
brandtbucher 37909a4
Catch up with main
brandtbucher d616c2d
Remove special case
brandtbucher 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
fixup
- Loading branch information
commit 24ce84fc8171c118c189582a3fcbca817ac6a666
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 |
---|---|---|
|
@@ -143,10 +143,13 @@ location_is_after(location loc1, location loc2) { | |
static inline bool | ||
same_location(location a, location b) | ||
{ | ||
return (a.lineno < 0 && b.lineno < 0) ||(a.lineno == b.lineno && | ||
a.end_lineno == b.end_lineno && | ||
a.col_offset == b.col_offset && | ||
a.end_col_offset == b.end_col_offset); | ||
if (a.lineno < 0 && b.lineno < 0) { | ||
return true; | ||
} | ||
return a.lineno == b.lineno && | ||
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. According to git diff you have a trailing space here. Surprised CI didn't catch it? 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. Wow, nice catch! I'll fix it. |
||
a.end_lineno == b.end_lineno && | ||
a.col_offset == b.col_offset && | ||
a.end_col_offset == b.end_col_offset; | ||
} | ||
|
||
#define LOC(x) SRC_LOCATION_FROM_AST(x) | ||
|
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.
I’d check also that they are the same value in case we will want to distinguish between ‘no location’ and ‘unknown location’ or something like that.
(I’m assuming you don’t rely on the full equality check because we’re inconsistent about what the other 3 values are).
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.
Should an "unknown location" ever exist? That sounds like a compiler bug.
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'm thinking of cases where we just want to take the location of the previous instruction. Currently we just say "NO_LOCATION", but would we ever want to distinguish between this case and the case where there truly is no location (because the instructions are fake)? I don't know, but we might not want to rule it out.
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.
Actually, it appears that we can remove this special case entirely. Just using the full equality check results in the exact same PYC sizes for the entire stdlib.