Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.6
Changeset: r96115:c8b336bec4ac
Date: 2019-02-20 15:23 +0100
http://bitbucket.org/pypy/pypy/changeset/c8b336bec4ac/
Log: adapt this completely amazing code that optimizes sys.exc_info() to
wordcode
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -149,23 +149,21 @@
p = frame.last_instr
if (ord(co[p]) == stdlib_opcode.CALL_FUNCTION or
ord(co[p]) == stdlib_opcode.CALL_METHOD):
- if ord(co[p+3]) == stdlib_opcode.LOAD_CONST:
- lo = ord(co[p+4])
- hi = ord(co[p+5])
- w_constant = frame.getconstant_w((hi * 256) | lo)
- if ord(co[p+6]) == stdlib_opcode.BINARY_SUBSCR:
+ if ord(co[p + 2]) == stdlib_opcode.LOAD_CONST:
+ lo = ord(co[p + 3])
+ w_constant = frame.getconstant_w(lo)
+ if ord(co[p + 4]) == stdlib_opcode.BINARY_SUBSCR:
if space.isinstance_w(w_constant, space.w_int):
constant = space.int_w(w_constant)
if -3 <= constant <= 1 and constant != -1:
need_all_three_args = False
- elif (ord(co[p+6]) == stdlib_opcode.LOAD_CONST and
- ord(co[p+9]) == stdlib_opcode.BUILD_SLICE and
- ord(co[p+12]) == stdlib_opcode.BINARY_SUBSCR):
+ elif (ord(co[p + 4]) == stdlib_opcode.LOAD_CONST and
+ ord(co[p + 6]) == stdlib_opcode.BUILD_SLICE and
+ ord(co[p + 8]) == stdlib_opcode.BINARY_SUBSCR):
if (space.is_w(w_constant, space.w_None) or
space.isinstance_w(w_constant, space.w_int)):
- lo = ord(co[p+7])
- hi = ord(co[p+8])
- w_constant = frame.getconstant_w((hi * 256) | lo)
+ lo = ord(co[p + 5])
+ w_constant = frame.getconstant_w(lo)
if space.isinstance_w(w_constant, space.w_int):
if space.int_w(w_constant) <= 2:
need_all_three_args = False
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit