[pypy-svn] r78421 - in pypy/branch/fast-forward/pypy: interpreter interpreter/astcompiler objspace/std
afa at codespeak.net
afa at codespeak.net
Thu Oct 28 22:13:29 CEST 2010
Author: afa
Date: Thu Oct 28 22:13:27 2010
New Revision: 78421
Modified:
pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py
pypy/branch/fast-forward/pypy/interpreter/pyopcode.py
pypy/branch/fast-forward/pypy/objspace/std/frame.py
Log:
Generate the same LIST_APPEND opcode as cpython.
Also remove a duplicated function.
Modified: pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py (original)
+++ pypy/branch/fast-forward/pypy/interpreter/astcompiler/codegen.py Thu Oct 28 22:13:27 2010
@@ -1060,7 +1060,7 @@
self._listcomp_generator(gens, gen_index, elt)
else:
elt.walkabout(self)
- self.emit_op_arg(ops.LIST_APPEND, gen_index)
+ self.emit_op_arg(ops.LIST_APPEND, gen_index + 1)
self.use_next_block(skip)
self.use_next_block(if_cleanup)
self.emit_jump(ops.JUMP_ABSOLUTE, start, True)
Modified: pypy/branch/fast-forward/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/pyopcode.py (original)
+++ pypy/branch/fast-forward/pypy/interpreter/pyopcode.py Thu Oct 28 22:13:27 2010
@@ -1037,7 +1037,7 @@
def LIST_APPEND(self, oparg, next_instr):
w = self.popvalue()
- v = self.peekvalue(oparg)
+ v = self.peekvalue(oparg - 1)
self.space.call_method(v, 'append', w)
def SET_ADD(self, oparg, next_instr):
@@ -1124,11 +1124,6 @@
w_dict = self.space.newdict()
self.pushvalue(w_dict)
- def LIST_APPEND(self, oparg, next_instr):
- w_value = self.popvalue()
- w_list = self.peekvalue(oparg + 1)
- self.space.call_method(w_list, "append", w_value)
-
def STORE_MAP(self, zero, next_instr):
if sys.version_info >= (2, 6):
w_key = self.popvalue()
Modified: pypy/branch/fast-forward/pypy/objspace/std/frame.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/frame.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/frame.py Thu Oct 28 22:13:27 2010
@@ -18,7 +18,7 @@
def LIST_APPEND(f, oparg, next_instr):
w = f.popvalue()
- v = f.peekvalue(oparg)
+ v = f.peekvalue(oparg - 1)
if type(v) is W_ListObject:
v.append(w)
else:
More information about the Pypy-commit
mailing list