-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-118423: Add INSTRUCTION_SIZE
macro to code generator
#125467
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 16 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ec8c701
Add INSTRUCTION_SIZE macro
tomasr8 09c2f59
Use INSTRUCTION_SIZE in bytecodes.c
tomasr8 287eb92
Add tests
tomasr8 c76fce4
Update docs
tomasr8 e3f3b07
Add news entry
tomasr8 ed5b375
Fix mypy error
tomasr8 870341d
Treat INSTRUCTION_SIZE as an identifier
tomasr8 421ebda
Regenerate executor cases
tomasr8 5154f7f
Re-add newline
tomasr8 e7e83dc
Use replaceText()
tomasr8 101a5fd
Emit size directly
tomasr8 1338628
Merge branch 'main' into instr-size
tomasr8 ee461d5
Pass instruction in tier2
tomasr8 7135103
Fix INSTRUCTION_SIZE in tier2
tomasr8 715ce31
Make mypy happy
tomasr8 8235321
Fix tests
tomasr8 148070e
Remove unused imports
tomasr8 3e6b592
Ensure all instructions have the same size
tomasr8 6e78ec0
Add tests
tomasr8 75e6f6c
Regen files
tomasr8 a3c0d10
Make mypy happy
tomasr8 7235d2d
Fix tests
tomasr8 5cfb423
Raise instead of assert when size is None
tomasr8 2190784
Add an `instruction_size` field to the Uop class
tomasr8 33343dd
Remove extra white space
tomasr8 f9ecb16
Raise analysis_error instead of ValueError
tomasr8 abfaaff
Fix wording
tomasr8 3f3ad10
Make mypy happy
tomasr8 a8f72ef
Simplify test
tomasr8 8138a06
Replace assert with raise
tomasr8 772f803
Simplify code
tomasr8 a718cfb
Remove some code repetition
tomasr8 a10d4ee
Simplify INSTRUCTION_SIZE check
tomasr8 3ae7a5d
Simplify code
tomasr8 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
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Core_and_Builtins/2024-10-14-17-13-12.gh-issue-118423.SkBoda.rst
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Add a new ``INSTRUCTION_SIZE`` macro to the cases generator which returns | ||
the current instruction size. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Add a test for another instruction that is a different length, but uses
OP
: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.
Added!
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.
That test should fail, as the
INSTRUCTION_SIZE
is inconsistent.The tier 2
INSTRUCTION_SIZE
cannot be both 1 and 2.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.
Right, sorry I mistakenly thought it should only fail for tier 2 hence I was only checking the instruction in the tier 2 generator. I extended the check to tier 1 as well and the test now fails as expected.