[pypy-commit] pypy speedup-list-comprehension: Backed out changeset b3406c3e63a4
fijal
noreply at buildbot.pypy.org
Fri Feb 24 03:35:03 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: speedup-list-comprehension
Changeset: r52826:baf60af5868e
Date: 2012-02-23 19:30 -0700
http://bitbucket.org/pypy/pypy/changeset/baf60af5868e/
Log: Backed out changeset b3406c3e63a4
diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -965,7 +965,7 @@
self.emit_op_arg(ops.CALL_METHOD, (kwarg_count << 8) | arg_count)
return True
- def _listcomp_generator(self, gens, gen_index, elt, emit_build=False):
+ def _listcomp_generator(self, gens, gen_index, elt, outermost=False):
start = self.new_block()
skip = self.new_block()
if_cleanup = self.new_block()
@@ -973,7 +973,7 @@
gen = gens[gen_index]
assert isinstance(gen, ast.comprehension)
gen.iter.walkabout(self)
- if emit_build:
+ if outermost:
self.emit_op(ops.BUILD_LIST_FROM_ARG)
self.emit_op(ops.GET_ITER)
self.use_next_block(start)
@@ -1000,12 +1000,7 @@
def visit_ListComp(self, lc):
self.update_position(lc.lineno)
- if not lc.generators[0].ifs and len(lc.generators) == 1:
- emit_build = True
- else:
- emit_build = False
- self.emit_op_arg(ops.BUILD_LIST, 0)
- self._listcomp_generator(lc.generators, 0, lc.elt, emit_build)
+ self._listcomp_generator(lc.generators, 0, lc.elt, outermost=True)
def _comp_generator(self, node, generators, gen_index):
start = self.new_block()
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -4,7 +4,7 @@
The bytecode interpreter itself is implemented by the PyFrame class.
"""
-import imp, struct, types, new, sys, dis
+import dis, imp, struct, types, new, sys
from pypy.interpreter import eval
from pypy.interpreter.argument import Signature
@@ -14,6 +14,7 @@
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS, CO_NESTED,
CO_GENERATOR, CO_CONTAINSGLOBALS)
from pypy.rlib.rarithmetic import intmask
+from pypy.rlib.debug import make_sure_not_resized
from pypy.rlib import jit
from pypy.rlib.objectmodel import compute_hash
from pypy.tool.stdlib_opcode import opcodedesc, HAVE_ARGUMENT
@@ -264,7 +265,6 @@
def dump(self):
"""A dis.dis() dump of the code object."""
- return
co = self._to_code()
dis.dis(co)
More information about the pypy-commit
mailing list