[pypy-commit] pypy framestate: remove BCInstruction.decode() and decode LOAD_CONST arg later

rlamy noreply at buildbot.pypy.org
Tue Dec 2 20:02:34 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74790:bc3042836ed0
Date: 2014-12-02 16:03 +0100
http://bitbucket.org/pypy/pypy/changeset/bc3042836ed0/

Log:	remove BCInstruction.decode() and decode LOAD_CONST arg later

diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -128,7 +128,7 @@
         elif opnum in opcode.hasname:
             oparg = code.names[oparg]
         try:
-            op = self.num2cls[opnum].decode(oparg, offset, code)
+            op = self.num2cls[opnum](oparg, offset)
         except KeyError:
             op = GenericOpcode(self.opnames[opnum], opnum, oparg, offset)
         return next_offset, op
@@ -329,10 +329,6 @@
         self.arg = arg
         self.offset = offset
 
-    @classmethod
-    def decode(cls, arg, offset, code):
-        return cls(arg, offset)
-
     def eval(self, ctx):
         pass
 
@@ -375,12 +371,9 @@
 
 @bc_reader.register_opcode
 class LOAD_CONST(BCInstruction):
-    @staticmethod
-    def decode(arg, offset, code):
-        return LOAD_CONST(code.consts[arg], offset)
-
     def eval(self, ctx):
-        ctx.pushvalue(const(self.arg))
+        v_arg = const(ctx.pycode.consts[self.arg])
+        ctx.pushvalue(v_arg)
 
 @bc_reader.register_opcode
 class DUP_TOP(BCInstruction):


More information about the pypy-commit mailing list