Skip to content
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

gh-91432: Specialize FOR_ITER #91713

Merged
merged 44 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3a7f8df
initial attempt
sweeneyde Apr 17, 2022
3b5ce1e
bump magic
sweeneyde Apr 17, 2022
b21b5f4
Merge remote-tracking branch 'upstream/main' into special_for_iter2
sweeneyde Apr 18, 2022
37269cf
NOTRACE_DISPATCH_SAME_OPARG
sweeneyde Apr 18, 2022
ea0a7ee
Update mark_stacks
sweeneyde Apr 18, 2022
0751228
comment out assertions
sweeneyde Apr 19, 2022
dc80fda
Merge branch 'main' into special_for_iter2
sweeneyde Apr 19, 2022
e429410
Make FOR_ITER_RANGE mutate the local
sweeneyde Apr 19, 2022
1cb2de7
Merge remote-tracking branch 'upstream/main' into special_for_iter2
sweeneyde Apr 19, 2022
73fa01c
Fix overflow
sweeneyde Apr 19, 2022
4213582
fix test
sweeneyde Apr 19, 2022
bf58358
fix dis
sweeneyde Apr 19, 2022
bd7575e
Add more tests, add more casts
sweeneyde Apr 19, 2022
db8754b
Merge branch 'main' into special_for_iter2
sweeneyde Apr 20, 2022
2050c4e
merge with main
sweeneyde Apr 24, 2022
824e966
Fix stats, take out some PREDICT
sweeneyde Apr 24, 2022
6b16772
📜🤖 Added by blurb_it.
blurb-it[bot] Apr 24, 2022
c2a75a5
merge with main
sweeneyde Apr 28, 2022
6696384
remove PREDEICTED(STORE_FAST)
sweeneyde Apr 28, 2022
d297091
assert no tracing
sweeneyde Apr 28, 2022
22635a6
Merge branch 'special_for_iter2' of https://github.com/sweeneyde/cpyt…
sweeneyde Apr 28, 2022
f360d65
remove unnecessary cast
sweeneyde Apr 28, 2022
81e0500
merge with main
sweeneyde May 3, 2022
c2eab68
regen
sweeneyde May 3, 2022
25689c3
merge and bump magic
sweeneyde May 4, 2022
b5df047
merge with main
sweeneyde May 8, 2022
2b1c170
Merge remote-tracking branch 'upstream/main' into special_for_iter2
sweeneyde May 10, 2022
91d280c
Fix test_dis
sweeneyde May 10, 2022
eba5e60
merge with main
sweeneyde May 12, 2022
5b153d7
Merge branch 'main' into special_for_iter2
sweeneyde May 12, 2022
76f9a74
merge with main
sweeneyde May 20, 2022
0565a68
Merge branch 'special_for_iter2' of https://github.com/sweeneyde/cpyt…
sweeneyde May 20, 2022
9ba5b79
merge with main
sweeneyde Jun 9, 2022
6cdf0e4
Add comment about re-using the old PyLongObject
sweeneyde Jun 9, 2022
03dde6a
Merge branch 'main' of https://github.com/python/cpython into special…
sweeneyde Jun 10, 2022
f1e2d39
update test_dis.py
sweeneyde Jun 10, 2022
463c3b9
Merge remote-tracking branch 'upstream/main' into special_for_iter2
sweeneyde Jun 14, 2022
ed29777
use the new exponential backoff
sweeneyde Jun 14, 2022
188b357
merge with main
sweeneyde Jun 18, 2022
36d0999
revert using sdigits, add _PyLong_AssignValue
sweeneyde Jun 19, 2022
ad2e969
revert test_sys sizeof check
sweeneyde Jun 19, 2022
d55868f
revert test_range changes
sweeneyde Jun 19, 2022
2d6ee26
add comment and use Py_ssize_t
sweeneyde Jun 20, 2022
db21da1
Add comment: only positive
sweeneyde Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix dis
  • Loading branch information
sweeneyde committed Apr 19, 2022
commit bf583581777dc4de630cde5543f287e48379ae76
12 changes: 9 additions & 3 deletions Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
LOAD_GLOBAL = opmap['LOAD_GLOBAL']
BINARY_OP = opmap['BINARY_OP']
JUMP_BACKWARD = opmap['JUMP_BACKWARD']
FOR_ITER = opmap['FOR_ITER']

CACHE = opmap["CACHE"]

Expand Down Expand Up @@ -473,6 +474,8 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
elif deop in hasjrel:
signed_arg = -arg if _is_backward_jump(deop) else arg
argval = offset + 2 + signed_arg*2
if deop == FOR_ITER:
argval += 2
argrepr = "to " + repr(argval)
elif deop in haslocal or deop in hasfree:
argval, argrepr = _get_name_info(arg, varname_from_oparg)
Expand Down Expand Up @@ -596,11 +599,14 @@ def findlabels(code):
labels = []
for offset, op, arg in _unpack_opargs(code):
if arg is not None:
if op in hasjrel:
if _is_backward_jump(op):
deop = _deoptop(op)
if deop in hasjrel:
if _is_backward_jump(deop):
arg = -arg
label = offset + 2 + arg*2
elif op in hasjabs:
if deop == FOR_ITER:
label += 2
elif deop in hasjabs:
label = arg*2
else:
continue
Expand Down
Loading