[pypy-commit] pypy framestate: Add DUP_TOP, POP_TOP BCInstructions
rlamy
noreply at buildbot.pypy.org
Mon Nov 24 17:30:24 CET 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74709:f6a875ed479f
Date: 2014-11-24 05:05 +0000
http://bitbucket.org/pypy/pypy/changeset/f6a875ed479f/
Log: Add DUP_TOP, POP_TOP BCInstructions
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -353,6 +353,17 @@
def eval(self, ctx):
ctx.pushvalue(const(self.arg))
+ at bc_reader.register_opcode
+class DUP_TOP(BCInstruction):
+ def eval(self, ctx):
+ w_1 = ctx.peekvalue()
+ ctx.pushvalue(w_1)
+
+ at bc_reader.register_opcode
+class POP_TOP(BCInstruction):
+ def eval(self, ctx):
+ ctx.popvalue()
+
@flow_opcode
def POP_JUMP_IF_FALSE(self, reader):
reader.curr_block.operations.append(self)
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -818,9 +818,6 @@
raise FlowingError(
"Attempting to modify global variable %r." % (varname))
- def POP_TOP(self, oparg):
- self.popvalue()
-
def ROT_TWO(self, oparg):
w_1 = self.popvalue()
w_2 = self.popvalue()
@@ -845,10 +842,6 @@
self.pushvalue(w_3)
self.pushvalue(w_2)
- def DUP_TOP(self, oparg):
- w_1 = self.peekvalue()
- self.pushvalue(w_1)
-
def DUP_TOPX(self, itemcount):
delta = itemcount - 1
while True:
More information about the pypy-commit
mailing list