-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
[draft] register machine #100276
Closed
Closed
[draft] register machine #100276
Changes from 2 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
5e0ef80
add oparg2, oparg3 to the bytecode
iritkatriel 8f30b8a
Add consts with borrowed refs to the end of the localsplus array.
iritkatriel e7bc5f2
add register versions of the UNARY_OPS
iritkatriel e9c6474
fix error check
iritkatriel 12a37f5
remove i_stackdepth and STACK_REG, we won't use it
iritkatriel 68b9b4b
add oparg2/oparg3 option to the _Py_CODEUNIT union
iritkatriel 2686f86
add LOAD/STORE_FAST_R to help debugging. Fix bug in write_instr
iritkatriel bb7467b
sanitizer warnings
iritkatriel 50dfc14
int--> Py_ssize_t
iritkatriel 9dbb32e
fix error check
iritkatriel 32b35d0
put the tmp registers after the stack
iritkatriel 1e8531b
Merge remote-tracking branch 'upstream/main' into regmachine
iritkatriel e6461f1
fix bug in deopt_code
iritkatriel 2439dff
temps are locals named (still need to revert the co_ntmps business, …
iritkatriel 92e04e9
remove ntmps from code object and frame
iritkatriel 9f57f0e
fix test_peepholer
iritkatriel ed7b38f
fix dis._get_co_positions
iritkatriel 3ee9a3c
fix test_datetime
iritkatriel 1461ebc
Add LOAD_CONST_R . Fix two bugs: _PyFrame_PushUnchecked does not copy…
iritkatriel 1e83cb2
Enhance generator for register instructions (#48)
gvanrossum f100337
always use register versions of unary ops
iritkatriel ecc8a73
teach dis about LOAD_CONST_R
iritkatriel b86a450
wipe out oparg1,2,3 in INSTR_SET_OP0/1
iritkatriel d90af0c
handle EXTENDED_ARGS
iritkatriel 44a9f4b
enable LOAD_CONST_R always
iritkatriel a1ebba7
skip hacky test
iritkatriel 313b6e7
regen-all
iritkatriel ac0bb65
rewrite other unary-ops as register insts
iritkatriel 603b265
add BINARY_OP_R (not specialized yet)
iritkatriel 53facae
Revert "add BINARY_OP_R (not specialized yet)"
iritkatriel 8e37f3d
OPSIZE parameterized by the opcode
iritkatriel 7bb8104
move next_instr updates to where so that we always know which opcode'…
iritkatriel 107c557
set VERBOSE to 0
iritkatriel cf7fc4b
regen-cases
iritkatriel a7efdd7
Revert "regen-cases"
iritkatriel dea531c
Revert "set VERBOSE to 0"
iritkatriel c437a64
Revert "move next_instr updates to where so that we always know which…
iritkatriel 453bbbe
Disable specialization
iritkatriel ff80053
freeze only importlib
iritkatriel 7fbeb6a
move next_instr updates to where we always know which opcode's OPSIZE…
iritkatriel 1378f80
fix extended_arg
iritkatriel f785019
indent of #ifdefs
iritkatriel 1ee1006
remove the ENABLE_SPECIALIZATION from generate_cases.py
iritkatriel fdc73cb
Merged main into regmachine branch (#50)
gvanrossum 96aaf43
Revert " Merged main into regmachine branch (#50)"
iritkatriel 2753cb4
Merge remote-tracking branch 'upstream/main' into regmachine
iritkatriel 8f945db
skip tests that require frozen module (which we disabled in this branch)
iritkatriel d294fbe
test_specialized_static_code_gets_unspecialized_at_Py_FINALIZE requir…
iritkatriel e464a49
make test_asyncio fail instead of hang
iritkatriel 0f8c4d3
add back BINARY_OP_R as a 3-word instruction
iritkatriel 4f51677
update dis.py to use the parameterized _oparg
iritkatriel d8be0f9
fix _get_co_positions
iritkatriel b88cc45
fix a couple of issues in dis. Fix test_dis (all but two tests passing)
iritkatriel 02dd61b
add COMPARE_OP_R
iritkatriel 1a61812
add JUMP_IF_FALSE_R/JUMP_IF_TRUE_R
iritkatriel 2a8e12a
make test_patma work (might revert this if we get rid of the tmp vars)
iritkatriel 8d8772f
used 'unused' to prevent lookup generation for first arg of JUMP_IF_F…
iritkatriel 121ccfb
added COPY_R and a simple peephole optimization
iritkatriel f33d835
Revert "make test_patma work (might revert this if we get rid of the …
iritkatriel bade862
filter 569XZilmstmps out of locals()
iritkatriel 7776088
remove 569XZilmstmps from f_locals in test
iritkatriel 6a72d8a
filter from f_locals in inspect
iritkatriel 172d12d
filter from f_locals in test_frame
iritkatriel f864be7
Revert "filter 569XZilmstmps out of locals()"
iritkatriel 9e0d60e
filter locals in test_patma
iritkatriel d2aceb1
update a few more tests
iritkatriel df7ffdf
update test_dis. dis code_info now filters out $ vars
iritkatriel 905eac2
merge LOAD_*_R with STORE_FAST_R across COPY_Rs
iritkatriel 7399686
improve register peepholer: squash load+store across COPY_R and NOPs.…
iritkatriel 0f31185
add RETURN_VALUE_R
iritkatriel dc9b211
update some tests
iritkatriel a2d7122
added CHECK_FAST_R and fixed bug with unbounded locals access
iritkatriel d5830af
Merge remote-tracking branch 'upstream/main' into regmachine
iritkatriel 9ff6911
STORE_FAST_R instead of more STORE_FASTs. Fixed peepholer to not opti…
iritkatriel 599de74
typo
iritkatriel b9af7ac
Revert "typo"
iritkatriel a623a06
Revert "STORE_FAST_R instead of more STORE_FASTs. Fixed peepholer to …
iritkatriel 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 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 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.
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 wonder if the exception for
$
should be implemented inlocals()
rather than in its callers?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 don’t know if we want to keep the $ vars. we did this because I couldn’t get it to work with a dedicated range for temps, but now we fixed it for consts so it should work.
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 might want these for debugging purposes. Perhaps
locals
/frame.f_locals
should omit them, and we addframe._f_registers
(or something) which is a list of temporaries?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.
Maybe relevant: the unnamed iterator used in comprehensions is currently visible:
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.
The
$
registers will be visible in a lot more cases than the.0
iterator, and they are a detail of the implementation that will mostly just confuse users. If we're going to pull the consistency card I'd vote for not revealing that iterator either.I could live with the registers showing in
f_locals
but not inlocals()
-- frame attributes are more of an implementation detail anyway.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 made the change to filter locals(), but that's no good it breaks
locals()["x"] = 43
.(see test.test_scope.ScopeTests.testClassNamespaceOverridesClosure)
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.
Why are we adding all these "$" variables to the locals?
We don't expose the stack, why expose the temporaries?
It looks like a considerable amount of the changes to both code and tests are supporting/working around these additional, artificial local variables.