Ezio Melotti
c18cc0edff
#5057 : the peepholer no longer optimizes subscription on unicode literals (e.g. u"foo"[0]) in order to produce compatible pyc files between narrow and wide builds.
2012-11-05 00:03:21 +02:00
Ezio Melotti
c283a85e12
Issue #5057 : fix a bug in the peepholer that led to non-portable pyc files between narrow and wide builds while optimizing BINARY_SUBSCR on non-BMP chars (e.g. u"\U00012345"[0]).
2011-04-15 16:14:04 +03:00
Florent Xicluna
0762788081
#7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper.
2010-03-21 01:14:24 +00:00
Ezio Melotti
aa98058cc4
use assert[Not]In where appropriate
2010-01-23 23:04:36 +00:00
Senthil Kumaran
ce8e33a095
Reverting the Revision: 77368. I committed Flox's big patch for tests by
...
mistake. ( It may come in for sure tough)
2010-01-08 19:04:16 +00:00
Senthil Kumaran
3ddc435af6
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
2010-01-08 18:41:40 +00:00
Benjamin Peterson
5c8da86f3a
convert usage of fail* to assert*
2009-06-30 22:57:08 +00:00
Jeffrey Yasskin
68d6852006
Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
...
POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing
a POP_TOP on each conditional and sometimes allows the peephole optimizer to
skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
2009-02-28 19:03:21 +00:00
Raymond Hettinger
20e1199fbe
Fix embarrassing typo and fix constantification of None
2007-03-02 19:20:46 +00:00
Neal Norwitz
cbeb687c68
Update the peephole optimizer to remove more dead code (jumps after returns)
...
and inline jumps to returns.
2006-10-14 21:33:38 +00:00
Raymond Hettinger
afd842f5b2
Teach the peepholer to fold unary operations on constants.
...
Afterwards, -0.5 loads in a single step and no longer requires a runtime
UNARY_NEGATIVE operation.
2005-02-20 12:46:54 +00:00
Brett Cannon
64d904b715
Remove set conversion optimization test (backed out of Python/compile.c in rev.
...
2.344).
2005-02-10 20:40:29 +00:00
Raymond Hettinger
7fcb7869ba
Adopt Skip's idea to optimize lists of constants in the context
...
of a "in" or "not in" test.
2005-02-07 19:32:38 +00:00
Raymond Hettinger
a164574937
Transform "x in (1,2,3)" to "x in frozenset([1,2,3])".
...
Inspired by Skip's idea to recognize the throw-away nature of sequences
in this context and to transform their type to one with better performance.
2005-02-06 22:05:42 +00:00
Raymond Hettinger
9feb267caf
Do not fold a constant if a large sequence will result.
...
Saves space in the presence of code like: (None,)*10000
2005-01-26 12:50:05 +00:00
Raymond Hettinger
922b3e2098
Remove test for BINARY_DIVIDE.
2005-01-07 18:34:56 +00:00
Raymond Hettinger
c34f8673a1
Teach the peephole optimizer to fold simple constant expressions.
2005-01-02 06:17:33 +00:00
Raymond Hettinger
5dec096e6a
Maintain peepholer's cumlc invariant by updating the running total
...
everytime a LOAD_CONSTANT is encountered, created, or overwritten.
Added two tests to cover cases affected by the patch.
2004-11-02 04:20:10 +00:00
Raymond Hettinger
23109ef11e
SF bug #1053819 : Segfault in tuple_of_constants
...
Peepholer could be fooled into misidentifying a tuple_of_constants.
Added code to count consecutive occurrences of LOAD_CONST.
Use the count to weed out the misidentified cases.
Added a unittest.
2004-10-26 08:59:14 +00:00
Raymond Hettinger
2c31a058eb
SF patch #1031667 : Fold tuples of constants into a single constant
...
Example:
>>> import dis
>>> dis.dis(compile('1,2,3', '', 'eval'))
0 0 LOAD_CONST 3 ((1, 2, 3))
3 RETURN_VALUE
2004-09-22 18:44:21 +00:00
Tim Peters
66cb018c96
Whitespace normalization.
2004-08-26 05:23:19 +00:00
Raymond Hettinger
fd2d1f7870
SF Patch #1013667 : Cleanup Peepholer Output
...
* Make a pass to eliminate NOPs. Produce code that is more readable,
more compact, and a tiny bit faster. Makes the peepholer more flexible
in the scope of allowable transformations.
* With Guido's okay, bumped up the magic number so that this patch gets
widely exercised before the alpha goes out.
2004-08-23 23:37:48 +00:00