[pypy-commit] pypy stdlib-2.7.8: Minimize the stack effect when these instructions are used (from CPython

alex_gaynor noreply at buildbot.pypy.org
Sat Aug 23 17:33:28 CEST 2014


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: stdlib-2.7.8
Changeset: r73000:d52ea60276d3
Date: 2014-08-23 08:33 -0700
http://bitbucket.org/pypy/pypy/changeset/d52ea60276d3/

Log:	Minimize the stack effect when these instructions are used (from
	CPython

diff --git a/pypy/interpreter/astcompiler/assemble.py b/pypy/interpreter/astcompiler/assemble.py
--- a/pypy/interpreter/astcompiler/assemble.py
+++ b/pypy/interpreter/astcompiler/assemble.py
@@ -406,6 +406,9 @@
                     target_depth += 3
                     if target_depth > self._max_depth:
                         self._max_depth = target_depth
+                elif (jump_op == ops.JUMP_IF_TRUE_OR_POP or
+                      jump_op == ops.JUMP_IF_FALSE_OR_POP):
+                    depth -= 1
                 self._next_stack_depth_walk(instr.jump[0], target_depth)
                 if jump_op == ops.JUMP_ABSOLUTE or jump_op == ops.JUMP_FORWARD:
                     # Nothing more can occur.


More information about the pypy-commit mailing list