<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Python/peephole.c, branch v3.2b1</title>
<subtitle>Python interpreter</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Python/peephole.c?h=v3.2b1</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Python/peephole.c?h=v3.2b1'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2010-11-30T09:41:01Z</updated>
<entry>
<title>Remove redundant includes of headers that are already included by Python.h.</title>
<updated>2010-11-30T09:41:01Z</updated>
<author>
<name>Georg Brandl</name>
<email>georg@python.org</email>
</author>
<published>2010-11-30T09:41:01Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e5b99f0fb306b80118849048b3d145c1a614c38b'/>
<id>urn:sha1:e5b99f0fb306b80118849048b3d145c1a614c38b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Issue 8403:  Don't mask KeyboardInterrupt during peephole operation.</title>
<updated>2010-08-22T08:39:49Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2010-08-22T08:39:49Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=819a0645567c452dc92852b36004b51c87154dc7'/>
<id>urn:sha1:819a0645567c452dc92852b36004b51c87154dc7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Recorded merge of revisions 81029 via svnmerge from</title>
<updated>2010-05-09T15:52:27Z</updated>
<author>
<name>Antoine Pitrou</name>
<email>solipsis@pitrou.net</email>
</author>
<published>2010-05-09T15:52:27Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f95a1b3c53bdd678b64aa608d4375660033460c3'/>
<id>urn:sha1:f95a1b3c53bdd678b64aa608d4375660033460c3</id>
<content type='text'>
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
</content>
</entry>
<entry>
<title>Issue #6690: Optimize the bytecode for expressions such as `x in {1, 2, 3}`,</title>
<updated>2010-01-16T18:37:38Z</updated>
<author>
<name>Antoine Pitrou</name>
<email>solipsis@pitrou.net</email>
</author>
<published>2010-01-16T18:37:38Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=b7fbcd396fc4a366433cf6f26cae64fecb056099'/>
<id>urn:sha1:b7fbcd396fc4a366433cf6f26cae64fecb056099</id>
<content type='text'>
where the right hand operand is a set of constants, by turning the set into
a frozenset and pre-building it as a constant.  The comparison operation
is made against the constant instead of building a new set each time it is
executed (a similar optimization already existed which turned a list of
constants into a pre-built tuple).  Patch and additional tests by Dave
Malcolm.
</content>
</entry>
<entry>
<title>Peephole constant folding had missed UNARY_POSITIVE.</title>
<updated>2009-10-22T11:22:50Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2009-10-22T11:22:50Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=af7adad51d149e66ee3eb66c1765914f0fd7f905'/>
<id>urn:sha1:af7adad51d149e66ee3eb66c1765914f0fd7f905</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merged revisions 73683,73786 via svnmerge from</title>
<updated>2009-07-21T02:51:58Z</updated>
<author>
<name>Alexandre Vassalotti</name>
<email>alexandre@peadrop.com</email>
</author>
<published>2009-07-21T02:51:58Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=6f8281865292ff1cec78331cb881fa311c4f6f92'/>
<id>urn:sha1:6f8281865292ff1cec78331cb881fa311c4f6f92</id>
<content type='text'>
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73683 | georg.brandl | 2009-06-29 10:44:49 -0400 (Mon, 29 Jun 2009) | 1 line

  Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint.
........
  r73786 | benjamin.peterson | 2009-07-02 18:56:16 -0400 (Thu, 02 Jul 2009) | 1 line

  condense with assertRaises
........
</content>
</entry>
<entry>
<title>Merged revisions 72912,72920,72940 via svnmerge from</title>
<updated>2009-06-28T03:18:59Z</updated>
<author>
<name>Benjamin Peterson</name>
<email>benjamin@python.org</email>
</author>
<published>2009-06-28T03:18:59Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=876b2f286b9af1a69846c84d1229014b2a885c97'/>
<id>urn:sha1:876b2f286b9af1a69846c84d1229014b2a885c97</id>
<content type='text'>
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines

  add a SETUP_WITH opcode

  It speeds up the with statement and correctly looks up the special
  methods involved.
........
  r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line

  take into account the fact that SETUP_WITH pushes a finally block
........
  r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line

  teach the peepholer about SETUP_WITH
........
</content>
</entry>
<entry>
<title>Fix 2 oversights from r69961.</title>
<updated>2009-02-28T19:49:43Z</updated>
<author>
<name>Jeffrey Yasskin</name>
<email>jyasskin@gmail.com</email>
</author>
<published>2009-02-28T19:49:43Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4dd40525e6b377fb06643311ce66b06c459a4589'/>
<id>urn:sha1:4dd40525e6b377fb06643311ce66b06c459a4589</id>
<content type='text'>
</content>
</entry>
<entry>
<title>http://bugs.python.org/issue4715</title>
<updated>2009-02-25T02:25:04Z</updated>
<author>
<name>Jeffrey Yasskin</name>
<email>jyasskin@gmail.com</email>
</author>
<published>2009-02-25T02:25:04Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=9de7ec7868554e92700e4bda6c5f9d8fcad634dc'/>
<id>urn:sha1:9de7ec7868554e92700e4bda6c5f9d8fcad634dc</id>
<content type='text'>
This patch by Antoine Pitrou optimizes the bytecode for conditional branches by
merging the following "POP_TOP" instruction into the conditional jump.  For
example, the list comprehension "[x for x in l if not x]" produced the
following bytecode:

  1           0 BUILD_LIST               0
              3 LOAD_FAST                0 (.0)
        &gt;&gt;    6 FOR_ITER                23 (to 32)
              9 STORE_FAST               1 (x)
             12 LOAD_FAST                1 (x)
             15 JUMP_IF_TRUE            10 (to 28)
             18 POP_TOP
             19 LOAD_FAST                1 (x)
             22 LIST_APPEND              2
             25 JUMP_ABSOLUTE            6
        &gt;&gt;   28 POP_TOP
             29 JUMP_ABSOLUTE            6
        &gt;&gt;   32 RETURN_VALUE

but after the patch it produces the following bytecode:

  1           0 BUILD_LIST               0
              3 LOAD_FAST                0 (.0)
        &gt;&gt;    6 FOR_ITER                18 (to 27)
              9 STORE_FAST               1 (x)
             12 LOAD_FAST                1 (x)
             15 POP_JUMP_IF_TRUE         6
             18 LOAD_FAST                1 (x)
             21 LIST_APPEND              2
             24 JUMP_ABSOLUTE            6
        &gt;&gt;   27 RETURN_VALUE

Notice that not only the code is shorter, but the conditional jump
(POP_JUMP_IF_TRUE) jumps right to the start of the loop instead of going through
the JUMP_ABSOLUTE at the end. "continue" statements are helped
similarly.

Furthermore, the old jump opcodes (JUMP_IF_FALSE, JUMP_IF_TRUE) have been
replaced by two new opcodes:
- JUMP_IF_TRUE_OR_POP, which jumps if true and pops otherwise
- JUMP_IF_FALSE_OR_POP, which jumps if false and pops otherwise
</content>
</entry>
<entry>
<title>Issue 2260: Small peephole optimization -- eliminate unnecessary POP_TOP /JUMP_FORWARD 1 pairs.</title>
<updated>2008-11-18T00:07:10Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2008-11-18T00:07:10Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e56131b60e6c2e63bcb6ecc2a6b7964d74ab847d'/>
<id>urn:sha1:e56131b60e6c2e63bcb6ecc2a6b7964d74ab847d</id>
<content type='text'>
</content>
</entry>
</feed>
